mirror of https://github.com/zachjs/sv2v.git
EmptyArgs conversion skips global functions until nested
This commit is contained in:
parent
4d0d652c86
commit
dd3a7e687c
|
|
@ -20,13 +20,14 @@ convert :: [AST] -> [AST]
|
|||
convert = map $ traverseDescriptions convertDescription
|
||||
|
||||
convertDescription :: Description -> Description
|
||||
convertDescription description =
|
||||
convertDescription (description @ (Part _ _ _ _ _ _)) =
|
||||
traverseModuleItems
|
||||
(traverseExprs $ traverseNestedExprs $ convertExpr functions)
|
||||
description'
|
||||
where
|
||||
(description', functions) =
|
||||
runWriter $ traverseModuleItemsM traverseFunctionsM description
|
||||
convertDescription other = other
|
||||
|
||||
traverseFunctionsM :: ModuleItem -> Writer Idents ModuleItem
|
||||
traverseFunctionsM (MIPackageItem (Function ml t f decls stmts)) = do
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package evil_pkg;
|
||||
localparam Z = 1;
|
||||
localparam A = Z;
|
||||
localparam B = Z;
|
||||
|
||||
function logic evil_fun;
|
||||
return A;
|
||||
endfunction
|
||||
endpackage
|
||||
|
||||
module evil_mdl (
|
||||
output logic [evil_pkg::B-1:0] foo
|
||||
);
|
||||
initial foo = evil_pkg::evil_fun();
|
||||
endmodule
|
||||
|
||||
module top;
|
||||
logic [evil_pkg::B-1:0] foo;
|
||||
evil_mdl x(foo);
|
||||
initial $display(foo);
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
module evil_mdl (
|
||||
output reg [evil_pkg_B-1:0] foo
|
||||
);
|
||||
localparam evil_pkg_Z = 1;
|
||||
localparam evil_pkg_A = evil_pkg_Z;
|
||||
localparam evil_pkg_B = evil_pkg_Z;
|
||||
initial foo = evil_pkg_A;
|
||||
endmodule
|
||||
|
||||
module top;
|
||||
localparam evil_pkg_Z = 1;
|
||||
localparam evil_pkg_A = evil_pkg_Z;
|
||||
localparam evil_pkg_B = evil_pkg_Z;
|
||||
wire [evil_pkg_B-1:0] foo;
|
||||
evil_mdl x(foo);
|
||||
initial $display(foo);
|
||||
endmodule
|
||||
Loading…
Reference in New Issue