Skip to content

Commit

Permalink
Merge pull request #929 from firesim/unstable-peek-poke-race
Browse files Browse the repository at this point in the history
Ensure Delay on Unstable Peek/Poke Regardless of Log Setting
  • Loading branch information
davidbiancolin committed Feb 9, 2022
2 parents a22ba50 + e89532f commit dfb4de8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 5 additions & 3 deletions sim/src/main/cc/midasexamples/simif_peek_poke.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ simif_peek_poke_t::simif_peek_poke_t() {

void simif_peek_poke_t::target_reset(int pulse_length) {
poke(reset, 1);
take_steps(pulse_length, true);
this->step(pulse_length, true);
poke(reset, 0);
}

Expand Down Expand Up @@ -44,7 +44,9 @@ data_t simif_peek_poke_t::peek(size_t id, bool blocking) {
}
throw;
}
if (log && blocking && !wait_on_stable_peeks(0.1))

bool peek_may_be_unstable = blocking && !wait_on_stable_peeks(0.1);
if (log && peek_may_be_unstable)
fprintf(stderr, "* WARNING : The following peek is on an unstable value!\n");
data_t value = read(((unsigned int*) OUTPUT_ADDRS)[id]);
if (log)
Expand Down Expand Up @@ -121,7 +123,7 @@ int simif_peek_poke_t::teardown() {
record_end_times();
fprintf(stderr, "[%s] %s Test", pass ? "PASS" : "FAIL", TARGET_NAME);
if (!pass) { fprintf(stdout, " at cycle %llu", fail_t); }
fprintf(stderr, "SEED: %ld\n", get_seed());
fprintf(stderr, "\nSEED: %ld\n", get_seed());
this->print_simulation_performance_summary();

this->host_finish();
Expand Down
5 changes: 2 additions & 3 deletions sim/src/main/cc/midasexamples/simif_peek_poke.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,12 @@ class simif_peek_poke_t: public virtual simif_t

private:
// simulation information
bool log;
bool log = true;
bool pass = true;
uint64_t t = 0;
uint64_t fail_t = 0;
// random numbers
PEEKPOKEBRIDGEMODULE_struct * defaultiowidget_mmio_addrs;

PEEKPOKEBRIDGEMODULE_struct * defaultiowidget_mmio_addrs;

bool wait_on(size_t flag_addr, double timeout) {
midas_time_t start = timestamp();
Expand Down

0 comments on commit dfb4de8

Please sign in to comment.