Skip to content

Instantly share code, notes, and snippets.

@benpye

benpye/min.sby Secret

Created March 26, 2019 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benpye/008009e97f54d732e689bada85e227fe to your computer and use it in GitHub Desktop.
Save benpye/008009e97f54d732e689bada85e227fe to your computer and use it in GitHub Desktop.
[options]
mode prove
[engines]
smtbmc z3
[script]
read -formal min.v
prep -top min
[files]
min.v
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