mirror of https://github.com/zachjs/sv2v.git
fix conversion of multi-packed arrays in packages
This commit is contained in:
parent
2ac236dd03
commit
3e85885def
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
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
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
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
|
||||
Loading…
Reference in New Issue