Add a couple more tests
[yosys.git] / tests / sat / counters-repeat.v
1 // coverage for repeat loops outside of constant functions
2
3 module counter1(clk, rst, ping);
4 input clk, rst;
5 output ping;
6 reg [31:0] count;
7
8 always @(posedge clk) begin
9 if (rst)
10 count <= 0;
11 else
12 count <= count + 1;
13 end
14
15 assign ping = &count;
16 endmodule
17
18 module counter2(clk, rst, ping);
19 input clk, rst;
20 output ping;
21 reg [31:0] count;
22
23 integer i;
24 reg carry;
25
26 always @(posedge clk) begin
27 carry = 1;
28 i = 0;
29 repeat (32) begin
30 count[i] <= !rst & (count[i] ^ carry);
31 carry = count[i] & carry;
32 i = i+1;
33 end
34 end
35
36 assign ping = &count;
37 endmodule
38