calyx_ir

Struct Cell

Source
pub struct Cell {
    pub ports: SmallVec<[RRC<Port>; 10]>,
    pub prototype: CellType,
    pub attributes: Attributes,
    /* private fields */
}
Expand description

Represents an instantiated cell.

Fields§

§ports: SmallVec<[RRC<Port>; 10]>

Ports on this cell

§prototype: CellType

Underlying type for this cell

§attributes: Attributes

Attributes for this group.

Implementations§

Source§

impl Cell

Source

pub fn new(name: Id, prototype: CellType) -> Self

Construct a cell

Source

pub fn is_reference(&self) -> bool

Get a boolean describing whether the cell is external.

Source

pub fn set_reference(&mut self, reference: bool) -> bool

Set the external field

Source

pub fn find<S>(&self, name: S) -> Option<RRC<Port>>
where S: Display + Clone, Id: PartialEq<S>,

Get a reference to the named port if it exists.

Source

pub fn find_all_with_attr<A>( &self, attr: A, ) -> impl Iterator<Item = RRC<Port>> + '_
where A: Into<Attribute>,

Return all ports that have the attribute attr.

Source

pub fn find_unique_with_attr<A>( &self, attr: A, ) -> CalyxResult<Option<RRC<Port>>>
where A: Into<Attribute>,

Return the unique port with the given attribute. If multiple ports have the same attribute, then we panic. If there are not ports with the give attribute, then we return None.

Source

pub fn get<S>(&self, name: S) -> RRC<Port>
where S: Display + Clone, Id: PartialEq<S>,

Get a reference to the named port and throw an error if it doesn’t exist.

Source

pub fn is_component(&self) -> bool

Returns true iff this cell is an instance of a Calyx-defined component.

Source

pub fn is_this(&self) -> bool

Returns true iff this cell is the signature of the current component

Source

pub fn is_primitive<S>(&self, prim: Option<S>) -> bool
where Id: PartialEq<S>,

Returns true if this is an instance of a primitive. If the optional name is provided then only returns true if the primitive has the given name.

Source

pub fn get_unique_with_attr<A>(&self, attr: A) -> CalyxResult<RRC<Port>>
where A: Into<Attribute> + Display + Copy,

Get the unique port with the given attribute. Panic if no port with the attribute is found and returns an error if multiple ports with the attribute are found.

Source

pub fn type_name(&self) -> Option<Id>

Returns the name of the component that is this cells type.

Source

pub fn get_parameter<S>(&self, param: S) -> Option<u64>
where Id: PartialEq<S>,

Get parameter binding from the prototype used to build this cell.

Source

pub fn constant_name(val: u64, width: u64) -> Id

Return the canonical name for the cell generated to represent this (val, width) constant.

Source

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

Return the value associated with this attribute key.

Source

pub fn add_attribute<A: Into<Attribute>>(&mut self, attr: A, value: u64)

Add a new attribute to the group.

Source

pub fn name(&self) -> Id

Grants immutable access to the name of this cell.

Source

pub fn ports(&self) -> &SmallVec<[RRC<Port>; 10]>

Returns a reference to all super::Port attached to this cells.

Source

pub fn get_signature(&self) -> Vec<PortDef<u64>>

Source

pub fn is_comb_cell(&self) -> bool

Trait Implementations§

Source§

impl Clone for Cell

Source§

fn clone(&self) -> Cell

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Cell

Source§

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

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

impl GetAttributes for Cell

Source§

fn get_attributes(&self) -> &Attributes

Returns an Attributes instance
Source§

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

Returns a mutable Attributes instance
Source§

impl GetName for Cell

Source§

fn name(&self) -> Id

Return a reference to the object’s name

Auto Trait Implementations§

§

impl Freeze for Cell

§

impl !RefUnwindSafe for Cell

§

impl !Send for Cell

§

impl !Sync for Cell

§

impl Unpin for Cell

§

impl !UnwindSafe for Cell

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.