Skip to content

Commit

Permalink
synth: clear synthesis variables
Browse files Browse the repository at this point in the history
  • Loading branch information
ekiwi committed Dec 12, 2023
1 parent 27c3a70 commit 0c07003
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions synth/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ fn main() {
tb.define_inputs(InitKind::Random(1));
}
}
// set all synthesis variables to zero
synth_vars.clear_in_sim(&mut sim);

// remember the starting state
let start_state = sim.take_snapshot();

Expand Down
9 changes: 9 additions & 0 deletions synth/src/repair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ impl RepairVars {
}
}

pub fn clear_in_sim(&self, sim: &mut impl Simulator) {
for sym in self.change.iter() {
sim.set(*sym, &Value::from_u64(0));
}
for sym in self.free.iter() {
sim.set(*sym, &Value::from_u64(0));
}
}

pub fn to_json(&self, ctx: &Context, assignment: &RepairAssignment) -> serde_json::Value {
//let mut out = IndexMap::with_capacity(self.change.len() + self.free.len());
let mut out = serde_json::Map::with_capacity(self.change.len() + self.free.len());
Expand Down

0 comments on commit 0c07003

Please sign in to comment.