Skip to content

Commit 34748cd

Browse files
committed
rtlil: move test temporary files to temp directory
1 parent fe9e5aa commit 34748cd

File tree

3 files changed

+27
-24
lines changed

3 files changed

+27
-24
lines changed

tests/rtlil/.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
*.tmp.il
2-
*.tmp.il.bak
1+
/temp

tests/rtlil/roundtrip-design.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
set -euo pipefail
22
YS=../../yosys
33

4-
$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"
5-
diff roundtrip-design-push.tmp.il roundtrip-design-pop.tmp.il
4+
mkdir -p temp
65

7-
$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"
8-
diff roundtrip-design-save.tmp.il roundtrip-design-load.tmp.il
6+
$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"
7+
diff temp/roundtrip-design-push.il temp/roundtrip-design-pop.il
8+
9+
$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"
10+
diff temp/roundtrip-design-save.il temp/roundtrip-design-load.il

tests/rtlil/roundtrip-text.sh

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
set -euo pipefail
22
YS=../../yosys
33

4+
mkdir -p temp
5+
46
# 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
810
# 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
1214

1315
# 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
1820

1921
# 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
2426

2527
echo "Without ABC, we don't get any irreproducibility and can pin that"
2628
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

Comments
 (0)