Test multirange (unpacked) arrays size
authorLukasz Dalek <ldalek@antmicro.com>
Mon, 3 Aug 2020 13:34:43 +0000 (15:34 +0200)
committerLukasz Dalek <ldalek@antmicro.com>
Mon, 3 Aug 2020 13:34:55 +0000 (15:34 +0200)
Signed-off-by: Lukasz Dalek <ldalek@antmicro.com>
tests/svtypes/multirange_array.sv [new file with mode: 0644]

diff --git a/tests/svtypes/multirange_array.sv b/tests/svtypes/multirange_array.sv
new file mode 100644 (file)
index 0000000..be0d3df
--- /dev/null
@@ -0,0 +1,16 @@
+// test for multirange arrays
+
+`define STRINGIFY(x) `"x`"
+`define STATIC_ASSERT(x) if(!(x)) $error({"assert failed: ", `STRINGIFY(x)})
+
+module top;
+
+       logic a [3];
+       logic b [3][5];
+       logic c [3][5][7];
+
+       `STATIC_ASSERT($bits(a) == 3);
+       `STATIC_ASSERT($bits(b) == 15);
+       `STATIC_ASSERT($bits(c) == 105);
+
+endmodule