Skip to content

Commit

Permalink
bw modeling
Browse files Browse the repository at this point in the history
  • Loading branch information
rmanohar committed Mar 25, 2023
1 parent 35bbd72 commit 8751745
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions chpsim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ void ChpSim::reStart (ChpSimGraph *g, int max_cnt)
_tot[i] = 0;
}
_pc[0] = g;
_nextEvent (0);
_nextEvent (0, 0);
}


Expand All @@ -501,22 +501,22 @@ ChpSim::~ChpSim()
}
}

int ChpSim::_nextEvent (int pc)
int ChpSim::_nextEvent (int pc, int bw_cost)
{
while (_pc[pc] && !_pc[pc]->stmt) {
pc = _updatepc (pc);
}
if (_pc[pc]) {
new Event (this, SIM_EV_MKTYPE (pc,0) /* pc */,
_sc->getDelay (_pc[pc]->stmt->delay_cost));
_sc->getDelay (_pc[pc]->stmt->delay_cost + bw_cost));
return 1;
}
return 0;
}

void ChpSim::_initEvent ()
{
_nextEvent (0);
_nextEvent (0, 0);
}

void ChpSim::computeFanout ()
Expand Down Expand Up @@ -1101,6 +1101,8 @@ int ChpSim::Step (Event *ev)

chpsimstmt *stmt = _pc[pc]->stmt;

int bw_cost = stmt->bw_cost;

#ifdef DUMP_ALL
printf ("[%8lu %d; pc:%d(%d)] <", CurTimeLo(), flag, pc, _pcused);
if (name) {
Expand Down Expand Up @@ -1139,7 +1141,7 @@ int ChpSim::Step (Event *ev)
#if 0
printf (" idx:%d", idx);
#endif
_nextEvent (idx);
_nextEvent (idx, bw_cost);
}
else {
Assert (_pcused > 0, "What?");
Expand Down Expand Up @@ -1621,7 +1623,7 @@ int ChpSim::Step (Event *ev)
#ifdef DUMP_ALL
printf (" [NEXT!]\n");
#endif
_nextEvent (pc);
_nextEvent (pc, bw_cost);
}
return 1 - _breakpt;
}
Expand Down
2 changes: 1 addition & 1 deletion chpsim.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class ChpSim : public ActSimObj {
int _collect_sharedvars (Expr *e, int pc, int undo);
void _remove_me (int pc);

int _nextEvent (int pc);
int _nextEvent (int pc, int bw_delay);
void _initEvent ();
void _zeroAllIntsChans (ChpSimGraph *g);
void _zeroStructure (struct chpsimderef *d);
Expand Down

0 comments on commit 8751745

Please sign in to comment.