pub enum Control {
Seq(Seq),
Par(Par),
If(If),
While(While),
Repeat(Repeat),
Invoke(Invoke),
Enable(Enable),
Empty(Empty),
Static(StaticControl),
}
Expand description
Control AST nodes.
Variants§
Seq(Seq)
Represents sequential composition of control statements.
Par(Par)
Represents parallel composition of control statements.
If(If)
Standard imperative if statement
While(While)
Standard imperative while statement
Repeat(Repeat)
Standard repeat control statement
Invoke(Invoke)
Invoke a sub-component with the given port assignments
Enable(Enable)
Runs the control for a list of subcomponents.
Empty(Empty)
Control statement that does nothing.
Static(StaticControl)
Static Control
Implementations§
Source§impl Control
impl Control
Sourcepub fn static_enable(group: RRC<StaticGroup>) -> Self
pub fn static_enable(group: RRC<StaticGroup>) -> Self
Convience constructor for enable.
Sourcepub fn invoke(
comp: RRC<Cell>,
inputs: Vec<(Id, RRC<Port>)>,
outputs: Vec<(Id, RRC<Port>)>,
) -> Self
pub fn invoke( comp: RRC<Cell>, inputs: Vec<(Id, RRC<Port>)>, outputs: Vec<(Id, RRC<Port>)>, ) -> Self
Convience constructor for invoke.
Sourcepub fn if_(
port: RRC<Port>,
cond: Option<RRC<CombGroup>>,
tbranch: Box<Control>,
fbranch: Box<Control>,
) -> Self
pub fn if_( port: RRC<Port>, cond: Option<RRC<CombGroup>>, tbranch: Box<Control>, fbranch: Box<Control>, ) -> Self
Convience constructor for if
Sourcepub fn while_(
port: RRC<Port>,
cond: Option<RRC<CombGroup>>,
body: Box<Control>,
) -> Self
pub fn while_( port: RRC<Port>, cond: Option<RRC<CombGroup>>, body: Box<Control>, ) -> Self
Convience constructor for while
Sourcepub fn repeat(num_repeats: u64, body: Box<Control>) -> Self
pub fn repeat(num_repeats: u64, body: Box<Control>) -> Self
Convience constructor for dynamic repeat
Sourcepub fn get_attribute<A>(&self, attr: A) -> Option<u64>
pub fn get_attribute<A>(&self, attr: A) -> Option<u64>
Returns the value of an attribute if present
Sourcepub fn has_attribute<A>(&self, attr: A) -> bool
pub fn has_attribute<A>(&self, attr: A) -> bool
Returns true if the node has a specific attribute
pub fn is_static(&self) -> bool
pub fn is_empty(&self) -> bool
pub fn get_latency(&self) -> Option<u64>
Sourcepub fn take_control(&mut self) -> Control
pub fn take_control(&mut self) -> Control
Replaces &mut self with an empty control statement, and returns self
Sourcepub fn take_static_control(&mut self) -> StaticControl
pub fn take_static_control(&mut self) -> StaticControl
Replaces &mut self with an empty control statement, and returns StaticControl of self. Note that this only works on Control that is static
Trait Implementations§
Source§impl<'a> From<&'a Control> for GenericControl<'a>
impl<'a> From<&'a Control> for GenericControl<'a>
Source§impl From<StaticControl> for Control
impl From<StaticControl> for Control
Source§fn from(sc: StaticControl) -> Self
fn from(sc: StaticControl) -> Self
Source§impl GetAttributes for Control
impl GetAttributes for Control
Source§fn get_mut_attributes(&mut self) -> &mut Attributes
fn get_mut_attributes(&mut self) -> &mut Attributes
Attributes
instanceSource§fn get_attributes(&self) -> &Attributes
fn get_attributes(&self) -> &Attributes
Attributes
instanceAuto Trait Implementations§
impl Freeze for Control
impl !RefUnwindSafe for Control
impl !Send for Control
impl !Sync for Control
impl Unpin for Control
impl !UnwindSafe for Control
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
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