Commit dd3a7e68 by Zachary Snow

EmptyArgs conversion skips global functions until nested

parent 4d0d652c
...@@ -20,13 +20,14 @@ convert :: [AST] -> [AST] ...@@ -20,13 +20,14 @@ convert :: [AST] -> [AST]
convert = map $ traverseDescriptions convertDescription convert = map $ traverseDescriptions convertDescription
convertDescription :: Description -> Description convertDescription :: Description -> Description
convertDescription description = convertDescription (description @ (Part _ _ _ _ _ _)) =
traverseModuleItems traverseModuleItems
(traverseExprs $ traverseNestedExprs $ convertExpr functions) (traverseExprs $ traverseNestedExprs $ convertExpr functions)
description' description'
where where
(description', functions) = (description', functions) =
runWriter $ traverseModuleItemsM traverseFunctionsM description runWriter $ traverseModuleItemsM traverseFunctionsM description
convertDescription other = other
traverseFunctionsM :: ModuleItem -> Writer Idents ModuleItem traverseFunctionsM :: ModuleItem -> Writer Idents ModuleItem
traverseFunctionsM (MIPackageItem (Function ml t f decls stmts)) = do traverseFunctionsM (MIPackageItem (Function ml t f decls stmts)) = do
......
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
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment