calyx_ir

Enum Control

Source
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

Source

pub fn empty() -> Self

Convience constructor for empty.

Source

pub fn seq(stmts: Vec<Control>) -> Self

Convience constructor for seq.

Source

pub fn par(stmts: Vec<Control>) -> Self

Convience constructor for par.

Source

pub fn enable(group: RRC<Group>) -> Self

Convience constructor for enable.

Source

pub fn static_enable(group: RRC<StaticGroup>) -> Self

Convience constructor for enable.

Source

pub fn invoke( comp: RRC<Cell>, inputs: Vec<(Id, RRC<Port>)>, outputs: Vec<(Id, RRC<Port>)>, ) -> Self

Convience constructor for invoke.

Source

pub fn if_( port: RRC<Port>, cond: Option<RRC<CombGroup>>, tbranch: Box<Control>, fbranch: Box<Control>, ) -> Self

Convience constructor for if

Source

pub fn while_( port: RRC<Port>, cond: Option<RRC<CombGroup>>, body: Box<Control>, ) -> Self

Convience constructor for while

Source

pub fn repeat(num_repeats: u64, body: Box<Control>) -> Self

Convience constructor for dynamic repeat

Source

pub fn get_attribute<A>(&self, attr: A) -> Option<u64>
where A: Into<Attribute>,

Returns the value of an attribute if present

Source

pub fn has_attribute<A>(&self, attr: A) -> bool
where A: Into<Attribute>,

Returns true if the node has a specific attribute

Source

pub fn is_static(&self) -> bool

Source

pub fn is_empty(&self) -> bool

Source

pub fn get_latency(&self) -> Option<u64>

Source

pub fn take_control(&mut self) -> Control

Replaces &mut self with an empty control statement, and returns self

Source

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 Debug for Control

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> From<&'a Control> for GenericControl<'a>

Source§

fn from(c: &'a Control) -> Self

Converts to this type from the input type.
Source§

impl From<Enable> for Control

Source§

fn from(en: Enable) -> Self

Converts to this type from the input type.
Source§

impl From<Invoke> for Control

Source§

fn from(inv: Invoke) -> Self

Converts to this type from the input type.
Source§

impl From<StaticControl> for Control

Source§

fn from(sc: StaticControl) -> Self

Converts to this type from the input type.
Source§

impl GetAttributes for Control

Source§

fn get_mut_attributes(&mut self) -> &mut Attributes

Returns a mutable Attributes instance
Source§

fn get_attributes(&self) -> &Attributes

Returns an Attributes instance
Source§

impl WithPos for Control

Source§

fn copy_span(&self) -> GPosIdx

Copy the span associated with this node.

Auto 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.