diff options
author | Zachary Snow <zach@zachjs.com> | 2020-12-26 08:39:57 -0700 |
---|---|---|
committer | Zachary Snow <zach@zachjs.com> | 2020-12-26 08:48:01 -0700 |
commit | 1419c8761cc7594f56855546a633f8bdf0e3ebca (patch) | |
tree | c002566f1988d5f5a6bea7fc11bcc9edb64d656e /tests/various | |
parent | 449154803737f45406f711d965113536bc8ae818 (diff) | |
download | yosys-1419c8761cc7594f56855546a633f8bdf0e3ebca.tar.gz yosys-1419c8761cc7594f56855546a633f8bdf0e3ebca.tar.bz2 yosys-1419c8761cc7594f56855546a633f8bdf0e3ebca.zip |
Fix constants bound to redeclared function args
The changes in #2476 ensured that function inputs like `input x;`
retained their single-bit size when instantiated with a constant
argument and turned into a localparam. That change did not handle the
possibility for an input to be redeclared later on with an explicit
width, such as `integer x;`.
Diffstat (limited to 'tests/various')
-rw-r--r-- | tests/various/const_arg_loop.v | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/various/const_arg_loop.v b/tests/various/const_arg_loop.v index ed15aa135..358fb439a 100644 --- a/tests/various/const_arg_loop.v +++ b/tests/various/const_arg_loop.v @@ -50,6 +50,12 @@ module top; operation4 = {a, b}; endfunction + function automatic integer operation5; + input x; + integer x; + operation5 = x; + endfunction + wire [31:0] a; assign a = 2; @@ -70,6 +76,9 @@ module top; wire [16:0] x4; assign x4 = operation4(a[15:0], 0); + wire [31:0] x5; + assign x5 = operation5(64); + // `define VERIFY `ifdef VERIFY assert property (a == 2); @@ -79,5 +88,6 @@ module top; assert property (x2 == 4); assert property (x3 == 16); assert property (x4 == a << 1); + assert property (x5 == 64); `endif endmodule |