diff options
author | Clifford Wolf <clifford@clifford.at> | 2017-09-29 11:56:43 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2017-09-29 11:56:43 +0200 |
commit | dbfd8460a9f1d24d1c8893dfae7dd272d17a7b6f (patch) | |
tree | 7afbacc238f153323f425f39987e0520e0b844ee /tests/sat | |
parent | 637a02eb5cf8ef09a7fb02af31d6149a31460d0f (diff) | |
download | yosys-dbfd8460a9f1d24d1c8893dfae7dd272d17a7b6f.tar.gz yosys-dbfd8460a9f1d24d1c8893dfae7dd272d17a7b6f.tar.bz2 yosys-dbfd8460a9f1d24d1c8893dfae7dd272d17a7b6f.zip |
Allow $size and $bits in verilog mode, actually check test case
Diffstat (limited to 'tests/sat')
-rw-r--r-- | tests/sat/sizebits.sv | 32 | ||||
-rw-r--r-- | tests/sat/sizebits.ys | 2 |
2 files changed, 34 insertions, 0 deletions
diff --git a/tests/sat/sizebits.sv b/tests/sat/sizebits.sv new file mode 100644 index 000000000..d7ce2326e --- /dev/null +++ b/tests/sat/sizebits.sv @@ -0,0 +1,32 @@ +module functions01; + +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; +//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, (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; + +assert property ($bits(x) == 4); +assert property ($bits(y) == 4*6); +assert property ($bits(z) == 4*6*8); + +endmodule diff --git a/tests/sat/sizebits.ys b/tests/sat/sizebits.ys new file mode 100644 index 000000000..689227a41 --- /dev/null +++ b/tests/sat/sizebits.ys @@ -0,0 +1,2 @@ +read_verilog -sv sizebits.sv +prep; sat -verify -prove-asserts |