|
1 | 1 | set -euo pipefail |
2 | 2 | YS=../../yosys |
3 | 3 |
|
| 4 | +mkdir -p temp |
| 5 | + |
4 | 6 | # write_rtlil and dump are equivalent |
5 | | -$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" |
6 | | -sed '/^$/d' -i.bak roundtrip-text.dump.tmp.il |
7 | | -sed '/^$/d' -i.bak roundtrip-text.write.tmp.il |
| 7 | +$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" |
| 8 | +sed '/^$/d' -i.bak temp/roundtrip-text.dump.il |
| 9 | +sed '/^$/d' -i.bak temp/roundtrip-text.write.il |
8 | 10 | # Trim first line ("Generated by Yosys ...") |
9 | | -tail -n +2 roundtrip-text.write.tmp.il > roundtrip-text.write-nogen.tmp.il |
10 | | -diff roundtrip-text.dump.tmp.il roundtrip-text.write-nogen.tmp.il |
11 | | -diff roundtrip-text.dump.tmp.il roundtrip-text.ref.il |
| 11 | +tail -n +2 temp/roundtrip-text.write.il > temp/roundtrip-text.write-nogen.il |
| 12 | +diff temp/roundtrip-text.dump.il temp/roundtrip-text.write-nogen.il |
| 13 | +diff temp/roundtrip-text.dump.il roundtrip-text.ref.il |
12 | 14 |
|
13 | 15 | # Loading and writing it out again doesn't change the RTLIL |
14 | | -$YS -p "read_rtlil roundtrip-text.dump.tmp.il; write_rtlil roundtrip-text.reload.tmp.il" |
15 | | -sed '/^$/d' -i.bak roundtrip-text.reload.tmp.il |
16 | | -tail -n +2 roundtrip-text.reload.tmp.il > roundtrip-text.reload-nogen.tmp.il |
17 | | -diff roundtrip-text.dump.tmp.il roundtrip-text.reload-nogen.tmp.il |
| 16 | +$YS -p "read_rtlil temp/roundtrip-text.dump.il; write_rtlil temp/roundtrip-text.reload.il" |
| 17 | +sed '/^$/d' -i.bak temp/roundtrip-text.reload.il |
| 18 | +tail -n +2 temp/roundtrip-text.reload.il > temp/roundtrip-text.reload-nogen.il |
| 19 | +diff temp/roundtrip-text.dump.il temp/roundtrip-text.reload-nogen.il |
18 | 20 |
|
19 | 21 | # Hashing differences don't change the RTLIL |
20 | | -$YS --hash-seed=2345678 -p "read_rtlil roundtrip-text.dump.tmp.il; write_rtlil roundtrip-text.reload-hash.tmp.il" |
21 | | -sed '/^$/d' -i.bak roundtrip-text.reload-hash.tmp.il |
22 | | -tail -n +2 roundtrip-text.reload-hash.tmp.il > roundtrip-text.reload-hash-nogen.tmp.il |
23 | | -diff roundtrip-text.dump.tmp.il roundtrip-text.reload-hash-nogen.tmp.il |
| 22 | +$YS --hash-seed=2345678 -p "read_rtlil temp/roundtrip-text.dump.il; write_rtlil temp/roundtrip-text.reload-hash.il" |
| 23 | +sed '/^$/d' -i.bak temp/roundtrip-text.reload-hash.il |
| 24 | +tail -n +2 temp/roundtrip-text.reload-hash.il > temp/roundtrip-text.reload-hash-nogen.il |
| 25 | +diff temp/roundtrip-text.dump.il temp/roundtrip-text.reload-hash-nogen.il |
24 | 26 |
|
25 | 27 | echo "Without ABC, we don't get any irreproducibility and can pin that" |
26 | 28 | echo "Has this test case started failing for you? Consider updating the reference" |
27 | | -$YS -p "read_verilog -sv everything.v; synth -noabc; write_rtlil roundtrip-text.synth.tmp.il" |
28 | | -sed '/^$/d' -i.bak roundtrip-text.synth.tmp.il |
29 | | -tail -n +2 roundtrip-text.synth.tmp.il > roundtrip-text.synth-nogen.tmp.il |
30 | | -diff roundtrip-text.synth-nogen.tmp.il roundtrip-text.synth.ref.il |
| 29 | +$YS -p "read_verilog -sv everything.v; synth -noabc; write_rtlil temp/roundtrip-text.synth.il" |
| 30 | +sed '/^$/d' -i.bak temp/roundtrip-text.synth.il |
| 31 | +tail -n +2 temp/roundtrip-text.synth.il > temp/roundtrip-text.synth-nogen.il |
| 32 | +diff temp/roundtrip-text.synth-nogen.il roundtrip-text.synth.ref.il |
0 commit comments