Skip to content

Commit

Permalink
fix the @control propagation error
Browse files Browse the repository at this point in the history
  • Loading branch information
EclecticGriffin committed Nov 26, 2024
1 parent 29a0b50 commit 5bd6749
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion interp/src/flatten/flat_ir/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,11 +538,15 @@ impl AssignedValue {
self
}

pub fn set_propagate_clocks(mut self) -> Self {
pub fn with_propagate_clocks(mut self) -> Self {
self.propagate_clocks = true;
self
}

pub fn set_propagate_clocks(&mut self, propagate_clocks: bool) {
self.propagate_clocks = propagate_clocks;
}

/// Returns true if the two AssignedValues do not have the same winner
pub fn has_conflict_with(&self, other: &Self) -> bool {
self.winner != other.winner
Expand Down
10 changes: 9 additions & 1 deletion interp/src/flatten/structures/environment/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2437,7 +2437,7 @@ impl<C: AsRef<Context> + Clone> Simulator<C> {
.with_transitive_clocks_opt(
val.transitive_clocks().cloned(),
)
.set_propagate_clocks();
.with_propagate_clocks();
// direct clock becomes a transitive clock
// on assignment
if let Some(c) = val.clocks() {
Expand Down Expand Up @@ -2707,6 +2707,14 @@ impl<C: AsRef<Context> + Clone> Simulator<C> {
.as_option_mut()
.unwrap()
.add_transitive_clocks(set_extension);

// this is necessary for ports which were implicitly
// assigned zero and is redundant for other ports
// which will already have propagate_clocks set
self.env.ports[dest]
.as_option_mut()
.unwrap()
.set_propagate_clocks(true);
}
}
}
Expand Down

0 comments on commit 5bd6749

Please sign in to comment.