Struct calyx_ir::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 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_with_attr<A>(&self, attr: A) -> Option<RRC<Port>>where A: Into<Attribute>,

Get a reference to the first port that has the attribute attr.

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 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>) -> boolwhere 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_with_attr<A>(&self, attr: A) -> RRC<Port>where A: Into<Attribute> + Display + Copy,

Get a reference to the first port with the attribute attr and throw an error if none exist.

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 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 !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 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.