Commit 3e85885d by Zachary Snow

fix conversion of multi-packed arrays in packages

parent 2ac236dd
......@@ -40,8 +40,10 @@ convert :: [AST] -> [AST]
convert = map $ traverseDescriptions convertDescription
convertDescription :: Description -> Description
convertDescription =
scopedConversion traverseDeclM traverseModuleItemM traverseStmtM Map.empty
convertDescription part @ Part{} =
scopedConversion traverseDeclM traverseModuleItemM traverseStmtM
Map.empty part
convertDescription other = other
-- collects and converts declarations with multiple packed dimensions
traverseDeclM :: Decl -> State Info Decl
......
package pkg;
localparam ARR [3:0][2:0] = 12'h3EA;
endpackage
module top;
import pkg::*;
initial begin
for (integer i = 0; i < 4; ++i)
for (integer j = 0; j < 3; ++j)
$display("ARR[%0d][%0d] = %0d", i, j, ARR[i][j]);
for (integer i = 0; i < 4; ++i)
for (integer j = 0; j < 3; ++j)
$display("ARR[%0d][%0d] = %0d", i, j, pkg::ARR[i][j]);
end
endmodule
module top;
localparam [11:0] ARR = 12'h3EA;
initial begin : foo
integer i, j;
for (i = 0; i < 4; ++i)
for (j = 0; j < 3; ++j)
$display("ARR[%0d][%0d] = %0d", i, j, ARR[i * 3 + j]);
for (i = 0; i < 4; ++i)
for (j = 0; j < 3; ++j)
$display("ARR[%0d][%0d] = %0d", i, j, ARR[i * 3 + j]);
end
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