Created
August 26, 2018 05:22
-
-
Save cr1901/6f6edb6fb02b914eee48ae5b586ad6be to your computer and use it in GitHub Desktop.
Quiz setup for: https://twitter.com/zipcpu/status/1033328682461478915
This file contains hidden or 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
read_verilog -formal quiz_4.v | |
prep -top quiz_4 -nordff | |
opt_clean | |
write_smt2 -wires quiz_4.smt2 |
This file contains hidden or 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
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 |
This file contains hidden or 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
`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