mirror of
https://github.com/YosysHQ/yosys
synced 2025-09-20 00:14:50 +00:00
rtlil: add textual roundtrip test
This commit is contained in:
parent
d7a80c6165
commit
c12b485135
7 changed files with 1554 additions and 0 deletions
30
tests/rtlil/roundtrip-text.sh
Normal file
30
tests/rtlil/roundtrip-text.sh
Normal file
|
@ -0,0 +1,30 @@
|
|||
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
|
Loading…
Add table
Add a link
Reference in a new issue