Skip to content

Commit

Permalink
Merge branch 'fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
rmanohar committed Jun 2, 2023
2 parents ea22f60 + 80598b1 commit 0a8188e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 18 deletions.
40 changes: 22 additions & 18 deletions chpsim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1157,28 +1157,23 @@ int ChpSim::Step (Event *ev)
int idx;
ChpSimGraph *g = _pc[pc];
for (int i=0; i < stmt->u.fork; i++) {
if (first) {
idx = pc;
first = 0;
}
else {
Assert (_pcused < _npc, "What?");
idx = _holes[_pcused++];
_holes[_pcused-1] = -1;
count++;
}
_pc[idx] = g->all[i];
if (g->all[i]) {
#if 0
if (first) {
idx = pc;
first = 0;
}
else {
Assert (_pcused < _npc, "What?");
idx = _holes[_pcused++];
_holes[_pcused-1] = -1;
count++;
}
_pc[idx] = g->all[i];
#if 0
printf (" idx:%d", idx);
#endif
_nextEvent (idx, bw_cost);
}
else {
Assert (_pcused > 0, "What?");
_holes[_pcused-1] = idx;
_pcused--;
}
}
//_pcused += stmt->u.fork - 1;
#ifdef DUMP_ALL
Expand Down Expand Up @@ -4641,6 +4636,7 @@ ChpSimGraph *ChpSimGraph::_buildChpSimGraph (ActSimCore *sc,
int tmp;
int width;
int used_slots = 0;
ChpSimGraph *ostop;

if (!c) return NULL;

Expand Down Expand Up @@ -4680,6 +4676,7 @@ ChpSimGraph *ChpSimGraph::_buildChpSimGraph (ActSimCore *sc,
(act_chp_lang_t *)list_value (list_first (c->u.semi_comma.cmd)), stop);
}
ret = new ChpSimGraph (sc);
ostop = *stop;
*stop = new ChpSimGraph (sc);
tmp = cur_pending_count++;
if (cur_pending_count > max_pending_count) {
Expand Down Expand Up @@ -4708,10 +4705,17 @@ ChpSimGraph *ChpSimGraph::_buildChpSimGraph (ActSimCore *sc,
ret->stmt->energy_cost = 0;
ret->stmt->bw_cost = 0;
ret->stmt->type = CHPSIM_FORK;
ret->stmt->u.fork = count;
ret->stmt->u.fork = i;
(*stop)->wait = count;
(*stop)->totidx = tmp;
}
else {
FREE (ret->all);
FREE (ret);
FREE (*stop);
*stop = ostop;
ret = NULL;
}
break;

case ACT_CHP_SELECT:
Expand Down
7 changes: 7 additions & 0 deletions test/99.act
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
defproc test()
{
int x, y;
chp {
(x := 1, skip, y:= 2); log ("got hi")
}
}
1 change: 1 addition & 0 deletions test/runs/99.act.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
WARNING: test<>: substituting chp model (requested prs, not found)
1 change: 1 addition & 0 deletions test/runs/99.act.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[ 10] <> got hi

0 comments on commit 0a8188e

Please sign in to comment.