diff --git a/tests/rtlil/.gitignore b/tests/rtlil/.gitignore index e1661c060..abe251a76 100644 --- a/tests/rtlil/.gitignore +++ b/tests/rtlil/.gitignore @@ -1,2 +1 @@ -*.tmp.il -*.tmp.il.bak \ No newline at end of file +/temp \ No newline at end of file diff --git a/tests/rtlil/roundtrip-design.sh b/tests/rtlil/roundtrip-design.sh index beacddd8f..018e363c7 100644 --- a/tests/rtlil/roundtrip-design.sh +++ b/tests/rtlil/roundtrip-design.sh @@ -1,8 +1,10 @@ set -euo pipefail YS=../../yosys -$YS -p "read_verilog -sv everything.v; write_rtlil roundtrip-design-push.tmp.il; design -push; design -pop; write_rtlil roundtrip-design-pop.tmp.il" -diff roundtrip-design-push.tmp.il roundtrip-design-pop.tmp.il +mkdir -p temp -$YS -p "read_verilog -sv everything.v; write_rtlil roundtrip-design-save.tmp.il; design -save foo; design -load foo; write_rtlil roundtrip-design-load.tmp.il" -diff roundtrip-design-save.tmp.il roundtrip-design-load.tmp.il +$YS -p "read_verilog -sv everything.v; write_rtlil temp/roundtrip-design-push.il; design -push; design -pop; write_rtlil temp/roundtrip-design-pop.il" +diff temp/roundtrip-design-push.il temp/roundtrip-design-pop.il + +$YS -p "read_verilog -sv everything.v; write_rtlil temp/roundtrip-design-save.il; design -save foo; design -load foo; write_rtlil temp/roundtrip-design-load.il" +diff temp/roundtrip-design-save.il temp/roundtrip-design-load.il diff --git a/tests/rtlil/roundtrip-text.sh b/tests/rtlil/roundtrip-text.sh index 7dd0327ca..45db7ee72 100644 --- a/tests/rtlil/roundtrip-text.sh +++ b/tests/rtlil/roundtrip-text.sh @@ -1,30 +1,32 @@ set -euo pipefail YS=../../yosys +mkdir -p temp + # write_rtlil and dump are equivalent -$YS -p "read_verilog -sv everything.v; copy alu zzz; proc zzz; dump -o roundtrip-text.dump.tmp.il; write_rtlil roundtrip-text.write.tmp.il" -sed '/^$/d' -i.bak roundtrip-text.dump.tmp.il -sed '/^$/d' -i.bak roundtrip-text.write.tmp.il +$YS -p "read_verilog -sv everything.v; copy alu zzz; proc zzz; dump -o temp/roundtrip-text.dump.il; write_rtlil temp/roundtrip-text.write.il" +sed '/^$/d' -i.bak temp/roundtrip-text.dump.il +sed '/^$/d' -i.bak temp/roundtrip-text.write.il # Trim first line ("Generated by Yosys ...") -tail -n +2 roundtrip-text.write.tmp.il > roundtrip-text.write-nogen.tmp.il -diff roundtrip-text.dump.tmp.il roundtrip-text.write-nogen.tmp.il -diff roundtrip-text.dump.tmp.il roundtrip-text.ref.il +tail -n +2 temp/roundtrip-text.write.il > temp/roundtrip-text.write-nogen.il +diff temp/roundtrip-text.dump.il temp/roundtrip-text.write-nogen.il +diff temp/roundtrip-text.dump.il roundtrip-text.ref.il # Loading and writing it out again doesn't change the RTLIL -$YS -p "read_rtlil roundtrip-text.dump.tmp.il; write_rtlil roundtrip-text.reload.tmp.il" -sed '/^$/d' -i.bak roundtrip-text.reload.tmp.il -tail -n +2 roundtrip-text.reload.tmp.il > roundtrip-text.reload-nogen.tmp.il -diff roundtrip-text.dump.tmp.il roundtrip-text.reload-nogen.tmp.il +$YS -p "read_rtlil temp/roundtrip-text.dump.il; write_rtlil temp/roundtrip-text.reload.il" +sed '/^$/d' -i.bak temp/roundtrip-text.reload.il +tail -n +2 temp/roundtrip-text.reload.il > temp/roundtrip-text.reload-nogen.il +diff temp/roundtrip-text.dump.il temp/roundtrip-text.reload-nogen.il # Hashing differences don't change the RTLIL -$YS --hash-seed=2345678 -p "read_rtlil roundtrip-text.dump.tmp.il; write_rtlil roundtrip-text.reload-hash.tmp.il" -sed '/^$/d' -i.bak roundtrip-text.reload-hash.tmp.il -tail -n +2 roundtrip-text.reload-hash.tmp.il > roundtrip-text.reload-hash-nogen.tmp.il -diff roundtrip-text.dump.tmp.il roundtrip-text.reload-hash-nogen.tmp.il +$YS --hash-seed=2345678 -p "read_rtlil temp/roundtrip-text.dump.il; write_rtlil temp/roundtrip-text.reload-hash.il" +sed '/^$/d' -i.bak temp/roundtrip-text.reload-hash.il +tail -n +2 temp/roundtrip-text.reload-hash.il > temp/roundtrip-text.reload-hash-nogen.il +diff temp/roundtrip-text.dump.il temp/roundtrip-text.reload-hash-nogen.il echo "Without ABC, we don't get any irreproducibility and can pin that" echo "Has this test case started failing for you? Consider updating the reference" -$YS -p "read_verilog -sv everything.v; synth -noabc; write_rtlil roundtrip-text.synth.tmp.il" -sed '/^$/d' -i.bak roundtrip-text.synth.tmp.il -tail -n +2 roundtrip-text.synth.tmp.il > roundtrip-text.synth-nogen.tmp.il -diff roundtrip-text.synth-nogen.tmp.il roundtrip-text.synth.ref.il +$YS -p "read_verilog -sv everything.v; synth -noabc; write_rtlil temp/roundtrip-text.synth.il" +sed '/^$/d' -i.bak temp/roundtrip-text.synth.il +tail -n +2 temp/roundtrip-text.synth.il > temp/roundtrip-text.synth-nogen.il +diff temp/roundtrip-text.synth-nogen.il roundtrip-text.synth.ref.il