pub enum Guard<T> {
Or(Box<Guard<T>>, Box<Guard<T>>),
And(Box<Guard<T>>, Box<Guard<T>>),
Not(Box<Guard<T>>),
True,
CompOp(PortComp, RRC<Port>, RRC<Port>),
Port(RRC<Port>),
Info(T),
}Expand description
An assignment guard which has pointers to the various ports from which it reads.
Variants§
Or(Box<Guard<T>>, Box<Guard<T>>)
Represents c1 || c2.
And(Box<Guard<T>>, Box<Guard<T>>)
Represents c1 && c2.
Not(Box<Guard<T>>)
Represents !c1
True
The constant true
CompOp(PortComp, RRC<Port>, RRC<Port>)
Comparison operator.
Port(RRC<Port>)
Uses the value on a port as the condition. Same as p1 == true
Info(T)
Other types of information.
Implementations§
Source§impl<T> Guard<T>
impl<T> Guard<T>
Sourcepub fn is_true(&self) -> bool
pub fn is_true(&self) -> bool
Returns true definitely Guard::True.
Returning false does not mean that the guard is not true.
Sourcepub fn is_false(&self) -> bool
pub fn is_false(&self) -> bool
Checks if the guard is always false. Returning false does not mean that the guard is not false.
Sourcepub fn is_not_done(&self, cell_name: &Id) -> bool
pub fn is_not_done(&self, cell_name: &Id) -> bool
returns true if the self is !cell_name, false otherwise.
Sourcepub fn update<F>(&mut self, upd: F)
pub fn update<F>(&mut self, upd: F)
Update the guard in place. Replaces this guard with upd(self).
Uses std::mem::take for the in-place update.
pub fn port(p: RRC<Port>) -> Self
pub fn and(self, rhs: Guard<T>) -> Selfwhere
T: Eq,
pub fn or(self, rhs: Guard<T>) -> Selfwhere
T: Eq,
pub fn eq(self, other: Guard<T>) -> Self
pub fn neq(self, other: Guard<T>) -> Self
pub fn le(self, other: Guard<T>) -> Self
pub fn lt(self, other: Guard<T>) -> Self
pub fn ge(self, other: Guard<T>) -> Self
pub fn gt(self, other: Guard<T>) -> Self
Source§impl<T> Guard<T>
Helper functions for the guard.
impl<T> Guard<T>
Helper functions for the guard.
Sourcepub fn for_each<F>(&mut self, f: &mut F)
pub fn for_each<F>(&mut self, f: &mut F)
Mutates a guard by calling f on every leaf in the
guard tree and replacing the leaf with the guard that f
returns.
Sourcepub fn for_each_info<F>(&mut self, f: &mut F)
pub fn for_each_info<F>(&mut self, f: &mut F)
runs f(info) on each Guard::Info in guard.
if f(info) = Some(result)replaces interval with result. iff(info) = None does nothing.
Source§impl Guard<StaticTiming>
impl Guard<StaticTiming>
Sourcepub fn add_interval(&mut self, timing_interval: StaticTiming)
pub fn add_interval(&mut self, timing_interval: StaticTiming)
updates self -> self & interval
Sourcepub fn compute_live_states(&self, group_latency: u64) -> HashSet<u64>
pub fn compute_live_states(&self, group_latency: u64) -> HashSet<u64>
Take a static assignment guard and the latency of the group in which the assignment exists, and provide a list of states, relative to the group’s latency, in which the static assignment should be valid.
Sourcepub fn replace_static_timing(
&mut self,
builder: &mut Builder<'_>,
counter: &RRC<Cell>,
width: &u64,
domain: &u64,
)
pub fn replace_static_timing( &mut self, builder: &mut Builder<'_>, counter: &RRC<Cell>, width: &u64, domain: &u64, )
Replace every interval [a1, a_n] in a static timing guard with
counter.out == a_1 | counter.out == a_2 | ... | counter.out == a_{n-1}
Sourcepub fn remove_static_timing_info(&mut self)
pub fn remove_static_timing_info(&mut self)
Take a static assignment guard and get rid of all static timing portions
of the guard. This is useful when we know the cycles c at which the assignment
will be active, and we can separately construct the assignment guard
like dst = c ? src instead of dst = beg <= c <= end ? src.
Trait Implementations§
Source§impl<T> BitAndAssign for Guard<T>where
T: Eq,
Update a Guard with Or.
impl<T> BitAndAssign for Guard<T>where
T: Eq,
Update a Guard with Or.
g1 &= g2;Source§fn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
&= operation. Read moreSource§impl<T> BitOrAssign for Guard<T>where
T: Eq,
Update a Guard with Or.
impl<T> BitOrAssign for Guard<T>where
T: Eq,
Update a Guard with Or.
g1 |= g2;Source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
|= operation. Read moreSource§impl<T> Ord for Guard<T>where
T: Eq,
Define an ordering on the precedence of guards. Guards are
considered equal when they have the same precedence.
impl<T> Ord for Guard<T>where
T: Eq,
Define an ordering on the precedence of guards. Guards are considered equal when they have the same precedence.
Source§impl<T> PartialOrd for Guard<T>where
T: Eq,
Define order on guards
impl<T> PartialOrd for Guard<T>where
T: Eq,
Define order on guards
impl<T> Eq for Guard<T>where
T: Eq,
Auto Trait Implementations§
impl<T> Freeze for Guard<T>where
T: Freeze,
impl<T> !RefUnwindSafe for Guard<T>
impl<T> !Send for Guard<T>
impl<T> !Sync for Guard<T>
impl<T> Unpin for Guard<T>where
T: Unpin,
impl<T> !UnwindSafe for Guard<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CallHasher for T
impl<T> CallHasher for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more