pass through support for functions with output ports

This commit is contained in:
Zachary Snow 2022-02-07 23:38:11 +01:00
parent eb42042c1c
commit 96cfe18ca7
3 changed files with 14 additions and 1 deletions

View File

@ -6,6 +6,7 @@
`'1`, `'x`) via `--exclude UnbasedUniszed`
* Added support for enumerated type ranges (e.g., `enum { X[3:5] }`)
* Added support for passing through DPI imports and exports
* Added support for passing through functions with output ports
### Other Enhancements

View File

@ -1571,9 +1571,10 @@ combineDeclsAndStmts (a1, b1) (a2, b2) =
makeInput :: Decl -> Decl
makeInput (Variable Local t x a e) = Variable Input t x a e
makeInput (Variable Input t x a e) = Variable Input t x a e
makeInput (Variable Output t x a e) = Variable Output t x a e
makeInput (CommentDecl c) = CommentDecl c
makeInput other =
error $ "unexpected non-var or non-input decl: " ++ (show other)
error $ "unexpected non-var or non-port function decl: " ++ (show other)
checkTag :: String -> String -> a -> ParseState a
checkTag _ "" x = return x

11
test/nosim/func_output.sv Normal file
View File

@ -0,0 +1,11 @@
module top;
function automatic integer f;
input integer x;
output integer y;
f = x * 3;
y = x * 5;
endfunction
integer x, y;
initial x = f(-1, y);
initial $display(x, y);
endmodule