diff options
author | whitequark <whitequark@whitequark.org> | 2021-03-07 05:48:03 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-07 05:48:03 -0800 |
commit | 9bb839c613aff1d7658eac8ec46c3dcd3b220c5f (patch) | |
tree | 1a78ba758840c0d74ea2f1a3ac8b55778e7e4f4b /tests/verilog/param_no_default.sv | |
parent | 72ae15c77c34fe2306c3ac41c40521e9141b8cf0 (diff) | |
parent | d738b2c1272b02d8799e9feda83b1eae8ba10c07 (diff) | |
download | yosys-9bb839c613aff1d7658eac8ec46c3dcd3b220c5f.tar.gz yosys-9bb839c613aff1d7658eac8ec46c3dcd3b220c5f.tar.bz2 yosys-9bb839c613aff1d7658eac8ec46c3dcd3b220c5f.zip |
Merge pull request #2626 from zachjs/param-no-default
sv: support for parameters without default values
Diffstat (limited to 'tests/verilog/param_no_default.sv')
-rw-r--r-- | tests/verilog/param_no_default.sv | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/verilog/param_no_default.sv b/tests/verilog/param_no_default.sv new file mode 100644 index 000000000..cc35bd2ea --- /dev/null +++ b/tests/verilog/param_no_default.sv @@ -0,0 +1,52 @@ +module example #( + parameter w, + parameter x = 1, + parameter byte y, + parameter byte z = 3 +) ( + output a, b, + output byte c, d +); + assign a = w; + assign b = x; + assign c = y; + assign d = z; +endmodule + +module top; + wire a1, b1; + wire a2, b2; + wire a3, b3; + wire a4, b4; + byte c1, d1; + byte c2, d2; + byte c3, d3; + byte c4, d4; + + example #(0, 1, 2) e1(a1, b1, c1, d1); + example #(.w(1), .y(4)) e2(a2, b2, c2, d2); + example #(.x(0), .w(1), .y(5)) e3(a3, b3, c3, d3); + example #(1, 0, 9, 10) e4(a4, b4, c4, d4); + + always @* begin + assert (a1 == 0); + assert (b1 == 1); + assert (c1 == 2); + assert (d1 == 3); + + assert (a2 == 1); + assert (b2 == 1); + assert (c2 == 4); + assert (d3 == 3); + + assert (a3 == 1); + assert (b3 == 0); + assert (c3 == 5); + assert (d3 == 3); + + assert (a4 == 1); + assert (b4 == 0); + assert (c4 == 9); + assert (d4 == 10); + end +endmodule |