aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2019-04-22 08:51:34 +0200
committerGitHub <noreply@github.com>2019-04-22 08:51:34 +0200
commitb40af877f3107150f8b648397ae4007d15406dac (patch)
tree5b47f0808c45eda1980848e9d175ee2d61413806 /tests
parenta98b1718142a85f8c66b23494ce5532783f93ac4 (diff)
parent5855024cccfbcb1919e3225f519bc9f0421c4056 (diff)
downloadyosys-b40af877f3107150f8b648397ae4007d15406dac.tar.gz
yosys-b40af877f3107150f8b648397ae4007d15406dac.tar.bz2
yosys-b40af877f3107150f8b648397ae4007d15406dac.zip
Merge pull request #909 from zachjs/master
support repeat loops with constant repeat counts outside of constant functions
Diffstat (limited to 'tests')
-rw-r--r--tests/sat/counters-repeat.v38
-rw-r--r--tests/sat/counters-repeat.ys10
2 files changed, 48 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
+
diff --git a/tests/sat/counters-repeat.ys b/tests/sat/counters-repeat.ys
new file mode 100644
index 000000000..b3dcfe08a
--- /dev/null
+++ b/tests/sat/counters-repeat.ys
@@ -0,0 +1,10 @@
+
+read_verilog counters-repeat.v
+proc; opt
+
+expose -shared counter1 counter2
+miter -equiv -make_assert -make_outputs counter1 counter2 miter
+
+cd miter; flatten; opt
+sat -verify -prove-asserts -tempinduct -set-at 1 in_rst 1 -seq 1 -show-inputs -show-outputs
+