3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-07-24 08:02:32 +00:00

Merge from upstream

This commit is contained in:
Akash Levy 2025-07-30 22:50:14 -07:00
commit cc733fd11b
63 changed files with 1139 additions and 132 deletions

View file

@ -1,2 +1,4 @@
*.log
*.out
*.err
run-test.mk

View file

@ -1,3 +1,2 @@
/*_ref.v
/*.log
/neg.out/

View file

@ -1,4 +1,2 @@
*.log
/run-test.mk
+*_synth.v
+*_testbench

View file

@ -1,2 +0,0 @@
*.log
/run-test.mk

View file

@ -1,3 +0,0 @@
/*.log
/*.out
/run-test.mk

View file

@ -1,4 +1,2 @@
*.log
/run-test.mk
+*_synth.v
+*_testbench

View file

@ -1,4 +1,2 @@
*.log
/run-test.mk
+*_synth.v
+*_testbench

View file

@ -1,3 +0,0 @@
/*.log
/*.out
/run-test.mk

View file

@ -1,5 +1,3 @@
*.log
*.json
/run-test.mk
+*_synth.v
+*_testbench

View file

@ -1,2 +0,0 @@
/*.log
/run-test.mk

View file

@ -1,2 +0,0 @@
*.log
/run-test.mk

View file

@ -1,4 +1,2 @@
*.log
/run-test.mk
*.vm

View file

@ -1,2 +0,0 @@
*.log
/run-test.mk

View file

@ -1,2 +0,0 @@
/*.log
/run-test.mk

View file

@ -1,4 +1,2 @@
*.log
run-test.mk
+*_synth.v
+*_testbench

View file

@ -1,5 +1,3 @@
/*.log
/*.out
/run-test.mk
/*_uut.v
/test_macc

View file

@ -1,2 +0,0 @@
*.log
*.out

View file

@ -1,2 +0,0 @@
*.log
run-test.mk

View file

@ -1 +0,0 @@
*.log

5
tests/bugpoint/.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
bugpoint-case.*
*.log
*.err
*.temp
run-test.mk

View file

@ -0,0 +1,29 @@
write_file fail.temp << EOF
logger -expect error "Missing -script or -command option." 1
bugpoint -suffix fail -yosys ../../yosys
EOF
exec -expect-return 0 -- ../../yosys -qq mods.il -s fail.temp
write_file fail.temp << EOF
logger -expect error "do not crash on this design" 1
bugpoint -suffix fail -yosys ../../yosys -command "dump"
EOF
exec -expect-return 0 -- ../../yosys -qq mods.il -s fail.temp
write_file fail.temp << EOF
logger -expect error "returned value 3 instead of expected 7" 1
bugpoint -suffix fail -yosys ../../yosys -command raise_error -expect-return 7
EOF
exec -expect-return 0 -- ../../yosys -qq mods.il -s fail.temp
write_file fail.temp << EOF
logger -expect error "not found in the log file!" 1
bugpoint -suffix fail -yosys ../../yosys -command raise_error -grep "nope"
EOF
exec -expect-return 0 -- ../../yosys -qq mods.il -s fail.temp
write_file fail.temp << EOF
logger -expect error "not found in stderr log!" 1
bugpoint -suffix fail -yosys ../../yosys -command raise_error -err-grep "nope"
EOF
exec -expect-return 0 -- ../../yosys -qq mods.il -s fail.temp

View file

@ -0,0 +1,83 @@
read_rtlil mods.il
select -assert-count 7 w:*
select -assert-mod-count 3 =*
select -assert-count 4 c:*
design -stash base
# everything is removed by default
design -load base
bugpoint -suffix mods -yosys ../../yosys -command raise_error -expect-return 3
select -assert-count 1 w:*
select -assert-mod-count 1 =*
select -assert-none c:*
# don't remove wires
design -load base
bugpoint -suffix mods -yosys ../../yosys -command raise_error -expect-return 3 -modules -cells
select -assert-count 3 w:*
select -assert-mod-count 1 =*
select -assert-none c:*
# don't remove cells or their connections
design -load base
bugpoint -suffix mods -yosys ../../yosys -command raise_error -expect-return 3 -wires -modules
select -assert-count 5 w:*
select -assert-mod-count 1 =*
select -assert-count 4 c:*
# don't remove cells but do remove their connections
design -load base
bugpoint -suffix mods -yosys ../../yosys -command raise_error -expect-return 3 -wires -modules -connections
select -assert-count 1 w:*
select -assert-mod-count 1 =*
select -assert-count 4 c:*
# don't remove modules
design -load base
bugpoint -suffix mods -yosys ../../yosys -command raise_error -expect-return 3 -wires -cells
select -assert-count 1 w:*
select -assert-mod-count 3 =*
select -assert-none c:*
# can keep wires
design -load base
setattr -set bugpoint_keep 1 w:w_b
bugpoint -suffix mods -yosys ../../yosys -command raise_error -expect-return 3
select -assert-count 2 w:*
select -assert-mod-count 1 =*
select -assert-none c:*
# a wire with keep won't keep the cell/module containing it
design -load base
setattr -set bugpoint_keep 1 w:w_o
bugpoint -suffix mods -yosys ../../yosys -command raise_error -expect-return 3
select -assert-count 1 w:*
select -assert-mod-count 1 =*
select -assert-none c:*
# can keep cells (and do it without the associated module)
design -load base
setattr -set bugpoint_keep 1 c:c_a
bugpoint -suffix mods -yosys ../../yosys -command raise_error -expect-return 3
select -assert-count 1 w:*
select -assert-mod-count 1 =*
select -assert-count 1 c:*
# can keep modules
design -load base
setattr -mod -set bugpoint_keep 1 m_a
bugpoint -suffix mods -yosys ../../yosys -command raise_error -expect-return 3
select -assert-count 1 w:*
select -assert-mod-count 2 =*
select -assert-none c:*
# minimize to just the path connecting w_a and w_c
# which happens via w_b, w_i, w_o, m_a, c_a and c_b
write_file script.temp << EOF
select -assert-none w:w_a %co* w:w_c %ci* %i
EOF
design -load base
bugpoint -suffix mods -yosys ../../yosys -script script.temp -grep "Assertion failed"
select -assert-count 5 w:*
select -assert-mod-count 2 =*
select -assert-count 2 c:*

38
tests/bugpoint/mods.il Normal file
View file

@ -0,0 +1,38 @@
module \m_a
wire input 1 \w_i
wire output 2 \w_o
connect \w_o \w_i
end
module \m_b
wire input 1 \w_i
wire output 2 \w_o
end
attribute \top 1
module \top
attribute \raise_error 3
wire \w_a
wire \w_b
wire \w_c
cell \m_a \c_a
connect \w_i \w_a
connect \w_o \w_b
end
cell \m_a \c_b
connect \w_i \w_b
connect \w_o \w_c
end
cell \m_b \c_c
connect \w_i \w_c
connect \w_o \w_a
end
cell \m_b \c_d
connect \w_i 1'0
connect \w_o 1'1
end
end

View file

@ -0,0 +1,49 @@
read_rtlil procs.il
select -assert-count 2 p:*
design -stash err_q
# processes get removed by default
design -load err_q
bugpoint -suffix procs -yosys ../../yosys -command raise_error -expect-return 4
select -assert-none p:*
# individual processes can be kept
design -load err_q
setattr -set bugpoint_keep 1 p:proc_a
bugpoint -suffix procs -yosys ../../yosys -command raise_error -expect-return 4
select -assert-count 1 p:*
# all processes can be kept
design -load err_q
bugpoint -suffix procs -yosys ../../yosys -command raise_error -expect-return 4 -wires
select -assert-count 2 p:*
# d and clock are connected after proc
design -load err_q
proc
select -assert-count 3 w:d %co
select -assert-count 3 w:clock %co
# no assigns means no d
design -load err_q
bugpoint -suffix procs -yosys ../../yosys -command raise_error -expect-return 4 -assigns
proc
select -assert-count 1 w:d %co
# no updates means no clock
design -load err_q
bugpoint -suffix procs -yosys ../../yosys -command raise_error -expect-return 4 -updates
proc
select -assert-count 1 w:clock %co
# can remove ports
design -load err_q
select -assert-count 5 x:*
bugpoint -suffix procs -yosys ../../yosys -command raise_error -expect-return 4 -ports
select -assert-none x:*
# can keep ports
design -load err_q
setattr -set bugpoint_keep 1 i:d o:q
bugpoint -suffix procs -yosys ../../yosys -command raise_error -expect-return 4 -ports
select -assert-count 2 x:*

42
tests/bugpoint/procs.il Normal file
View file

@ -0,0 +1,42 @@
module \ff_with_en_and_sync_reset
wire $0\q[1:1]
wire $0\q[0:0]
attribute \raise_error 4
wire width 2 output 5 \q
wire width 2 input 4 \d
wire input 3 \enable
wire input 2 \reset
wire input 1 \clock
process \proc_a
assign $0\q[0:0] \q [0]
switch \reset
case 1'1
assign $0\q[0:0] 1'0
case
switch \enable
case 1'1
assign $0\q[0:0] \d [0]
case
end
end
sync posedge \clock
update \q [0] $0\q[0:0]
end
process \proc_b
assign $0\q[1:1] \q [1]
switch \reset
case 1'1
assign $0\q[1:1] 1'0
case
switch \enable
case 1'1
assign $0\q[1:1] \d [1]
case
end
end
sync posedge \clock
update \q [1] $0\q[1:1]
end
end

View file

@ -0,0 +1,43 @@
read_verilog -noblackbox << EOF
(* raise_error=7 *)
module top();
endmodule
(* raise_error="help me" *)
module other();
endmodule
(* raise_error *)
module def();
endmodule
EOF
select -assert-mod-count 3 =*
design -stash read
# raise_error with int exits with status
design -load read
bugpoint -suffix error -yosys ../../yosys -command raise_error -expect-return 7
select -assert-mod-count 1 =*
select -assert-mod-count 1 top
# raise_error with string prints message and exits with 1
design -load read
rename top abc
bugpoint -suffix error -yosys ../../yosys -command raise_error -grep "help me" -expect-return 1
select -assert-mod-count 1 =*
select -assert-mod-count 1 other
# raise_error with no value exits with 1
design -load read
rename def zzy
delete other
bugpoint -suffix error -yosys ../../yosys -command raise_error -expect-return 1
select -assert-mod-count 1 =*
select -assert-mod-count 1 zzy
# raise_error -stderr prints to stderr and exits with 1
design -load read
rename top abc
bugpoint -suffix error -yosys ../../yosys -command "raise_error -stderr" -err-grep "help me" -expect-return 1
select -assert-mod-count 1 =*
select -assert-mod-count 1 other

4
tests/bugpoint/run-test.sh Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -eu
source ../gen-tests-makefile.sh
generate_mk --yosys-scripts

View file

@ -1,3 +1,2 @@
*.log
iverilog-*
yosys-*

View file

@ -1,2 +0,0 @@
*.log
*.out

View file

@ -1,3 +1,2 @@
*.log
/*.filtered
*.verilogsim

View file

@ -1 +0,0 @@
*.log

View file

@ -1,5 +1,2 @@
t_*.log
t_*.out
t_*.v
t_*.ys
run-test.mk

View file

@ -1,3 +1 @@
*.log
*.out
*.dmp

View file

@ -1 +0,0 @@
/*.log

View file

@ -1 +0,0 @@
*.log

View file

@ -1 +0,0 @@
*.log

View file

@ -1,4 +1,2 @@
*.log
run-test.mk
*.vcd
*.fst

View file

@ -1 +0,0 @@
/*.log

View file

@ -1,6 +1,3 @@
*.log
/run-test.mk
+*_synth.v
+*_testbench
*.out
*.fst

View file

@ -1,3 +0,0 @@
*.log
*.out
*.err

View file

@ -1,5 +1,3 @@
*.v
*.sv
*.log
*.out
*.bak

View file

@ -1,3 +0,0 @@
/*.log
/*.out
/run-test.mk

View file

@ -1,3 +0,0 @@
*.log
*.out
/*.mk

View file

@ -4,7 +4,6 @@
/*.sel
/write_gzip.v
/write_gzip.v.gz
/run-test.mk
/plugin.so
/plugin.so.dSYM
/temp

View file

@ -1,3 +0,0 @@
/*.log
/*.out
/run-test.mk

View file

@ -1,7 +1,3 @@
/*.log
/*.out
/*.err
/run-test.mk
/const_arst.v
/const_sr.v
/doubleslash.v