Skip to content

Commit

Permalink
fix for odd nesting
Browse files Browse the repository at this point in the history
  • Loading branch information
rmanohar committed May 22, 2023
1 parent cee95f6 commit 2df113e
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
8 changes: 8 additions & 0 deletions chpsim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3697,6 +3697,9 @@ ChpSimGraph *ChpSimGraph::completed (int pc, int *tot, int *done)
return NULL;
}
if (next->wait > 0) {
#ifdef DUMP_ALL
printf (" [wt=%d cur=%d{%d}]", next->wait, tot[next->totidx], next->totidx);
#endif
tot[next->totidx]++;
if (next->wait == tot[next->totidx]) {
*done = 1;
Expand Down Expand Up @@ -4595,6 +4598,7 @@ ChpSimGraph *ChpSimGraph::_buildChpSimGraph (ActSimCore *sc,
int i, count;
int tmp;
int width;
int used_slots = 0;

if (!c) return NULL;

Expand All @@ -4606,6 +4610,7 @@ ChpSimGraph *ChpSimGraph::_buildChpSimGraph (ActSimCore *sc,
(sc,
(act_chp_lang_t *)list_value (list_first (c->u.semi_comma.cmd)), stop);
}
used_slots = cur_pending_count;
for (listitem_t *li = list_first (c->u.semi_comma.cmd);
li; li = list_next (li)) {
cur_pending_count = count;
Expand All @@ -4621,7 +4626,9 @@ ChpSimGraph *ChpSimGraph::_buildChpSimGraph (ActSimCore *sc,
*stop = tmp2;
}
}
used_slots = MAX(used_slots, cur_pending_count);
}
cur_pending_count = used_slots;
break;

case ACT_CHP_COMMA:
Expand All @@ -4642,6 +4649,7 @@ ChpSimGraph *ChpSimGraph::_buildChpSimGraph (ActSimCore *sc,
count = 0;
MALLOC (ret->all, ChpSimGraph *, list_length (c->u.semi_comma.cmd));
i = 0;

for (listitem_t *li = list_first (c->u.semi_comma.cmd);
li; li = list_next (li)) {
ret->all[i] = _buildChpSimGraph (sc,
Expand Down
29 changes: 29 additions & 0 deletions test/98.act
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
defproc p1(chan(int<1>) A, B, D)
{
chp {
*[ A!,B!; D? ]
}
}

defproc p2(chan(int<1>) A, B, D)
{
chp {
*[ A?,B?; D! ]
}
}

defproc test()
{
chan(int<1>) A, B, D;
int i;

chp {
( i := 0; *[ i < 1000 -> A!,B!; D?; i := i + 1 ] )
||
*[ A?,B?; D! ]
}
/*
p1 x(A,B,D);
p2 y(A,B,D);
*/
}
1 change: 1 addition & 0 deletions test/runs/98.act.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
WARNING: test<>: substituting chp model (requested prs, not found)
Empty file added test/runs/98.act.stdout
Empty file.

0 comments on commit 2df113e

Please sign in to comment.