diff options
author | Zachary Snow <zach@zachjs.com> | 2019-04-09 12:28:32 -0400 |
---|---|---|
committer | Zachary Snow <zach@zachjs.com> | 2019-04-09 12:28:32 -0400 |
commit | 5855024cccfbcb1919e3225f519bc9f0421c4056 (patch) | |
tree | 2664bb00c67f6308683557878f141f9c3b9b6bb6 /tests/sat/counters-repeat.v | |
parent | 22035c20ff071ec5c30990258850ecf97de5d5b3 (diff) | |
download | yosys-5855024cccfbcb1919e3225f519bc9f0421c4056.tar.gz yosys-5855024cccfbcb1919e3225f519bc9f0421c4056.tar.bz2 yosys-5855024cccfbcb1919e3225f519bc9f0421c4056.zip |
support repeat loops with constant repeat counts outside of constant functions
Diffstat (limited to 'tests/sat/counters-repeat.v')
-rw-r--r-- | tests/sat/counters-repeat.v | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/sat/counters-repeat.v b/tests/sat/counters-repeat.v new file mode 100644 index 000000000..2ea45499a --- /dev/null +++ b/tests/sat/counters-repeat.v @@ -0,0 +1,38 @@ +// coverage for repeat loops outside of constant functions + +module counter1(clk, rst, ping); + input clk, rst; + output ping; + reg [31:0] count; + + always @(posedge clk) begin + if (rst) + count <= 0; + else + count <= count + 1; + end + + assign ping = &count; +endmodule + +module counter2(clk, rst, ping); + input clk, rst; + output ping; + reg [31:0] count; + + integer i; + reg carry; + + always @(posedge clk) begin + carry = 1; + i = 0; + repeat (32) begin + count[i] <= !rst & (count[i] ^ carry); + carry = count[i] & carry; + i = i+1; + end + end + + assign ping = &count; +endmodule + |