Struct calyx_ir::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>>, is_comb: bool, latency: Option<NonZeroU64> ) -> Selfwhere S: Into<Id>,

Construct a new Component with the given name and signature fields.

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 generate_name<S>(&mut self, prefix: S) -> Idwhere S: Into<Id>,

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

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)where F: FnMut(&Assignment<StaticTiming>),

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

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.