Skip to content

Commit fe4c3e4

Browse files
committed
SAWCentral.Yosys.Cell: Leave comments next to panics that really shouldn't be panicking
1 parent 75c4b5e commit fe4c3e4

File tree

1 file changed

+6
-0
lines changed
  • saw-central/src/SAWCentral/Yosys

1 file changed

+6
-0
lines changed

saw-central/src/SAWCentral/Yosys/Cell.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ primCellToMap sc c args =
318318
Just (Aeson.Number n) -> n > 0
319319
Just (Aeson.String t) -> textBinNat t > 0
320320
Just v ->
321+
-- XXX This should not be a panic, as it is possible to trigger this
322+
-- with a malformed input file.
321323
panic "cellToTerm"
322324
[ "Expected SIGNED parameter to be a number or a string,"
323325
, "but encountered " <> Text.pack (show v)
@@ -326,6 +328,8 @@ primCellToMap sc c args =
326328
connWidthNat :: Text -> Natural
327329
connWidthNat onm =
328330
case Map.lookup onm $ c ^. cellConnections of
331+
-- XXX This should not be a panic, as it is possible to trigger this
332+
-- with a malformed input file.
329333
Nothing -> panic "cellToTerm" ["Missing expected output name for " <> nm <> " cell"]
330334
Just bits -> fromIntegral $ length bits
331335
connWidth :: Text -> IO SC.Term
@@ -335,6 +339,8 @@ primCellToMap sc c args =
335339
input :: Text -> IO CellTerm
336340
input inpNm =
337341
case Map.lookup inpNm args of
342+
-- XXX This should not be a panic, as it is possible to trigger this
343+
-- with a malformed input file.
338344
Nothing -> panic "cellToTerm" [nm <> " missing input " <> inpNm]
339345
Just a -> pure $ CellTerm a (connWidthNat inpNm) (connSigned inpNm)
340346

0 commit comments

Comments
 (0)