aboutsummaryrefslogtreecommitdiffstats
path: root/tests/simple
diff options
context:
space:
mode:
authorUdi Finkelstein <github@udifink.com>2017-09-26 20:34:24 +0300
committerUdi Finkelstein <github@udifink.com>2017-09-26 20:34:24 +0300
commite951ac0dfba554a86331b0863f7bda81effef10d (patch)
tree1bf85e76f6258af1779520e8fda1c196ea758f7f /tests/simple
parent6ddc6a7af42d371aa7c08505d82b30628372a16c (diff)
downloadyosys-e951ac0dfba554a86331b0863f7bda81effef10d.tar.gz
yosys-e951ac0dfba554a86331b0863f7bda81effef10d.tar.bz2
yosys-e951ac0dfba554a86331b0863f7bda81effef10d.zip
$size() now works correctly for all cases!
It seems the issues was that AST_MULTIRANGE is converted into a multirange_dimensions[] array on the AST_MEMORY node directly.
Diffstat (limited to 'tests/simple')
-rw-r--r--tests/simple/functions01.sv16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/simple/functions01.sv b/tests/simple/functions01.sv
index e36d6a764..d7ce2326e 100644
--- a/tests/simple/functions01.sv
+++ b/tests/simple/functions01.sv
@@ -1,8 +1,8 @@
module functions01;
-wire [3:0]x;
-wire [3:0]y[0:5];
-wire [3:0]z[0:5][0:7];
+wire [5:2]x;
+wire [3:0]y[2:7];
+wire [3:0]z[7:2][2:9];
//wire [$size(x)-1:0]x_size;
//wire [$size({x, x})-1:0]xx_size;
@@ -13,7 +13,14 @@ assert property ($size(x) == 4);
assert property ($size({3{x}}) == 3*4);
assert property ($size(y) == 6);
assert property ($size(y, 1) == 6);
-assert property ($size(y, 2) == 4);
+assert property ($size(y, (1+1)) == 4);
+
+assert property ($size(z) == 6);
+assert property ($size(z, 1) == 6);
+assert property ($size(z, 2) == 8);
+assert property ($size(z, 3) == 4);
+// This should trigger an error if enabled (it does).
+//assert property ($size(z, 4) == 4);
//wire [$bits(x)-1:0]x_bits;
//wire [$bits({x, x})-1:0]xx_bits;
@@ -22,5 +29,4 @@ assert property ($bits(x) == 4);
assert property ($bits(y) == 4*6);
assert property ($bits(z) == 4*6*8);
-
endmodule