diff options
author | Clifford Wolf <clifford@clifford.at> | 2017-09-29 11:39:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-29 11:39:36 +0200 |
commit | 637a02eb5cf8ef09a7fb02af31d6149a31460d0f (patch) | |
tree | 1bf85e76f6258af1779520e8fda1c196ea758f7f /tests/simple | |
parent | 29f8acf09586c34222923139511ef64c00eccc8b (diff) | |
parent | e951ac0dfba554a86331b0863f7bda81effef10d (diff) | |
download | yosys-637a02eb5cf8ef09a7fb02af31d6149a31460d0f.tar.gz yosys-637a02eb5cf8ef09a7fb02af31d6149a31460d0f.tar.bz2 yosys-637a02eb5cf8ef09a7fb02af31d6149a31460d0f.zip |
Merge pull request #425 from udif/udif_dollar_bits
Add $bits() and $size()
Diffstat (limited to 'tests/simple')
-rw-r--r-- | tests/simple/functions01.sv | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/simple/functions01.sv b/tests/simple/functions01.sv new file mode 100644 index 000000000..d7ce2326e --- /dev/null +++ b/tests/simple/functions01.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 |