Skip to content

Commit

Permalink
Prefer use of deepErrorX over undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
t-wallet committed Oct 18, 2024
1 parent f58812c commit a90007a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions clash-protocols/src/Protocols/PacketStream/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,21 @@ 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
)

fromDfCircuit _ = fromSignals go
where
go (fwdIn, bwdIn) =
( coerce <$> P.fst bwdIn
, (fmap Df.maybeToData fwdIn, pure undefined)
,
( fmap Df.maybeToData fwdIn
, pure (deepErrorX "PacketStream fromDfCircuit: undefined")
)
)

instance
Expand Down
4 changes: 2 additions & 2 deletions clash-protocols/src/Protocols/PacketStream/Depacketizers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ::
Expand Down Expand Up @@ -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 ::
Expand Down

0 comments on commit a90007a

Please sign in to comment.