diff options
author | Clifford Wolf <clifford@clifford.at> | 2014-10-27 13:21:57 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-10-27 13:21:57 +0100 |
commit | f9c096eedabdf7cd2cdd770da73bdd17d86559e7 (patch) | |
tree | 4f20d87b9f262ff96015bc75b84840524341da4a /tests/simple | |
parent | c4a2b3c1e9be01a0b7cf7d2cc8b91aea72d7830c (diff) | |
download | yosys-f9c096eedabdf7cd2cdd770da73bdd17d86559e7.tar.gz yosys-f9c096eedabdf7cd2cdd770da73bdd17d86559e7.tar.bz2 yosys-f9c096eedabdf7cd2cdd770da73bdd17d86559e7.zip |
Added support for task and function args in parentheses
Diffstat (limited to 'tests/simple')
-rw-r--r-- | tests/simple/task_func.v | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/tests/simple/task_func.v b/tests/simple/task_func.v index 51e31015f..9b8e26e51 100644 --- a/tests/simple/task_func.v +++ b/tests/simple/task_func.v @@ -33,8 +33,42 @@ end endmodule +// ------------------------------------------------------------------- -module task_func_test02( input [7:0] din_a, input [7:0] din_b, output [7:0] dout_a); +module task_func_test02(clk, a, b, c, x, y, z, w); + +input clk; +input [7:0] a, b, c; +output reg [7:0] x, y, z, w; + +function [7:0] sum_shift(input [3:0] s1, s2, s3); +sum_shift = s1 + (s2 << 2) + (s3 << 4); +endfunction + +task reset_w; +w = 0; +endtask + +task add_to(output [7:0] out, input [7:0] in); +out = out + in; +endtask + +always @(posedge clk) begin + x = sum_shift(a, b, c); + y = sum_shift(a[7:4], b[5:2], c[3:0]); + z = sum_shift(a[0], b[5:4], c >> 5) ^ sum_shift(1, 2, 3); + + reset_w; + add_to(w, x); + add_to(w, y); + add_to(w, z); +end + +endmodule + +// ------------------------------------------------------------------- + +module task_func_test03( input [7:0] din_a, input [7:0] din_b, output [7:0] dout_a); assign dout_a = test(din_a,din_b); function [7:0] test; input [7:0] a; |