Skip to content

Commit 5f91cef

Browse files
committed
[ISSUE] Add #19
1 parent 987fd61 commit 5f91cef

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

issue/19/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
include ${PSS_HOME}/issue/Make.vars
2+
3+
gentarget:
4+
$(PSSGEN) test.pss -o test.s -root pss_top::root_a || true
5+
6+
clean:
7+
rm -f test.s result.log

issue/19/test.pss

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*!
2+
@weakgroup issue
3+
@{
4+
@file
5+
@author Luther Lee
6+
@data 2024/05/08
7+
@brief Test issue 19.
8+
9+
10+
---------------------------------------------------------------------------------------------------
11+
12+
### Test Command
13+
@code{.unparsed}
14+
make
15+
@endcode
16+
17+
@cond
18+
*/
19+
component pss_top {
20+
action root_a {
21+
activity {
22+
do randWithIfElseCondition with { condition == "foo"; };
23+
do randWithIfElseCondition with { condition == "bar"; };
24+
do randWithIfCondition with { condition == "foo"; };
25+
do randWithIfCondition with { condition == "bar"; };
26+
}
27+
}
28+
29+
action randWithIfElseCondition {
30+
rand string condition;
31+
rand int value;
32+
constraint {
33+
if ("foo" == condition) value in [12345];
34+
else value in [0];
35+
}
36+
37+
exec post_solve {
38+
if (12345 != value) value = 54321;
39+
}
40+
exec body ASM = """randWithIfElseCondition: {{condition}} ; {{value}}""";
41+
}
42+
43+
action randWithIfCondition {
44+
rand string condition;
45+
rand int value;
46+
constraint {
47+
if ("foo" == condition) value in [12345];
48+
}
49+
50+
exec post_solve {
51+
if (12345 != value) value = 54321;
52+
}
53+
exec body ASM = """randWithIfCondition: {{condition}} ; {{value}}""";
54+
}
55+
}
56+
57+
/**@}*/

issue/19/test.s.golden

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
randWithIfElseCondition: foo ; 12345
2+
randWithIfElseCondition: bar ; 54321
3+
randWithIfCondition: foo ; 12345
4+
randWithIfCondition: bar ; 54321

0 commit comments

Comments
 (0)