2016-07-13 02:49:05 -05:00
|
|
|
module demo1(input clk, input addtwo, output iseven);
|
2016-07-27 09:11:37 -05:00
|
|
|
reg [3:0] cnt;
|
2016-07-13 02:49:05 -05:00
|
|
|
wire [3:0] next_cnt;
|
|
|
|
|
|
|
|
inc inc_inst (addtwo, iseven, cnt, next_cnt);
|
|
|
|
|
|
|
|
always @(posedge clk)
|
|
|
|
cnt = (iseven ? cnt == 10 : cnt == 11) ? 0 : next_cnt;
|
2016-08-20 11:44:27 -05:00
|
|
|
|
|
|
|
`ifdef FORMAL
|
2016-07-13 02:49:05 -05:00
|
|
|
assert property (cnt != 15);
|
2016-09-02 06:54:24 -05:00
|
|
|
initial assume (!cnt[2]);
|
2016-08-20 11:44:27 -05:00
|
|
|
`endif
|
2016-07-13 02:49:05 -05:00
|
|
|
endmodule
|
|
|
|
|
|
|
|
module inc(input addtwo, output iseven, input [3:0] a, output [3:0] y);
|
|
|
|
assign iseven = !a[0];
|
|
|
|
assign y = a + (addtwo ? 2 : 1);
|
|
|
|
endmodule
|