Skip to content

Commit

Permalink
make "cycle" use same reset mode execution as built-in reset; better …
Browse files Browse the repository at this point in the history
…warning message
  • Loading branch information
rmanohar committed Feb 5, 2023
1 parent 22c2957 commit 1094d7c
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 13 deletions.
10 changes: 7 additions & 3 deletions actsim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1915,11 +1915,15 @@ void ActSimObj::msgPrefix (FILE *fp)
fprintf (fp, "> ");
}

bool _match_oneprs (Event *e)
bool _match_hseprs (Event *e)
{
if (dynamic_cast <OnePrsSim *> (e->getObj())) {
return true;
}
ChpSim *x = dynamic_cast <ChpSim *> (e->getObj());
if (x && x->isHseMode()) {
return true;
}
return false;
}

Expand Down Expand Up @@ -1980,7 +1984,7 @@ void ActSim::runInit ()
if (!g->getlang() || !g->getlang()->getinit()) {
if (fragmented_set) {
int count = 0;
while (SimDES::matchPendingEvent (_match_oneprs) && count < 100) {
while (SimDES::matchPendingEvent (_match_hseprs) && count < 100) {
count++;
if (SimDES::AdvanceTime (10) != NULL) {
warning ("breakpoint?");
Expand Down Expand Up @@ -2045,7 +2049,7 @@ void ActSim::runInit ()
warning ("breakpoint?");
}
count++;
if (!SimDES::matchPendingEvent (_match_oneprs)) {
if (!SimDES::matchPendingEvent (_match_hseprs)) {
break;
}
} while (count < 100);
Expand Down
2 changes: 1 addition & 1 deletion actsim.h
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,6 @@ extern int debug_metrics;
Act *actsim_Act();
Process *actsim_top();
int is_rand_excl ();

bool _match_hseprs (Event *);

#endif /* __ACT_SIM_H__ */
18 changes: 11 additions & 7 deletions chpsim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1985,14 +1985,18 @@ BigInt ChpSim::varEval (int id, int type)
val = _sc->getBool (off);
r.setVal (0, val);
if (val == 2) {
#if 0
fprintf (stderr, "[%8lu] <", CurTimeLo());
if (name) {
name->Print (stderr);
act_connection *c;
ActId *tmp;
int dy;
c = _sc->getConnFromOffset (_proc, id, type, &dy);
msgPrefix (actsim_log_fp());
fprintf (actsim_log_fp(), "WARNING: Boolean variable `");
if (c) {
tmp = c->toid();
tmp->Print (actsim_log_fp());
delete tmp;
}
fprintf (stderr, "> ");
#endif
warning ("Boolean variable is X");
fprintf (actsim_log_fp(), "' is X\n");
r.setWidth (2);
r.setVal (0, val);
}
Expand Down
1 change: 1 addition & 0 deletions chpsim.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ class ChpSim : public ActSimObj {
BigInt exprEval (Expr *e);

void setHseMode() { _hse_mode = 1; }
int isHseMode() { return _hse_mode; }


private:
Expand Down
14 changes: 13 additions & 1 deletion main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,19 @@ int process_cycle (int argc, char **argv)
fprintf (stderr, "Usage: %s\n", argv[0]);
return LISP_RET_ERROR;
}
glob_sim->runSim (NULL);

if (glob_sim->isResetMode()) {
while (!LispInterruptExecution) {
if (!SimDES::matchPendingEvent (_match_hseprs)) {
// no prs or hse pending events!
break;
}
glob_sim->Step (1); // ignores breakpoints
}
}
else {
glob_sim->runSim (NULL);
}
return LISP_RET_TRUE;
}

Expand Down
1 change: 0 additions & 1 deletion test/runs/4.act.stderr
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
WARNING: test<>: substituting chp model (requested prs, not found)
WARNING: Boolean variable is X
1 change: 1 addition & 0 deletions test/runs/4.act.stdout
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
[ 10] <> WARNING: Boolean variable `i' is X
[ 10] <> here

0 comments on commit 1094d7c

Please sign in to comment.