mirror of
https://github.com/YosysHQ/yosys
synced 2025-09-14 13:41:27 +00:00
30 lines
1.7 KiB
Bash
30 lines
1.7 KiB
Bash
set -euo pipefail
|
|
YS=../../yosys
|
|
|
|
# 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
|
|
# 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
|
|
|
|
# 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
|
|
|
|
# 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
|
|
|
|
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
|