Skip to content

Commit fe9e5aa

Browse files
committed
rtlil: add roundtrip test for design -stash and design -save, fix #5321
1 parent bf29119 commit fe9e5aa

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

kernel/rtlil.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5855,6 +5855,7 @@ RTLIL::CaseRule *RTLIL::CaseRule::clone() const
58555855
RTLIL::CaseRule *new_caserule = new RTLIL::CaseRule;
58565856
new_caserule->compare = compare;
58575857
new_caserule->actions = actions;
5858+
new_caserule->attributes = attributes;
58585859
for (auto &it : switches)
58595860
new_caserule->switches.push_back(it->clone());
58605861
return new_caserule;

tests/rtlil/roundtrip-design.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
set -euo pipefail
2+
YS=../../yosys
3+
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
6+
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

tests/rtlil/roundtrip-text.ref.il

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ module \zzz
203203
connect \B \B
204204
connect \Y $add$everything.v:21$2_Y
205205
end
206-
attribute \src "everything.v:19.3-24.10"
206+
attribute \src "everything.v:21.17-21.17|everything.v:19.3-24.10"
207207
attribute \full_case 1
208208
cell $eq $procmux$8_CMP0
209209
parameter \A_SIGNED 0
@@ -215,7 +215,7 @@ module \zzz
215215
connect \B 4'0001
216216
connect \Y $procmux$8_CMP
217217
end
218-
attribute \src "everything.v:19.3-24.10"
218+
attribute \src "everything.v:21.17-21.17|everything.v:19.3-24.10"
219219
attribute \full_case 1
220220
cell $pmux $procmux$7
221221
parameter \WIDTH 9
@@ -225,7 +225,7 @@ module \zzz
225225
connect \S { $procmux$9_CMP $procmux$8_CMP }
226226
connect \Y $procmux$7_Y
227227
end
228-
attribute \src "everything.v:19.3-24.10"
228+
attribute \src "everything.v:19.19-19.19|everything.v:19.3-24.10"
229229
attribute \full_case 1
230230
cell $logic_not $procmux$9_CMP0
231231
parameter \A_SIGNED 0

0 commit comments

Comments
 (0)