aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2019-09-19 21:07:20 +0100
committerDavid Shah <dave@ds0.me>2019-10-03 09:54:14 +0100
commitc9629516120930aedaf52d72fec5d7fabe51d496 (patch)
tree4219cf0483c9ee44938eb7432492d840a57ab970 /tests
parentf6b5e47e40b4a2bda6e5d928480ea218a6a911c2 (diff)
downloadyosys-c9629516120930aedaf52d72fec5d7fabe51d496.tar.gz
yosys-c9629516120930aedaf52d72fec5d7fabe51d496.tar.bz2
yosys-c9629516120930aedaf52d72fec5d7fabe51d496.zip
sv: Fix typedef parameters
Signed-off-by: David Shah <dave@ds0.me>
Diffstat (limited to 'tests')
-rw-r--r--tests/svtypes/typedef_param.sv22
-rw-r--r--tests/svtypes/typedef_simple.sv (renamed from tests/svtypes/typedef1.sv)3
2 files changed, 22 insertions, 3 deletions
diff --git a/tests/svtypes/typedef_param.sv b/tests/svtypes/typedef_param.sv
new file mode 100644
index 000000000..13a522f19
--- /dev/null
+++ b/tests/svtypes/typedef_param.sv
@@ -0,0 +1,22 @@
+`define STRINGIFY(x) `"x`"
+`define STATIC_ASSERT(x) if(!(x)) $error({"assert failed: ", `STRINGIFY(x)})
+
+module top;
+
+ typedef logic [1:0] uint2_t;
+ typedef logic signed [3:0] int4_t;
+ typedef logic signed [7:0] int8_t;
+ typedef int8_t char_t;
+
+ parameter uint2_t int2 = 2'b10;
+ localparam int4_t int4 = -1;
+ localparam int8_t int8 = int4;
+ localparam char_t ch = int8;
+
+
+ `STATIC_ASSERT(int2 == 2'b10);
+ `STATIC_ASSERT(int4 == 4'b1111);
+ `STATIC_ASSERT(int8 == 8'b11111111);
+ `STATIC_ASSERT(ch == 8'b11111111);
+
+endmodule \ No newline at end of file
diff --git a/tests/svtypes/typedef1.sv b/tests/svtypes/typedef_simple.sv
index 9e5d02364..0cf2c072c 100644
--- a/tests/svtypes/typedef1.sv
+++ b/tests/svtypes/typedef_simple.sv
@@ -1,6 +1,3 @@
-`define STRINGIFY(x) `"x`"
-`define STATIC_ASSERT(x) if(!(x)) $error({"assert failed: ", `STRINGIFY(x)})
-
module top;
typedef logic [1:0] uint2_t;