-
-
Save benpye/2fc36cf4555d24c47ff7eebecfac5f78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module min( | |
input i_clk, | |
input i_clk_en | |
); | |
reg [1:0] counter = 0; | |
wire [1:0] next_counter; | |
assign next_counter = counter + 1; | |
always @(posedge i_clk) begin | |
if (i_clk_en) begin | |
counter <= next_counter; | |
end | |
end | |
`ifdef FORMAL | |
reg f_past_valid = 0; | |
reg [1:0] f_past_next_counter; | |
always @(posedge i_clk) begin | |
if (i_clk_en) begin | |
f_past_valid <= 1; | |
f_past_next_counter <= next_counter; | |
assert(~f_past_valid || counter == f_past_next_counter); | |
end | |
end | |
`endif | |
endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment