calyx_ir

Struct Component

Source
pub struct Component {
    pub name: Id,
    pub signature: RRC<Cell>,
    pub cells: IdList<Cell>,
    pub groups: IdList<Group>,
    pub static_groups: IdList<StaticGroup>,
    pub comb_groups: IdList<CombGroup>,
    pub continuous_assignments: Vec<Assignment<Nothing>>,
    pub control: RRC<Control>,
    pub attributes: Attributes,
    pub is_comb: bool,
    pub latency: Option<NonZeroU64>,
    /* private fields */
}
Expand description

In memory representation of a Component.

Fields§

§name: Id

Name of the component.

§signature: RRC<Cell>

The input/output signature of this component.

§cells: IdList<Cell>

The cells instantiated for this component.

§groups: IdList<Group>

Groups of assignment wires.

§static_groups: IdList<StaticGroup>

Groups of assignment wires

§comb_groups: IdList<CombGroup>

Groups of assignment wires.

§continuous_assignments: Vec<Assignment<Nothing>>

The set of “continuous assignments”, i.e., assignments that are always active.

§control: RRC<Control>

The control program for this component.

§attributes: Attributes

Attributes for this component

§is_comb: bool

True iff component is combinational

§latency: Option<NonZeroU64>

(Optional) latency of component, if it is static

Implementations§

Source§

impl Component

Builder methods for extracting and construction IR nodes. The naming scheme for methods is consistent:

  • find_: Returns a reference to the construct with the given name.
Source

pub fn new<S>( name: S, ports: Vec<PortDef<u64>>, has_interface: bool, is_comb: bool, latency: Option<NonZeroU64>, ) -> Self
where S: Into<Id>,

Construct a new Component with the given name and ports.

  • If has_interface is true, then we do not add @go and @done ports. This will usually happen with the component is marked with [super::BoolAttr::Nointerface].
  • If is_comb is set, then this is a combinational component and cannot use group or control constructs.
  • If latency is set, then this is a static component with the given latency. A combinational component cannot have a latency.
Source

pub fn get_groups(&self) -> &IdList<Group>

gets the component’s groups

Source

pub fn get_static_groups(&self) -> &IdList<StaticGroup>

gets the component’s static groups

Source

pub fn get_groups_mut(&mut self) -> &mut IdList<Group>

gets the component’s groups

Source

pub fn get_static_groups_mut(&mut self) -> &mut IdList<StaticGroup>

gets the component’s groups

Source

pub fn set_groups(&mut self, groups: IdList<Group>)

gets the component’s groups

Source

pub fn set_static_groups(&mut self, static_groups: IdList<StaticGroup>)

gets the component’s groups

Source

pub fn find_group<S>(&self, name: S) -> Option<RRC<Group>>
where S: Into<Id>,

Return a reference to the group with name if present.

Source

pub fn find_static_group<S>(&self, name: S) -> Option<RRC<StaticGroup>>
where S: Into<Id>,

Return a reference to the group with name if present.

Source

pub fn find_comb_group<S>(&self, name: S) -> Option<RRC<CombGroup>>
where S: Into<Id>,

Return a refernece to a combination group with name if present.

Source

pub fn find_cell<S>(&self, name: S) -> Option<RRC<Cell>>
where S: Into<Id>,

Return a reference to the cell with name if present.

Source

pub fn find_guaranteed_cell<S>(&self, name: S) -> RRC<Cell>
where S: Into<Id> + Debug + Copy,

Return a reference to the cell with name if present.

Source

pub fn generate_name<S>(&mut self, prefix: S) -> Id
where S: Into<Id>,

Construct a non-conflicting name using the Component’s namegenerator.

Source

pub fn is_structural(&self) -> bool

Check whether this component is purely structural, i.e. has no groups or control

Source

pub fn is_static(&self) -> bool

Check whether this is a static component. A static component is a component which has a latency field.

Source

pub fn for_each_static_assignment<F>(&mut self, f: F)
where F: FnMut(&mut Assignment<StaticTiming>),

Apply function to all assignments within static groups.

Source

pub fn for_each_assignment<F>(&mut self, f: F)
where F: FnMut(&mut Assignment<Nothing>),

Apply function on all non-static assignments contained within the component.

Source

pub fn iter_assignments<F>(&self, f: F)
where F: FnMut(&Assignment<Nothing>),

Iterate over all non-static assignments contained within the component.

Source

pub fn iter_static_assignments<F>(&self, f: F)

Iterate over all static assignments contained within the component

Trait Implementations§

Source§

impl Debug for Component

Source§

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

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

impl GetMemInfo for Component

Auto Trait Implementations§

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.