Commit 7a0d0c6d by Miodrag Milanovic

Added properly handled regression tests

parent c7e05d2b
import os
is_heavy_enabled = int(os.getenv('ENABLE_HEAVY_TESTS', '0')) == 1
for root, dirs, files in sorted(os.walk(".")):
for file in files:
if file.endswith('.ys') or file.endswith('run-test.sh'):
dir = os.path.basename(root)
work = os.path.splitext(file)[0]
heavy = os.path.exists(os.path.join(dir, "heavy_test"))
is_disabled = os.path.exists(os.path.join(dir, work + ".disable"))
print("all: {0}/work_{1}/.stamp\n"
"{0}/work_{1}/.stamp:".format(dir, work))
if (is_disabled):
print("\t@echo 'Skipping disabled test {0}..'".format(dir, work))
continue
if (heavy and not is_heavy_enabled):
print("\t@echo 'Skipping heavy test {0}..'".format(dir, work))
continue
print("\t@echo 'Running {2}{1}..'\n"
"\t@../run-new.sh {0} {1}\n"
"clean::\n"
"\t@echo 'Cleaning {1}..'\n"
"\t@rm -rf {0}/work_{1}".format(dir, work, "heavy " if heavy else ""))
print(".PHONY: all clean")
\ No newline at end of file
PYTHON_EXECUTABLE := $(shell if python3 -c ""; then echo "python3"; else echo "python"; fi) PYTHON_EXECUTABLE := $(shell if python3 -c ""; then echo "python3"; else echo "python"; fi)
all: all: run-test.mk
run-test.mk: ../generate.py run-test.mk: ../generate-new.py
@$(PYTHON_EXECUTABLE) ../generate.py > run-test.mk @$(PYTHON_EXECUTABLE) ../generate-new.py > run-test.mk
include run-test.mk include run-test.mk
clean::
@rm -rf run-test.mk
@echo 'Cleaning run-test.mk..'
.PHONY: all clean .PHONY: all clean
module assert_dff(input clk, input test, input pat);
always @(posedge clk)
begin
#2
if (test != pat)
begin
$display("ERROR: ASSERTION FAILED in %m:",$time);
$stop;
end
end
endmodule
module assert_tri(input en, input A, input B);
always @(posedge en)
begin
//#1;
if (A !== B)
begin
$display("ERROR: ASSERTION FAILED in %m:",$time," ",A," ",B);
$stop;
end
end
endmodule
module assert_Z(input clk, input A);
always @(posedge clk)
begin
//#1;
if (A === 1'bZ)
begin
$display("ERROR: ASSERTION FAILED in %m:",$time," ",A);
$stop;
end
end
endmodule
module assert_X(input clk, input A);
always @(posedge clk)
begin
//#1;
if (A === 1'bX)
begin
$display("ERROR: ASSERTION FAILED in %m:",$time," ",A);
$stop;
end
end
endmodule
module assert_comb(input A, input B);
always @(*)
begin
#1;
if (A !== B)
begin
$display("ERROR: ASSERTION FAILED in %m:",$time," ",A," ",B);
$stop;
end
end
endmodule
read_verilog ../top.v read_verilog top.v
synth -top d synth -top d
read_verilog ../top.v read_verilog top.v
synth -top top synth -top top
write_verilog synth.v
read_verilog ../top.v read_verilog top.v
#Myname: added some comment with a colon #Myname: added some comment with a colon
synth -top top synth -top top
read_verilog ../top.v read_verilog top.v
synth -top top synth -top top
read_verilog ../top.v read_verilog top.v
freduce freduce
read_verilog ../top.v read_verilog top.v
/* Generated by Yosys 0.5+284 (git sha1 f40d1b7, gcc 5.2.1-15 -fPIC -Os) */ /* Generated by Yosys 0.5+284 (git sha1 f40d1b7, gcc 5.2.1-15 -fPIC -Os) */
(* src = "test.v:1" *) (* src = "test.v:1" *)
module top(X, Y); module is28(X, Y);
wire _0000_; wire _0000_;
wire _0001_; wire _0001_;
wire _0002_; wire _0002_;
......
\\\X\[0\] , \\\X\[1\] , \\\X\[2\] ,
read_verilog ../top.v read_verilog is28.v
hierarchy hierarchy
splitnets -ports splitnets -ports
write_verilog result.out
!mkdir -p work_issue_00078
write_verilog work_issue_00078/synth.v
!grep "(\\\X\[0\] , \\\X\[1\] , \\\X\[2\] ," work_issue_00078/synth.v > /dev/null
\ No newline at end of file
logger -expect error "syntax error" 1 logger -expect error "syntax error" 1
read_verilog ../top.v read_verilog top.v
logger -expect error "no AST_WIRE node" 1
read_verilog top.v
read_verilog ../top.v logger -expect warning "Deep recursion in AST simplifier." 1
read_verilog top.v
read_verilog ../top.v read_verilog top.v
synth_xilinx -top top synth_xilinx -top top
cd top cd top
select -assert-count 1 t:RAMB18E1 select -assert-count 1 t:RAMB18E1
\ No newline at end of file
read_verilog ../top.v read_verilog top.v
read_verilog ../top.v read_verilog top.v
read_verilog ../top.v read_verilog top.v
logger -expect error "syntax error, unexpected \$undefined" 1
read_verilog top.v
read_verilog ../top.v read_verilog top.v
logger -expect error "syntax error, unexpected '\+'" 1
read_verilog top.v
read_verilog ../top.v
synth -top top
logger -expect error "syntax error, unexpected '#'" 1
read_verilog top.v
read_verilog ../top.v
synth -top top
logger -expect error "syntax error, unexpected TOK_INOUT" 1
read_verilog top.v
read_verilog ../top.v
synth -top top
read_verilog ../top.v read_verilog top.v
logger -expect error "syntax error, unexpected ','" 1
read_verilog top.v
read_verilog ../top.v read_verilog top.v
read_verilog ../top.v read_verilog top.v
synth -top top synth -top top
splitnets -ports splitnets -ports
hierarchy -check hierarchy -check
read_verilog ../top.v read_verilog top.v
read_verilog ../top.v read_verilog top.v
hierarchy -top test hierarchy -top test
write_verilog -noexpr -norename result.out logger -expect warning "Module test contains unmapped RTLIL processes" 1
write_verilog -noexpr -norename
read_verilog ../top.v read_verilog top.v
synth -top top synth -top top
read_verilog -defer ../top.v read_verilog -defer top.v
chparam -set incr 42 topmod chparam -set incr 42 top
prep -flatten
sat -verify -prove-asserts -show-ports -set a[7:0] 1 -prove y[7:0] 43
read_verilog ../top.v read_verilog top.v
synth -top top prep -flatten
sat -verify -prove-asserts -show-ports -prove y a
read_verilog ../top.v read_verilog top.v
hierarchy -top task_bug hierarchy -top task_bug
proc; opt; memory; dff2dffe; wreduce; clean; opt proc
write_verilog -noexpr -norename result.out sat -verify -prove-asserts -show-ports -prove do in_data
read_verilog ../top.v read_verilog top.v
#equiv_opt -assert -map +/ice40/cells_sim.v synth_ice40 # equivalency check #equiv_opt -assert -map +/ice40/cells_sim.v synth_ice40 # equivalency check
equiv_opt -map +/ice40/cells_sim.v synth_ice40 # equivalency check equiv_opt -map +/ice40/cells_sim.v synth_ice40 # equivalency check
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design) design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
......
read_verilog ../top.v read_verilog top.v
proc; opt; fsm; opt; memory; opt; techmap; opt proc; opt; fsm; opt; memory; opt; techmap; opt
scc -all_cell_types scc -all_cell_types
#and then put each found SCC into a module using submod. #and then put each found SCC into a module using submod.
......
read_verilog ../top.v read_verilog top.v
proc proc
sat -verify -prove-asserts -show-ports -prove co bi
#TODO: check if we should take care of order or not
\ No newline at end of file
read_verilog ../top.v read_verilog top.v
hierarchy -top top hierarchy -top top
write_verilog -noattr t1.v
proc proc
opt -full opt -full
techmap techmap
......
read_verilog ../top.v read_verilog top.v
hierarchy hierarchy
proc proc
opt opt
......
read_verilog ../top.v read_verilog top.v
synth_ice40 -blif litescope.bli -top top synth_ice40 -top top
read_verilog ../top.v read_verilog top.v
synth_ice40 -top top -blif test.blif synth_ice40 -top top
assign _07_\[0\] = adr\[0\] ? \\ram\[3\] \[0\] : \\ram\[2\] \[0\];
assign _07_\[1\] = adr\[0\] ? \\ram\[3\] \[1\] : \\ram\[2\] \[1\];
read_verilog -DTEST_1 ../top.v read_verilog -DTEST_1 top.v
hierarchy -top top hierarchy -top top
proc; memory proc; memory
opt -full opt -full
techmap synth
write_verilog -noattr result.out
rename -top gold
design -save gold
design -reset
read_verilog -DTEST_2 top.v
hierarchy -top top
proc; memory
opt -full
synth
rename -top gate
design -copy-from gold gold
equiv_make gold gate equiv
equiv_induct
equiv_status -assert equiv
\ No newline at end of file
read_verilog ../top.v read_verilog top.v
proc proc
prep -flatten prep -flatten
sat -verify -prove-asserts -show-ports -prove y a
read_verilog ../top.v read_verilog top.v
synth -top top synth -top top
write_verilog synth.v sat -verify -prove-asserts -show-ports -prove b 123456
module testbench;
reg clk;
initial begin
// $dumpfile("testbench.vcd");
// $dumpvars(0, testbench);
#0 clk = 0;
repeat (10000) begin
#5 clk = 1;
#5 clk = 0;
end
$display("OKAY");
end
top uut (
.b (clk )
);
endmodule
module top(b); module top(output [17:0] b);
input b;
wire a = 100_000.0; wire a = 100_000.0;
assign b = 123_456.0;
endmodule endmodule
logger -expect error "Found posedge/negedge event on a signal that is not 1 bit wide!" 1
read_verilog top.v
ERROR: Found posedge/negedge event on a signal that is not 1 bit wide!
read_verilog ../top.v
synth_greenpak4 -json 3pdrive.json
read_verilog ../top.v read_verilog top.v
sat -verify -prove-asserts -show-ports -set-any-undef 0 -prove result 2
read_verilog ../top.v read_verilog top.v
synth -top top synth -top top
#synth_ice40 -top top #synth_ice40 -top top
# Next will fail if synth_ice40 is executed
select -assert-count 1 t:$_DFF_P_ select -assert-count 1 t:$_DFF_P_
read_verilog ../top.v read_verilog top.v
module top module top(input clk, enable, output reg y);
#(parameter WIDTH = 64, C_WIDTH = 8, DE = 4)
(
input clk,
input reset,
input [C_WIDTH*WIDTH-1:0] c_data_in_port,
input [DE*C_WIDTH -1:0] d_one_hot,
input [C_WIDTH -1:0] c_data_in_en,
output reg [DE*WIDTH-1:0] d_data_out_port, wire [1:0] foo [1:0];
output reg [DE-1:0] d_data_out_en integer i;
);
reg [ WIDTH-1:0] clients_data_in [ C_WIDTH-1:0]; always @(posedge clk)
reg [ C_WIDTH-1:0] devices_one_hot_client_sel [ DE-1:0]; if (enable)
reg [ WIDTH-1:0] devices_data_out [ DE-1:0]; for (i = 0; i < 2; i=i+1)
y <= foo[0][0];
reg [ WIDTH-1:0] clients_data_in_s [ C_WIDTH-1:0];
reg [ C_WIDTH-1:0] devices_one_hot_client_sel_s [ DE-1:0];
wire [ WIDTH-1:0] devices_data_out_p [ DE-1:0];
wire [ C_WIDTH-1:0] clients_data_rotate [ WIDTH-1:0];
wire [ DE-1:0] devices_data_rotate [ WIDTH-1:0];
reg [ DE-1:0] clients_one_hot_device_sel [ C_WIDTH-1:0];
wire [ DE-1:0] dev_en;
wire [ DE-1:0] data_out_en;
integer client, device;
always @*
begin
for(client = 0; client < C_WIDTH; client = client + 1) begin
clients_data_in[client] = c_data_in_port[client*WIDTH+:WIDTH];
end
end
always @*
begin
for(client = 0; client < C_WIDTH; client = client + 1) begin
clients_one_hot_device_sel[client] = d_one_hot[client*DE+:DE];
end
end
always @*
begin
for (device = 0; device < DE; device = device + 1) begin
for(client = 0; client < C_WIDTH; client = client + 1) begin
devices_one_hot_client_sel[device][client] = clients_one_hot_device_sel[client][device];
end
end
end
genvar k;
integer rowsel;
genvar i, j, nw;
always @(posedge clk or negedge reset)
if (!reset)
for (rowsel = 0; rowsel < DE; rowsel=rowsel+1)
devices_data_out[rowsel][WIDTH-1:1] <= 'b0;
else begin
for (rowsel = 0; rowsel < DE; rowsel=rowsel+1)
if (dev_en[rowsel]==1'b1)
devices_data_out[rowsel][WIDTH-1:1] <= devices_data_out_p[rowsel][WIDTH-1:1];
end
always @(posedge clk or negedge reset)
if (!reset)
for (rowsel = 0; rowsel < DE; rowsel=rowsel+1)
devices_data_out[rowsel][0] <= 1'b0;
else
for (rowsel = 0; rowsel < DE; rowsel=rowsel+1)
devices_data_out[rowsel][0] <= devices_data_out_p[rowsel][0];
always @*
begin
for(rowsel = 0; rowsel < C_WIDTH; rowsel=rowsel+1) begin
clients_data_in_s[rowsel][WIDTH-1:0] = clients_data_in[rowsel];
end
end
always @*
begin
for(rowsel = 0; rowsel < DE; rowsel=rowsel+1) begin
devices_one_hot_client_sel_s[rowsel][C_WIDTH-1:0] = devices_one_hot_client_sel[rowsel][C_WIDTH-1:0];
end
end
generate
for (i = 0; i < DE; i=i+1) begin:gen_i3
assign dev_en[i] = |devices_one_hot_client_sel_s[i][C_WIDTH-1:0];
end
endgenerate
generate
for (i = 0; i < DE; i=i+1) begin:gen_i4
assign data_out_en[i] = |devices_one_hot_client_sel[i][C_WIDTH-1:0];
end
endgenerate
always @(posedge clk or negedge reset)
if (!reset)
for (rowsel = 0; rowsel < DE; rowsel=rowsel+1)
d_data_out_en[rowsel] <= 1'b0;
else
for (rowsel = 0; rowsel < DE; rowsel=rowsel+1)
d_data_out_en[rowsel] <= data_out_en[rowsel];
generate
for (i = 0; i < C_WIDTH; i=i+1) begin:gen_i
for (j = 0; j < WIDTH; j=j+1) begin:gen_j
assign clients_data_rotate[j][i] = clients_data_in_s[i][j];
end
end
endgenerate
generate
for (nw = 0; nw < WIDTH; nw=nw+1) begin : gen_nw
for (i = 0; i < DE; i=i+1) begin:gen_label
assign devices_data_rotate[nw][i] = |(clients_data_rotate[nw] & devices_one_hot_client_sel_s[i]);
end
end
endgenerate
generate
for (i = 0; i < WIDTH; i=i+1) begin:gen_i2
for (j = 0; j < DE; j=j+1) begin:gen_j2
assign devices_data_out_p[j][i] = devices_data_rotate[i][j];
end
end
endgenerate
always @*
begin
for (device = 0; device < DE; device = device + 1) begin
d_data_out_port[device*WIDTH+:WIDTH] = devices_data_out[device];
end
end
endmodule endmodule
tee -o result.out read_verilog -sv ../top.v logger -werror "is implicitly declared at"
read_verilog -sv top.v
read_verilog -sv ../top.v read_verilog -sv top.v
read_verilog -sv ../top.v read_verilog -sv top.v
synth -top top synth -top top
read_verilog ../top.v read_verilog top.v
proc proc
opt opt
...@@ -7,9 +7,9 @@ dump ...@@ -7,9 +7,9 @@ dump
write_ilang foo.ilang write_ilang foo.ilang
memory_collect memory_collect
stat stat
#dump t:$mem
design -reset design -reset
read_ilang foo.ilang read_ilang foo.ilang
stat stat
memory_collect memory_collect
tee -o result.out dump t:$mem select -assert-count 1 r:OFFSET=0
!rm foo.ilang
\ No newline at end of file
read_verilog ../top.v read_verilog top.v
synth
proc
opt -full
read_verilog ../top.v read_verilog top.v
synth -top top synth -top top
read_verilog ../top.v read_verilog top.v
read_verilog ../top.v read_verilog top.v
equiv_make gold top_w equiv equiv_make gold top_w equiv
hierarchy -top equiv hierarchy -top equiv
opt -purge opt -purge
......
read_verilog -sv ../top.v read_verilog -sv top.v
read_verilog -sv ../top.v read_verilog -sv top.v
read_verilog -sv ../top.v read_verilog top.v
synth synth
abc -dff -g AND abc -clk clk -g AND
opt opt_clean
write_aiger -ascii -symbols <file.out> select -assert-count 2 a:init
design -reset
read_aiger <file.out>
write_verilog result.out
module test module demo (input clk, input i, output o);
( input clk reg q = 0;
, input in always @(posedge clk) q <= 1;
, output out assign o = q & i;
); endmodule
\ No newline at end of file
reg [1:0] state = 0;
always @(posedge clk)
case (state)
0:
if (!in || in)
state <= 1;
else
state <= state;
1:
if (in)
state <= 1;
else
if (!in)
state <= 1;
else
state <= state;
endcase
always @(*)
case (state)
0:
out = 0;
1:
begin
if (in)
out = 1;
if (!in)
out = 0;
end
endcase
endmodule
read_verilog -sv ../top.v read_verilog -sv top.v
prep prep
alumacc alumacc
select -assert-count 63 t:$add
select -assert-count 2 t:$macc select -assert-count 2 t:$macc
select -assert-count 65 t:$mul
read_verilog -sv top.v
logger -expect error "Output port top.inst.b \(inst\) is connected to constants: 1'1" 1
synth -top top
ERROR: Output port top.inst.b (inst) is connected to constants: 1'1
read_verilog -sv ../top.v
synth -top top
read_verilog -sv ../top.v read_verilog -sv top.v
synth -top top synth -top top
select -assert-count 1 t:$_DFF_P_ select -assert-count 1 t:$_DFF_P_
read_verilog -sv ../top.v read_verilog -sv top.v
write_verilog result.v write_verilog result.v
select -assert-count 1 t:$shiftx
design -reset design -reset
read_verilog result.v read_verilog result.v
hierarchy -check hierarchy -check
select -assert-count 1 t:$shiftx
!rm result.v
\ No newline at end of file
read_verilog -formal ../top.v read_verilog -formal top.v
prep -top top prep -top top
read_verilog -formal ../top.v read_verilog -formal top.v
synth -top top synth -top top
read_verilog -formal ../top.v read_verilog -formal top.v
synth -top top synth -top top
read_verilog ../top.v read_verilog top.v
synth_ice40 -blif tlt.blif synth_ice40
read_verilog ../top.v read_verilog top.v
select -assert-any n:\\SUM/N10 select -assert-any n:\\SUM/N10
read_verilog ../top.v read_verilog top.v
synth_greenpak4 -part SLG46621V synth_greenpak4 -part SLG46621V
select -assert-count 1 t:GP_INV select -assert-count 1 t:GP_INV
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#yosys -import #yosys -import
#set libfile osu018_stdcells_edit.lib #set libfile osu018_stdcells_edit.lib
read_verilog -sv ../sd_rrmux.v read_verilog -sv sd_rrmux.v
# Vanilla synth flow # Vanilla synth flow
hierarchy hierarchy
...@@ -13,9 +13,9 @@ opt ...@@ -13,9 +13,9 @@ opt
techmap techmap
opt opt
dfflibmap -liberty ../osu018_stdcells_edit.lib dfflibmap -liberty osu018_stdcells_edit.lib
abc -liberty ../osu018_stdcells_edit.lib abc -liberty osu018_stdcells_edit.lib
clean clean
......
read_verilog ../top.v read_verilog top.v
synth_ice40 -nocarry synth_ice40 -nocarry
opt_clean opt_clean
write_blif -attr -cname -param lut.eblif select -assert-count 1 t:SB_LUT4
logger -expect error "Failed to detect width for identifier \\valid!" 1
read_verilog top.v
synth_ice40 -top main
ERROR: Failed to detect width for identifier \\valid!
read_verilog ../top.v
synth_ice40 -top main -blif stencil.blif
read_verilog -lib +/ice40/cells_sim.v read_verilog -lib +/ice40/cells_sim.v
read_verilog ../top.v read_verilog top.v
hierarchy -top main hierarchy -top main
proc proc
flatten flatten
......
logger -expect error "Single range expected." 1
read_verilog top.v
logger -expect error "syntax error, unexpected ',', expecting '='" 1
read_verilog top.v
read_verilog ../top.v read_verilog top.v
tribuf -logic tribuf -logic
synth -top bidirtest synth -top bidirtest
iopadmap -bits -inpad IBUF O:PAD -outpad OBUF I:PAD -tinoutpad IOBUF ENA:O:I:PAD bidirtest iopadmap -bits -inpad IBUF O:PAD -outpad OBUF I:PAD -tinoutpad IOBUF ENA:O:I:PAD bidirtest
......
read_verilog ../top.v read_verilog top.v
hierarchy hierarchy
proc -global_arst reset proc -global_arst reset
flatten; techmap flatten; techmap
ice40_opt ice40_opt
#-unlut
opt_clean opt_clean
abc -script +strash abc -script +strash
#ifraig
#scorr
#retime
#strash
clean clean
#write_blif
select -assert-count 16 t:SB_LUT4 select -assert-count 16 t:SB_LUT4
read_verilog ../top.v read_verilog top.v
hierarchy hierarchy
tee -o result.out synth_ice40 -blif demo.blif logger -expect-no-warnings
synth_ice40
Warning: wire '$func$\func$demo.v:8$2$\arg' is assigned in a block at demo.v:4.
module dff(
input clk,
input rstn,
input en,
input d,
output logic q
);
always @(posedge clk or negedge rstn)
begin
if(!rstn)
q <= 0;
else
begin
if(en)
q <= d;
else
q <= q; //prevents the creation of latches
end
end
endmodule
read_verilog -sv dff.sv
read_verilog -sv register.sv
synth
select -assert-count 4 t:dff
module top
module register #(
XLEN = 4
)
( (
input clk, input clk,
input rstn, input rstn,
...@@ -6,4 +9,14 @@ module top ...@@ -6,4 +9,14 @@ module top
input [XLEN-1:0] d, input [XLEN-1:0] d,
output [XLEN-1:0] q output [XLEN-1:0] q
); );
parameter XLEN = 4;
genvar i;
generate
for(i = 0; i < XLEN; i++)
begin: r
dff r(.clk(clk), .rstn(rstn), .en(en), .d(d[i]), .q(q[i]));
end
endgenerate
endmodule
read_verilog -ignore_redef -nooverwrite ../top.v read_verilog -ignore_redef -nooverwrite top.v
hierarchy -check -top top hierarchy -check -top top
rename top netlist_v1 rename top netlist_v1
hierarchy -check -top netlist_v1 hierarchy -check -top netlist_v1
...@@ -6,7 +6,7 @@ prep ...@@ -6,7 +6,7 @@ prep
splitnets -ports splitnets -ports
design -save netlist_v1 design -save netlist_v1
read_verilog -ignore_redef -overwrite ../top_new.v read_verilog -ignore_redef -overwrite top_new.v
hierarchy -check -top top hierarchy -check -top top
rename top netlist_v2 rename top netlist_v2
hierarchy -check -top netlist_v2 hierarchy -check -top netlist_v2
...@@ -20,5 +20,6 @@ design -copy-from netlist_v2 -as netlist_new netlist_v2 ...@@ -20,5 +20,6 @@ design -copy-from netlist_v2 -as netlist_new netlist_v2
equiv_make -inames netlist_old netlist_new miter_netlist equiv_make -inames netlist_old netlist_new miter_netlist
equiv_simple -undef -seq 10 equiv_simple -undef -seq 10
equiv_induct -undef -seq 10 equiv_induct -undef -seq 10
tee -o result.log equiv_status -assert
logger -expect error "Found 3 unproven \$equiv cells in 'equiv_status -assert'." 1
equiv_status -assert
ERROR: Found 3 unproven \$equiv cells in 'equiv_status -assert'.
read_verilog -formal ../top.v read_verilog -formal top.v
tee -o result.log read_verilog -formal ../top.v read_verilog -formal top.v
synth -top top hierarchy; proc; opt
write_verilog synth.v sat -verify -prove-asserts -tempinduct
read_verilog ../top.v read_verilog top.v
read_verilog ../top.v; rename -top gold; read_verilog top.v; rename -top gold;
design -stash gold; design -stash gold;
read_verilog ../top.v; read_verilog top.v;
rename -top gate; design -stash gate; rename -top gate; design -stash gate;
design -copy-from gold -as gold gold; design -copy-from gold -as gold gold;
design -copy-from gate -as gate gate; design -copy-from gate -as gate gate;
......
read_liberty ../lib.lib read_liberty lib.lib
tee -o result.log read_verilog -sv ../top.v read_verilog -sv top.v
synth -top top synth -top top
sat -verify -prove-asserts -tempinduct
read_verilog -sv ../top.v read_verilog -sv top.v
tee -o result.out read_verilog ../top.v read_verilog top.v
sat -verify -prove-asserts -show-ports -prove a 0
module top; module top;
`define MAX(_a, _b) ((_a) > (_b) ? (_a) : (_b)) `define MAX(_a, _b) ((_a) > (_b) ? (_a) : (_b))
localparam integer X = `MAX($clog2(1 << 17) - 18, 0); localparam integer X = `MAX($clog2(1 << 17) - 18, 0);
initial $display("X = %d", X); wire a = X;
endmodule endmodule
tee -o result.out read_verilog -dump_ast1 ../top.v read_verilog top.v
select -assert-count 1 a:A
select -assert-count 1 a:B
logger -expect error "Invalid nesting of always blocks and/or initializations." 1
read_verilog top.v
ERROR: Invalid nesting of always blocks and/or initializations.
read_verilog ../yosys_rocket/AsyncResetReg.v ../yosys_rocket/EICG_wrapper.v ../yosys_rocket/freechips.rocketchip.system.LowRiscConfig.v ../yosys_rocket/freechips.rocketchip.system.LowRiscConfig.behav_srams.v ../yosys_rocket/plusarg_reader.v ../yosys_rocket/SimDTM.v read_verilog yosys_rocket/AsyncResetReg.v yosys_rocket/EICG_wrapper.v yosys_rocket/freechips.rocketchip.system.LowRiscConfig.v yosys_rocket/freechips.rocketchip.system.LowRiscConfig.behav_srams.v yosys_rocket/plusarg_reader.v yosys_rocket/SimDTM.v
synth_ecp5 -blif foo.blif synth_ecp5
read_verilog ../top.v read_verilog top.v
synth_ice40 -blif test.blif synth_ice40
read_verilog ../top.v read_verilog top.v
synth_ice40 synth_ice40
...@@ -8,7 +8,7 @@ module f16_prom ( ...@@ -8,7 +8,7 @@ module f16_prom (
reg [15:0] do; reg [15:0] do;
initial initial
$readmemh("../bootrom.hex", rom); $readmemh("bootrom.hex", rom);
always @(posedge clk) always @(posedge clk)
do <= rom[addr[3:0]]; do <= rom[addr[3:0]];
......
read -formal ../top.v read -formal top.v
prep -top mcve prep -top mcve
select -assert-count 5 t:$assert sat -verify -prove-asserts -tempinduct
read_verilog ../top.v read_verilog top.v
synth -top top synth -top top
read_verilog ../top.v
hierarchy -check -top top
proc; opt; memory; opt; fsm; opt; techmap; opt
abc
opt_clean
write_verilog result.out
wire _12_;
wire _13_;
wire _14_;
wire _15_;
wire _16_;
wire _17_;
wire _18_;
wire _19_;
wire _20_;
wire _21_;
wire _22_;
wire _23_;
wire _24_;
module top(C, O, A, B);
input [3:0] A;
input [3:0] B;
output [3:0] O;
output C;
assign {C, O} = A + B;
endmodule
# running in master_axi/src/ # running in master_axi/src/
read_verilog -formal ../src/faxi_master.v read_verilog -formal src/faxi_master.v
read_verilog -formal ../src/pulse_to_level.v read_verilog -formal src/pulse_to_level.v
read_verilog -formal ../src/posedge_pulse_generator.v read_verilog -formal src/posedge_pulse_generator.v
read_verilog -formal ../src/Delay_Line.v read_verilog -formal src/Delay_Line.v
read_verilog -formal ../src/Annuller.v read_verilog -formal src/Annuller.v
read_verilog -formal ../src/Down_Counter_Zero.v read_verilog -formal src/Down_Counter_Zero.v
read_verilog -formal ../src/Master_AXI_Address_Channel.v read_verilog -formal src/Master_AXI_Address_Channel.v
read_verilog -formal ../src/Master_AXI_Read_Data_Channel.v read_verilog -formal src/Master_AXI_Read_Data_Channel.v
read_verilog -formal ../src/Master_AXI_Read_Sequencer.v read_verilog -formal src/Master_AXI_Read_Sequencer.v
read_verilog -formal ../src/Master_AXI_Transactor.v read_verilog -formal src/Master_AXI_Transactor.v
read_verilog -formal ../src/Master_AXI_Write_Data_Channel.v read_verilog -formal src/Master_AXI_Write_Data_Channel.v
read_verilog -formal ../src/Master_AXI_Write_Response_Channel.v read_verilog -formal src/Master_AXI_Write_Response_Channel.v
read_verilog -formal ../src/Master_AXI_Write_Sequencer.v read_verilog -formal src/Master_AXI_Write_Sequencer.v
read_verilog -formal ../src/skid_buffer_datapath.v read_verilog -formal src/skid_buffer_datapath.v
read_verilog -formal ../src/skid_buffer_fsm.v read_verilog -formal src/skid_buffer_fsm.v
read_verilog -formal ../src/skid_buffer.v read_verilog -formal src/skid_buffer.v
prep -top Master_AXI_Transactor prep -top Master_AXI_Transactor
memory_nordff memory_nordff
...@@ -26,4 +26,5 @@ setundef -anyseq ...@@ -26,4 +26,5 @@ setundef -anyseq
opt -keepdc -fast opt -keepdc -fast
check check
hierarchy -simcheck hierarchy -simcheck
tee -o result.log write_ilang design.il write_ilang design.il
!rm design.il
logger -expect error "UNDEFINED' is implicitly declared and" 1
read_verilog -formal top.v
tee -o result.out read_verilog -formal ../top.v
read_ilang ../t2.ilang read_ilang t2.ilang
synth -run coarse synth -run coarse
read_verilog ../top.v read_verilog top.v
synth synth
read_verilog ../top.v logger -expect warning "Replacing memory \\counters with list of registers." 1
read_verilog top.v
prep prep
select -assert-count 4 t:$dff select -assert-count 4 t:$dff
read_verilog ../top.v read_verilog top.v
synth -top top synth -top top
select -assert-count 1 t:$_DFF_P_ select -assert-count 1 t:$_DFF_P_
select -assert-none t:$_DFF_P_ %% t:* %D select -assert-none t:$_DFF_P_ %% t:* %D
read_verilog -sv ../top.v read_verilog -sv top.v
read_verilog ../top.v read_verilog top.v
write_verilog temp.v write_verilog temp.v
proc proc
opt opt
...@@ -8,3 +8,4 @@ memory ...@@ -8,3 +8,4 @@ memory
opt opt
synth_xilinx -top tc synth_xilinx -top tc
select -assert-count 12 t:FDRE select -assert-count 12 t:FDRE
!rm temp.v
read_verilog ../top.v read_verilog top.v
synth_xilinx -flatten synth_xilinx -flatten
select -assert-count 1 t:RAMB36E1 select -assert-count 1 t:RAMB36E1
read_verilog ../top.v read_verilog top.v
hierarchy -auto-top -check; hierarchy -auto-top -check;
proc; clean; proc; clean;
memory; memory;
...@@ -11,3 +11,5 @@ write_verilog multimux_out_2.v ...@@ -11,3 +11,5 @@ write_verilog multimux_out_2.v
delete; delete;
read_verilog multimux_out_2.v read_verilog multimux_out_2.v
!rm multimux_out_1.v
!rm multimux_out_2.v
\ No newline at end of file
read_verilog ../top.v read_verilog top.v
logger -werror "neg_clk=1.q has an unprocessed"
synth_xilinx synth_xilinx
flatten
stat
select -assert-count 1 t:BUFG
select -assert-count 1 t:FDRE
select -assert-count 1 t:FDRE_1
read_verilog -DBROKEN ../top.v read_verilog top.v
synth_xilinx synth_xilinx
select -assert-count 4 t:FDRE select -assert-count 2 t:FDRE
module top (CLK, CE, SEL, SI, DO); module top (input clk, sel, di, output do);
parameter SELWIDTH = 1; reg [0:1] data [0:0];
parameter DATAWIDTH = 2; always @(posedge clk)
input CLK, CE; data[0] <= {di, data[0][0]};
input [DATAWIDTH-1:0] SI; assign do = data[0][sel];
input [SELWIDTH-1:0] SEL; endmodule
output [DATAWIDTH-1:0] DO; \ No newline at end of file
localparam DATADEPTH = 2**SELWIDTH;
reg [0:DATADEPTH-1] data1 [DATAWIDTH-1:0];
reg [DATADEPTH-1:0] data2 [DATAWIDTH-1:0];
generate
genvar i;
for (i = 0; i < DATAWIDTH; i=i+1) begin
always @(posedge CLK)
begin
if (CE == 1'b1) begin
`ifdef BROKEN
data1[i] <= {SI[i], data1[i][0:DATADEPTH-2]};
`else
data2[i] <= {data2[i][DATADEPTH-2:0], SI[i]};
`endif
end
end
`ifdef BROKEN
assign DO[i] = data1[i][SEL];
`else
assign DO[i] = data2[i][SEL];
`endif
end
endgenerate
endmodule
read_verilog ../outreg.v read_verilog outreg.v
hierarchy -top dut hierarchy -top dut
proc proc
memory -nomap memory -nomap
......
read_verilog ../top.v read_verilog top.v
proc proc
memory_dff -nordff memory_dff -nordff
memory_collect memory_collect
opt_reduce opt_reduce
clean clean
write_firrtl firrtl.firrtl write_firrtl out.firrtl
!rm out.firrtl
\ No newline at end of file
read_verilog ../top.v read_verilog top.v
prep prep
select -assert-none t:$dlatch select -assert-none t:$dlatch
read_verilog ../top.v read_verilog top.v
prep -top picorv32 -nordff prep -top picorv32 -nordff
opt -fast opt -fast
write_smt2 picorv32.smt2 write_smt2 picorv32.smt2
!rm picorv32.smt2
read_verilog ../top.v read_verilog top.v
proc proc
memory_dff -nordff memory_dff -nordff
opt_reduce opt_reduce
clean clean
write_firrtl firrtl.firrtl write_firrtl out.firrtl
!rm out.firrtl
...@@ -6636,7 +6636,7 @@ module TopEntity ...@@ -6636,7 +6636,7 @@ module TopEntity
reg [14:0] RAM [0:256-1]; reg [14:0] RAM [0:256-1];
initial begin initial begin
$readmemb("../SinusTableInit.txt",RAM); $readmemb("SinusTableInit.txt",RAM);
end end
always @(posedge \$d(%,%) [1:1]) begin : TopEntity_blockRamFile always @(posedge \$d(%,%) [1:1]) begin : TopEntity_blockRamFile
...@@ -6661,7 +6661,7 @@ module TopEntity ...@@ -6661,7 +6661,7 @@ module TopEntity
reg [14:0] RAM_0 [0:256-1]; reg [14:0] RAM_0 [0:256-1];
initial begin initial begin
$readmemb("../SinusTableInit_.txt",RAM_0); $readmemb("SinusTableInit_.txt",RAM_0);
end end
always @(posedge \$d(%,%) [1:1]) begin : TopEntity_blockRamFile_0 always @(posedge \$d(%,%) [1:1]) begin : TopEntity_blockRamFile_0
...@@ -8334,7 +8334,7 @@ module TopEntity ...@@ -8334,7 +8334,7 @@ module TopEntity
reg [2:0] RAM_1 [0:1024-1]; reg [2:0] RAM_1 [0:1024-1];
initial begin initial begin
$readmemb("../LEDMatrixInitial.txt",RAM_1); $readmemb("LEDMatrixInitial.txt",RAM_1);
end end
always @(posedge \$d(%,%) [1:1]) begin : TopEntity_blockRamFile_1 always @(posedge \$d(%,%) [1:1]) begin : TopEntity_blockRamFile_1
......
read_verilog ../*.v read_verilog SuperTopEntity.v TopEntity.v
synth_ice40 -top SuperTopEntity -json TopEntity.json synth_ice40 -top SuperTopEntity
read_ilang ../bug.rtlil read_ilang bug.rtlil
synth synth
opt_expr opt_expr
write_verilog bug.v write_verilog bug.v
delete delete
read_verilog bug.v read_verilog bug.v
!rm bug.v
read_verilog ../top.v read_verilog top.v
synth synth
abc abc
logger -expect log "Eval result: \\out = 4'1000." 2
eval -set addr 24 eval -set addr 24
aigmap aigmap
tee -a result.out eval -set addr 24 eval -set addr 24
Eval result: \\out = 8'00001000.
read_verilog ../top.v read_verilog top.v
synth synth
tee -a result1.out eval -set addr 24 logger -expect log "Eval result: \\out = 8'00001000." 2
eval -set addr 24
abc abc
tee -a result.out eval -set addr 24 eval -set addr 24
read_verilog ../top.v read_verilog top.v
tee -a result.log synth_ice40 -top inivalue logger -expect-no-warnings
synth_ice40 -top inivalue
read_verilog ../top.v read_verilog top.v
proc proc
assign o_value = { 4'hx, i_value }
read -sv ../top.v read_verilog -sv top.v
hierarchy -top mcve1 hierarchy -top mcve1
synth synth
write_verilog result.out sat -verify -prove-asserts -enable_undef -show-ports -prove o_value[3:0] i_value -prove o_value[7:4] 4'bxxxx
read_verilog ../top.v read_verilog top.v
tee -a result.out synth_ice40 synth_ice40
read_verilog ../top.v read_verilog top.v
synth_xilinx synth_xilinx
select -assert-count 3 t:FDRE select -assert-count 3 r:INIT=1'0
tee -a result.out dump t:FDRE
read_verilog -sv ../top.v read_verilog -sv top.v
read -formal ../top.v read_verilog -formal top.v
hierarchy -top top hierarchy -top top
synth synth
#write_verilog rtl_yosys.v
read -formal ../top.v
hierarchy -top top
synth
write_verilog -noattr result.out
module top (y, clk, wire4);
output wire [1:0] y;
input clk;
input signed wire4;
reg [1:0] reg10 = 0;
always @(posedge clk) begin
reg10 <= wire4;
end
assign y = reg10;
endmodule
read_verilog ../top.v read_verilog top.v
synth synth
read_verilog -sv ../top.v read_verilog -sv top.v
proc proc
wreduce -keepdc wreduce -keepdc
select -assert-count 1 t:$mux select -assert-count 1 t:$mux
read_verilog -sv ../top.v read_verilog -sv top.v
tee -a result.log dump synth -top test
sat -verify -prove-asserts -show-ports -prove b 32'hffffffff
read_verilog -icells ../top.v read_verilog -icells top.v
techmap techmap
read_verilog ../top.v read_verilog top.v
synth_xilinx synth_xilinx
select -assert-none t:RAM64X1D select -assert-none t:RAM64X1D
read_verilog -DUNPACKED ../top.v read_verilog -DUNPACKED top.v
synth_xilinx -nodram synth_xilinx -nodram
select -assert-none t:FDRE select -assert-none t:FDRE
read -formal ../top.v read -formal top.v
hierarchy -top top hierarchy -top top
synth synth
select -assert-count 1 t:$_NOR_ sat -verify -prove-asserts -show-ports -set w 3'b100 -prove y 1'b1
select -assert-none t:$_NOR_ %% t:* %D \ No newline at end of file
read_verilog ../top.v read_verilog top.v
proc proc
logger -expect error "Gate cell u_mid8 not found in module top." 1
fmcombine top u_mid1 u_mid8 fmcombine top u_mid1 u_mid8
ERROR: Gate cell u_mid8 not found in module top.
read_verilog ../top.v read_verilog top.v
proc proc
tee -o result.out opt -fast logger -werror "Driver-driver conflict"
opt -fast
Warning: Driver-driver conflict for \\q between cell u.i and constant 1'0 in top: Resolved using constant.
read_verilog ../top.v read_verilog top.v
proc proc
dff2dffe dff2dffe
simplemap simplemap
......
read_verilog ../top.v read_verilog top.v
read_verilog ../top.v read_verilog top.v
proc proc
opt opt
techmap techmap
......
read_verilog ../top.v read_verilog top.v
logger -expect error "Design has no top module, use the 'hierarchy' command to specify one." 1
proc proc
sim sim
ERROR: Design has no top module, use the 'hierarchy' command to specify one.
connect \\\o 33'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
read_verilog ../top.v read_verilog -sv top.v
proc proc
tee -o result.out dump sat -verify -prove-asserts -show-ports -enable_undef -prove o 33'bxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
\ No newline at end of file
read_verilog ../top.v read_verilog top.v
read_verilog ../top.v read_verilog top.v
insbuf insbuf
# select just the $_BUF_ from w1 to w2 as @buf # select just the $_BUF_ from w1 to w2 as @buf
select -set buf w:w1 %coe1 w:w1 %d select -set buf w:w1 %coe1 w:w1 %d
......
logger -expect error "syntax error" 1
read_verilog top.v
read_verilog ../top.v read_verilog top.v
proc; opt; wreduce; simplemap; muxcover -mux4=150 proc; opt; wreduce; simplemap; muxcover -mux4=150
select -assert-count 1 t:$_MUX4_ select -assert-count 1 t:$_MUX4_
read_verilog ../top.v read_verilog top.v
proc; pmux2shiftx -norange; opt -full proc; pmux2shiftx -norange; opt -full
select -assert-count 1 t:$pmux select -assert-count 1 t:$pmux
select -assert-count 3 t:$eq select -assert-count 3 t:$eq
read_verilog -specify top.v
read_verilog -sv ../top.sv read_verilog -sv top.sv
hierarchy -check -top TopModule hierarchy -check -top TopModule
proc proc
flatten flatten
read_verilog -sv ../top.v read_verilog -sv top.v
logger -expect error "Latch inferred for signal" 1
proc proc
select -assert-count 0 t:$dlatch
read_ilang ../top.il read_ilang top.il
proc_init proc_init
read_verilog ../top.v read_verilog top.v
synth_ice40 -top top synth_ice40 -top top
write_blif test.blif
module top (hz100, pb, ss7, ss6, ss5, ss4, ss3, ss2, ss1, ss0, left, right, red, green, blue); // Empty top module
input hz100;
input [20:0] pb;
output [7:0] ss7;
output [7:0] ss6;
output [7:0] ss5;
output [7:0] ss4;
output [7:0] ss3;
output [7:0] ss2;
output [7:0] ss1;
output [7:0] ss0;
output [7:0] left;
output [7:0] right;
output red;
output green;
output blue;
reg [4:0] op;
reg [31:0] save;
reg [31:0] entry;
reg [31:0] nextresult;
wire [31:0] source = displaysave ? save : entry; module top (hz100, reset, pb, ss7, ss6, ss5, ss4, ss3, ss2, ss1, ss0, left, right, red, green, blue);
assign {left,right} = source[15:0]; input hz100, reset;
input [20:0] pb;
wire [4:0] key; output [7:0] ss7, ss6, ss5, ss4, ss3, ss2, ss1, ss0, left, right;
wire pressed; output red, green, blue;
scankey sk(.clk(hz100), .strobe(pressed), .out(key), .in(pb));
always @ (posedge pressed)
begin
casez (key)
5'b0????: begin
entry <= {28'b0,key[3:0]};
end
5'b1????: begin
save <= nextresult;
op <= key;
end
endcase reg [31:0] entry; // value being entered
end reg [31:0] saved; // saved value to use as a second operand
reg [4:0] op; // the selected operation
reg displaysaved; // show entry or saved?
reg equalpressed; // has equal been pressed?
wire [4:0] key; // outkey of scankey module
wire pressed; // strobe of scankey module
always @(*) scankey sk(.clk(hz100), .reset(reset), .inkeys(pb), .strobe(pressed), .outkey(key));
/********************************************************************************/
// This is the mux that causes the same error
reg [31:0] nextresult;
always @(*) begin
case (op) case (op)
0: nextresult = entry; 0: nextresult <= entry;
default: nextresult = save; 19: nextresult <= saved + entry;
18: nextresult <= saved - entry;
default: nextresult <= saved;
endcase endcase
end
/********************************************************************************/
always @(posedge pressed, posedge reset)
begin
if (reset) begin
entry <= 0;
saved <= 0;
op <= 0;
displaysaved <= 0;
equalpressed <= 0;
end
else if (key == 5'b10001 && displaysaved == 0) begin
entry <= entry >> 4;
end
else if (key == 5'b10000) begin
saved <= nextresult;
displaysaved <= 1;
equalpressed <= 1;
end
else if (key[4] == 0) begin
if (equalpressed) begin
entry <= {28'b0,key[3:0]};
saved <= 0;
op <= 0;
displaysaved <= 0;
equalpressed <= 0;
end
else begin
if (entry[31:28] == 0)
entry <= entry << 4 | key;
displaysaved <= 0;
end
end
else if (key[4] && key[1]) begin
if (equalpressed == 0)
saved <= nextresult;
op <= key;
displaysaved <= 1;
entry <= 0;
equalpressed <= 0;
end
end
assign right = num [31:24];
wire [31:0] num = displaysaved ? saved : entry;
ssdec s7(.in(num[31:28]), .enable(1'b1), .out(ss7));
ssdec s6(.in(num[27:24]), .enable(1'b1), .out(ss6));
ssdec s5(.in(num[23:20]), .enable(1'b1), .out(ss5));
ssdec s4(.in(num[19:16]), .enable(1'b1), .out(ss4));
ssdec s3(.in(num[15:12]), .enable(1'b1), .out(ss3));
ssdec s2(.in(num[11:8]), .enable(1'b1), .out(ss2));
ssdec s1(.in(num[7:4]), .enable(1'b1), .out(ss1));
ssdec s0(.in(num[3:0]), .enable(1'b1), .out(ss0));
endmodule endmodule
module scankey(clk, in, out, strobe); // Add more modules down here...
input wire clk; module ssdec (in, enable, out);
output wire [4:0] out; input [3:0] in;
output wire strobe; input enable;
input wire [20:0] in; output [7:0] out;
wire active;
reg [4:0] highest; assign out = enable ? in == 4'hF ? 8'b01110001 :
in == 4'hE ? 8'b01111001 :
in == 4'hd ? 8'b01011110 :
in == 4'hC ? 8'b00111001 :
in == 4'hB ? 8'b01111100 :
in == 4'hA ? 8'b01110111 :
in == 4'h9 ? 8'b01101111 :
in == 4'h8 ? 8'b01111111 :
in == 4'h7 ? 8'b00000111 :
in == 4'h6 ? 8'b01111101 :
in == 4'h5 ? 8'b01101101 :
in == 4'h4 ? 8'b01100110 :
in == 4'h3 ? 8'b01001111 :
in == 4'h2 ? 8'b01011011 :
in == 4'h1 ? 8'b00000110 : 8'b00111111 : 8'b0;
endmodule
module scankey (clk, reset, inkeys, strobe, outkey);
input clk, reset;
input [19:0] inkeys;
output strobe;
output [4:0] outkey;
reg [1:0] delay; reg [1:0] delay;
always @(posedge clk) always @(posedge clk, posedge reset)
delay <= delay<<1 | active; if (reset)
assign strobe = delay[1]; delay <= 0;
else
delay <= delay << 1 | |inkeys;
assign {active,out} = in[20] == 1 ? 6'b110100 : assign strobe = delay[1];
in[19] == 1 ? 6'b110011 : assign outkey = inkeys [19] ? 5'd19 :
in[18] == 1 ? 6'b110010 : inkeys [18] ? 5'd18 :
in[17] == 1 ? 6'b110001 : inkeys [17] ? 5'd17 :
in[16] == 1 ? 6'b110000 : inkeys [16] ? 5'd16 :
in[15] == 1 ? 6'b101111 : inkeys [15] ? 5'd15 :
in[14] == 1 ? 6'b101110 : inkeys [14] ? 5'd14 :
in[13] == 1 ? 6'b101101 : inkeys [13] ? 5'd13 :
in[12] == 1 ? 6'b101100 : inkeys [12] ? 5'd12 :
in[11] == 1 ? 6'b101011 : inkeys [11] ? 5'd11 :
in[10] == 1 ? 6'b101010 : inkeys [10] ? 5'd10 :
in[ 9] == 1 ? 6'b101001 : inkeys [ 9] ? 5'd9 :
in[ 8] == 1 ? 6'b101000 : inkeys [ 8] ? 5'd8 :
in[ 7] == 1 ? 6'b100111 : inkeys [ 7] ? 5'd7 :
in[ 6] == 1 ? 6'b100110 : inkeys [ 6] ? 5'd6 :
in[ 5] == 1 ? 6'b100101 : inkeys [ 5] ? 5'd5 :
in[ 4] == 1 ? 6'b100100 : inkeys [ 4] ? 5'd4 :
in[ 3] == 1 ? 6'b100011 : inkeys [ 3] ? 5'd3 :
in[ 2] == 1 ? 6'b100010 : inkeys [ 2] ? 5'd2 :
in[ 1] == 1 ? 6'b100001 : inkeys [ 1] ? 5'd1 : 5'd0;
in[ 0] == 1 ? 6'b100000 : 6'b000000; endmodule
endmodule \ No newline at end of file
tee -o result.out read_verilog ../top.v logger -warn "is implicitly declared."
logger -nowarn "is assigned in a block at"
logger -expect-no-warnings
read_verilog top.v
read_verilog ../top.v read_verilog top.v
hierarchy -top top hierarchy -top top
proc proc
flatten flatten
read_verilog ../top.v read_verilog top.v
synth_xilinx synth_xilinx
read_verilog ../top.v read_verilog top.v
synth_xilinx synth_xilinx
select -assert-count 1 t:BUFT select -assert-count 1 t:IOBUF
read -formal ../top.v read -formal top.v
read_verilog ../top.v read_verilog top.v
synth synth
write_verilog -noattr result.out cd top
select -assert-none y reg_assign %a %d
read_verilog ../top.v read_verilog top.v
hierarchy -top top hierarchy -top top
write_smt2 write_smt2
read_verilog ../top.v read_verilog top.v
synth -top top synth -top top
muxcover -mux8 muxcover -mux8
select -assert-count 9 t:$_MUX8_ select -assert-count 9 t:$_MUX8_
read_verilog ../top.v read_verilog top.v
proc proc
synth -top top synth -top top
equiv_opt -assert extract_fa -ha -v equiv_opt -assert extract_fa -ha -v
......
// Design
// D flip-flop
// https://www.edaplayground.com/x/5dzJ
// If (asynchronous 'reset_sync' & enable') are true on the same clock,
// and then 'reset_sync' is low on the next clock,
// then the asynchronous 'reset_sync' gets ignored and the 'enable' applied
module dff (clk, reset, enable, d, q);
input clk;
input reset;
input enable;
input d;
output reg q;
always @(posedge clk or posedge reset_sync)
begin
if (reset_sync) begin
// Asynchronous reset when reset goes high
q <= 1'b0;
end
else if(enable)
begin
// Assign D to Q on positive clock edge
q <= d;
end
end
wire reset_sync;
synchronizer #(.RESET_STATE(1)) reset_synchronizer(
.clk(clk),
.reset(reset),
.data_i(0),
.data_o(reset_sync));
`ifdef FORMAL
always @($global_clock) assume(clk != $past(clk));
localparam MAX_CNT = 16;
reg[$clog2(MAX_CNT)-1:0] counter;
initial counter = 0;
always @(posedge clk) counter <= counter + 1;
initial assume(reset);
initial assume(enable);
always @(posedge clk) if(counter == (MAX_CNT >> 1)) assume(reset != $past(reset));
//always @(*) assume(d == 1'b1);
always @(clk)
begin
if(clk) assume(d == 1'b0);
else assume(d == 1'b1);
end
always @(clk)
begin
if(clk) assume(!enable);
else assume(enable);
end
always @(posedge clk)
begin
if(reset_sync) assert(q == 0);
else if(enable) assert(q == d);
else assert(q == $past(q));
end
always @(posedge clk) cover(reset && enable && d && !clk);
`endif
endmodule
# read design
read_verilog ../dff.v
read_verilog -sv ../synchronizer.sv
hierarchy -check
# high-level synthesis
proc; opt; fsm; opt; memory; opt
flatten
cd dff # Constrain all select calls below inside the top module
select -assert-count 4 t:$adff
select -assert-count 1 t:$mux
select -assert-none t:$adff t:$mux %% t:* %D
// https://github.com/jbush001/NyuziProcessor/blob/master/hardware/core/synchronizer.sv
//
// Copyright 2011-2015 Jeff Bush
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//
// Transfer a signal into a clock domain, avoiding metastability and
// race conditions due to propagation delay.
//
module synchronizer
#(parameter WIDTH = 1,
parameter RESET_STATE = 0)
(input clk,
input reset,
output logic[WIDTH - 1:0] data_o,
input [WIDTH - 1:0] data_i);
logic[WIDTH - 1:0] sync0;
logic[WIDTH - 1:0] sync1;
always_ff @(posedge clk, posedge reset)
begin
if (reset)
begin
sync0 <= {WIDTH{RESET_STATE}};
sync1 <= {WIDTH{RESET_STATE}};
data_o <= {WIDTH{RESET_STATE}};
end
else
begin
sync0 <= data_i;
sync1 <= sync0;
data_o <= sync1;
end
end
endmodule
\ No newline at end of file
read_verilog -sv ../top.v read_verilog -sv top.v
synth_ice40 -blif out.blif synth_ice40 -blif out.blif
!rm out.blif
read_verilog ../top.v read_verilog top.v
read -define BROKEN_CODE read_verilog top.v
read -formal ../top.v prep -top test
prep -top mcvesix equiv_opt -assert prep
tee -o result.log equiv_opt -assert prep # equivalency check
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
#cd mcvesix # Constrain all select calls below inside the top module
#select -assert-count 2 w:k s:32
//////////////////////////////////////////////////////////////////////////////// module test (output reg [3:0] out);
// integer k;
//////////////////////////////////////////////////////////////////////////////// initial begin
// out = 0;
`default_nettype none for(k=0; k<16; k=k+1)
// if (k[0]) out = out + 1;
module mcvesix(i_clk, i_bits, o_char); end
input wire i_clk; endmodule
input wire [6:0] i_bits; \ No newline at end of file
output reg [7:0] o_char;
reg [6:0] remap [0:127];
integer k, newv;
always @(*) begin
for(k=0; k<128; k=k+1)
begin
newv = 0;
// `define BROKEN_CODE
`ifdef BROKEN_CODE
if (k[6])
`else
if (k >= 64)
`endif
newv = 7'h0a;
else
newv = k;
remap[k] = newv;
end
end
initial o_char = 8'h00;
always @(posedge i_clk)
o_char <= { 1'b0, remap[i_bits] };
`ifdef FORMAL
reg [7:0] f_char;
//
// Here's the old encoding that "worked"
//
initial f_char = 8'h00;
always @(posedge i_clk)
begin
if (i_bits[6])
f_char <= 8'h0a;
else
f_char <= i_bits[6:0];
end
//
// Now let's prove that the two encodings are equivalent
always @(*)
assert(f_char == o_char);
`endif
endmodule
#!/bin/bash
#set -x
test -d $1
test -f $2.ys
rm -rf $1/work_$2
mkdir $1/work_$2
cd $1
touch work_$2/.start
if [[ $2 =~ "_fail" ]]; then
#4 - An error expected
if yosys -ql work_$2/yosys.log $2.ys; then
echo FAIL > work_$2/${2}.status
else
echo PASS > work_$2/${2}.status
fi
else
#2 - All asserts in .ys script
yosys -ql work_$2/yosys.log $2.ys
if [ $? != 0 ] ; then
echo FAIL > work_$2/${2}.status
else
echo PASS > work_$2/${2}.status
fi
fi
touch work_$2/.stamp
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment