Skip to content

Instantly share code, notes, and snippets.

@cr1901
Created August 26, 2018 05:22
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 cr1901/6f6edb6fb02b914eee48ae5b586ad6be to your computer and use it in GitHub Desktop.
Save cr1901/6f6edb6fb02b914eee48ae5b586ad6be to your computer and use it in GitHub Desktop.
read_verilog -formal quiz_4.v
prep -top quiz_4 -nordff
opt_clean
write_smt2 -wires quiz_4.smt2
PROJECT=quiz_4
check: $(PROJECT).smt2
yosys-smtbmc -s z3 -t 25 --presat --dump-smt2 $(PROJECT)_bmc.smt2 --dump-vcd $(PROJECT)_bmc.vcd $(PROJECT).smt2
yosys-smtbmc -s z3 -i -t 25 --presat --dump-smt2 $(PROJECT)_tmp.smt2 --dump-vcd $(PROJECT)_tmp.vcd $(PROJECT).smt2
$(PROJECT).smt2: $(PROJECT).v
yosys -s formal.ys
clean::
rm -f $(PROJECT)_*.* $(PROJECT).smt2
`default_nettype none
module quiz_4(input wire i_start_signal, input wire i_clk);
reg [5:0] counter;
initial counter = 0;
reg dummy;
initial dummy = 0;
always @(posedge i_clk)
if ((i_start_signal)&&(counter == 0))
counter <= 23;
else if (counter != 0)
counter <= counter - 1'b1;
always @(*)
assert(counter < 24);
always @(*)
assume(!i_start_signal);
always @(posedge i_clk) begin
dummy <= $past(counter == 0);
assert($past(counter == 0));
end
endmodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment