Skip to content

Commit 68538e1

Browse files
committed
Support methods that have no output ports, since zero-width ports are now being filtered by WrapPorts
1 parent 0be36e6 commit 68538e1

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/comp/AState.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,9 @@ outputADefToADefs (ADef { adef_type = t, adef_expr = e }) [resName] =
748748
adef_type = t,
749749
adef_expr = e,
750750
adef_props = [] }]
751-
outputADefToADefs _ _ = internalError "outputADefToADefs: unexpected ADef resNames"
751+
outputADefToADefs (ADef { adef_type = ATBit 0}) [] = []
752+
outputADefToADefs def resNames =
753+
internalError $ "outputADefToADefs: unexpected ADef resNames: " ++ ppReadable (def, resNames)
752754

753755
getVInst :: AId -> [AVInst] -> AVInst
754756
getVInst i as = head ( [ a | a <- as, i == (avi_vname a) ] ++

src/comp/TCheck.hs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -730,19 +730,18 @@ tiExpr as td exp@(CmoduleVerilog name ui clks rsts args fields sch ps) = do
730730
then errUnexpectedEnable "value" t
731731
else errBadResType t
732732
chkResType ps Nothing [] t = do
733-
-- must have more than 0 ports
734-
when (null ps) $
735-
err (getPosition f,
736-
EForeignModTooFewPorts (pfpString f))
737733
-- update the Classic fieldinfo to BSV format
738734
let inputs = initOrErr "chkResType" ps
739735
let final_port = lastOrErr "chkResType" ps
740736
-- XXX kill PrimAction once imports in Prelude are converted over
741737
if (isActionWithoutValue t) || (isPrimAction t)
742-
then return (inputs, Just final_port, [])
743-
else if (isBitTuple t)
744-
then return (inputs, Nothing, [final_port])
745-
else errBadResType t
738+
then return (inputs, Just final_port, [])
739+
else if (isBitTuple t)
740+
-- XXX should have multiple output ports for bit tuples here?
741+
then return (inputs, Nothing, [final_port])
742+
else if (t == tPrimUnit)
743+
then return (ps, Nothing, [])
744+
else errBadResType t
746745

747746
errBadResType t =
748747
err (getPosition f,

0 commit comments

Comments
 (0)