Skip to content

Commit

Permalink
Merge pull request #83 from Spooky-Firefox/simulator_reset_fix
Browse files Browse the repository at this point in the history
Fixed order of reset and evaluation in simulator reset function
  • Loading branch information
onsdagens authored Aug 5, 2024
2 parents 613521a + b8345e6 commit 7df8d51
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/simulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,15 +309,19 @@ impl Simulator {

/// reset simulator
pub fn reset(&mut self) {
// The order of the following is not important
// with the exception that self.clock() needs to be last
self.history = vec![];
self.cycle = 0;
self.sim_state.iter_mut().for_each(|val| *val = 0.into());
self.stop();
self.clock();

self.sim_state.iter_mut().for_each(|val| *val = 0.into());

for component in self.ordered_components.clone() {
component.reset();
}

self.clock();
}

pub fn get_state(&self) -> bool {
Expand Down

0 comments on commit 7df8d51

Please sign in to comment.