aboutsummaryrefslogtreecommitdiffstats
path: root/tests/simple
diff options
context:
space:
mode:
authorUdi Finkelstein <github@udifink.com>2017-09-26 19:18:25 +0300
committerUdi Finkelstein <github@udifink.com>2017-09-26 19:18:25 +0300
commit6ddc6a7af42d371aa7c08505d82b30628372a16c (patch)
treeff300a17cc890ff16590f2947bcfbc0342ddb2b2 /tests/simple
parent7e391ba90438ba1c20c29863d1556cb6bfd1ea29 (diff)
downloadyosys-6ddc6a7af42d371aa7c08505d82b30628372a16c.tar.gz
yosys-6ddc6a7af42d371aa7c08505d82b30628372a16c.tar.bz2
yosys-6ddc6a7af42d371aa7c08505d82b30628372a16c.zip
$size() seems to work now with or without the optional parameter.
Multidimensional arrays still don't work. I suspect the problem is that the array is flattened into a 1D array before $size() is evaluated.
Diffstat (limited to 'tests/simple')
-rw-r--r--tests/simple/functions01.sv26
1 files changed, 18 insertions, 8 deletions
diff --git a/tests/simple/functions01.sv b/tests/simple/functions01.sv
index d6cd53e07..e36d6a764 100644
--- a/tests/simple/functions01.sv
+++ b/tests/simple/functions01.sv
@@ -1,16 +1,26 @@
module functions01;
wire [3:0]x;
-wire [$size(x)-1:0]x_size;
-wire [$size({x, x})-1:0]xx_size;
wire [3:0]y[0:5];
-wire [$size(y)-1:0]y_size;
wire [3:0]z[0:5][0:7];
-wire [$size(z)-1:0]z_size;
-wire [$bits(x)-1:0]x_bits;
-wire [$bits({x, x})-1:0]xx_bits;
-wire [$bits(y)-1:0]y_bits;
-wire [$bits(z)-1:0]z_bits;
+//wire [$size(x)-1:0]x_size;
+//wire [$size({x, x})-1:0]xx_size;
+//wire [$size(y)-1:0]y_size;
+//wire [$size(z)-1:0]z_size;
+
+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);
+
+//wire [$bits(x)-1:0]x_bits;
+//wire [$bits({x, x})-1:0]xx_bits;
+
+assert property ($bits(x) == 4);
+assert property ($bits(y) == 4*6);
+assert property ($bits(z) == 4*6*8);
+
endmodule