Skip to content

Commit

Permalink
visit function args in empty args conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
zachjs committed Nov 4, 2023
1 parent 18f3335 commit d5b9c1d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Fixed failure to resolve typenames suffixed with dimensions in contexts
permitting both types and expressions, e.g., `$bits(T[W-1:0])`
* Fixed errant constant folding of shadowed non-trivial localparams
* Fixed conversion of function calls with no arguments passed to other functions
* Fixed certain non-ANSI style port declarations being incorrectly reported as
incompatible

Expand Down
3 changes: 2 additions & 1 deletion src/Convert/EmptyArgs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ traverseStmt = traverseStmtExprsM traverseExpr
traverseExpr :: Expr -> SC Expr
traverseExpr (Call func (Args args [])) = do
details <- lookupElemM $ Dot func dummyIdent
let args' = if details /= Nothing
args' <- mapM traverseExpr $
if details /= Nothing
then RawNum 0 : args
else args
return $ Call func (Args args' [])
Expand Down
5 changes: 5 additions & 0 deletions test/core/empty_args.sv
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@ module top;
return 32'h00000013;
endfunction
initial $display(nop());
function automatic integer flip;
input integer inp;
return ~inp;
endfunction
initial $display(flip(nop()));
endmodule
5 changes: 5 additions & 0 deletions test/core/empty_args.v
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ module top;
nop = 32'h00000013;
endfunction
initial $display(nop(0));
function automatic integer flip;
input integer inp;
flip = ~inp;
endfunction
initial $display(flip(nop(0)));
endmodule

0 comments on commit d5b9c1d

Please sign in to comment.