From 97b5f569fd722368bc85215ae6037dfa93f9a9eb Mon Sep 17 00:00:00 2001 From: t-wallet Date: Fri, 18 Oct 2024 16:10:27 +0200 Subject: [PATCH] Prefer use of deepErrorX over undefined --- clash-protocols/src/Protocols/PacketStream/Base.hs | 8 ++++++-- .../src/Protocols/PacketStream/Depacketizers.hs | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/clash-protocols/src/Protocols/PacketStream/Base.hs b/clash-protocols/src/Protocols/PacketStream/Base.hs index 76fde6b3..c6e62c86 100644 --- a/clash-protocols/src/Protocols/PacketStream/Base.hs +++ b/clash-protocols/src/Protocols/PacketStream/Base.hs @@ -166,7 +166,9 @@ instance DfConv.DfConv (PacketStream dom dataWidth meta) where toDfCircuit _ = fromSignals go where go (fwdIn, bwdIn) = - ( (fmap coerce bwdIn, pure undefined) + ( ( fmap coerce bwdIn + , pure (deepErrorX "PacketStream toDfCircuit: undefined") + ) , Df.dataToMaybe <$> P.fst fwdIn ) @@ -174,7 +176,9 @@ instance DfConv.DfConv (PacketStream dom dataWidth meta) where where go (fwdIn, bwdIn) = ( coerce <$> P.fst bwdIn - , (fmap Df.maybeToData fwdIn, pure undefined) + , ( fmap Df.maybeToData fwdIn + , pure (deepErrorX "PacketStream fromDfCircuit: undefined") + ) ) instance diff --git a/clash-protocols/src/Protocols/PacketStream/Depacketizers.hs b/clash-protocols/src/Protocols/PacketStream/Depacketizers.hs index 35ca2222..3b5812a1 100644 --- a/clash-protocols/src/Protocols/PacketStream/Depacketizers.hs +++ b/clash-protocols/src/Protocols/PacketStream/Depacketizers.hs @@ -94,7 +94,7 @@ instance Default (DepacketizerState headerBytes dataWidth) where def :: DepacketizerState headerBytes dataWidth - def = Parse False (repeat undefined) maxBound + def = Parse False (deepErrorX "depacketizerT: undefined intial buffer") maxBound -- | Depacketizer state transition function. depacketizerT :: @@ -270,7 +270,7 @@ instance Default (DfDepacketizerState headerBytes dataWidth) where def :: DfDepacketizerState headerBytes dataWidth - def = DfParse False (repeat undefined) maxBound + def = DfParse False (deepErrorX "depacketizeToDfT: undefined intial buffer") maxBound -- | Df depacketizer transition function. depacketizeToDfT ::