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
impl Cell
Sourcepub fn is_reference(&self) -> bool
pub fn is_reference(&self) -> bool
Get a boolean describing whether the cell is external.
Sourcepub fn set_reference(&mut self, reference: bool) -> bool
pub fn set_reference(&mut self, reference: bool) -> bool
Set the external field
Sourcepub fn find<S>(&self, name: S) -> Option<RRC<Port>>
pub fn find<S>(&self, name: S) -> Option<RRC<Port>>
Get a reference to the named port if it exists.
Sourcepub fn find_all_with_attr<A>(
&self,
attr: A,
) -> impl Iterator<Item = RRC<Port>> + '_
pub fn find_all_with_attr<A>( &self, attr: A, ) -> impl Iterator<Item = RRC<Port>> + '_
Return all ports that have the attribute attr
.
Sourcepub fn find_unique_with_attr<A>(
&self,
attr: A,
) -> CalyxResult<Option<RRC<Port>>>
pub fn find_unique_with_attr<A>( &self, attr: A, ) -> CalyxResult<Option<RRC<Port>>>
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.
Sourcepub fn get<S>(&self, name: S) -> RRC<Port>
pub fn get<S>(&self, name: S) -> RRC<Port>
Get a reference to the named port and throw an error if it doesn’t exist.
Sourcepub fn is_component(&self) -> bool
pub fn is_component(&self) -> bool
Returns true iff this cell is an instance of a Calyx-defined component.
Sourcepub fn is_this(&self) -> bool
pub fn is_this(&self) -> bool
Returns true iff this cell is the signature of the current component
Sourcepub fn is_primitive<S>(&self, prim: Option<S>) -> bool
pub fn is_primitive<S>(&self, prim: Option<S>) -> bool
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.
Sourcepub fn get_unique_with_attr<A>(&self, attr: A) -> CalyxResult<RRC<Port>>
pub fn get_unique_with_attr<A>(&self, attr: A) -> CalyxResult<RRC<Port>>
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.
Sourcepub fn type_name(&self) -> Option<Id>
pub fn type_name(&self) -> Option<Id>
Returns the name of the component that is this cells type.
Sourcepub fn get_parameter<S>(&self, param: S) -> Option<u64>
pub fn get_parameter<S>(&self, param: S) -> Option<u64>
Get parameter binding from the prototype used to build this cell.
Sourcepub fn constant_name(val: u64, width: u64) -> Id
pub fn constant_name(val: u64, width: u64) -> Id
Return the canonical name for the cell generated to represent this (val, width) constant.
Sourcepub fn get_attribute<A: Into<Attribute>>(&self, attr: A) -> Option<u64>
pub fn get_attribute<A: Into<Attribute>>(&self, attr: A) -> Option<u64>
Return the value associated with this attribute key.
Sourcepub fn add_attribute<A: Into<Attribute>>(&mut self, attr: A, value: u64)
pub fn add_attribute<A: Into<Attribute>>(&mut self, attr: A, value: u64)
Add a new attribute to the group.
Sourcepub fn ports(&self) -> &SmallVec<[RRC<Port>; 10]>
pub fn ports(&self) -> &SmallVec<[RRC<Port>; 10]>
Returns a reference to all super::Port attached to this cells.
pub fn get_signature(&self) -> Vec<PortDef<u64>>
pub fn is_comb_cell(&self) -> bool
Trait Implementations§
Source§impl GetAttributes for Cell
impl GetAttributes for Cell
Source§fn get_attributes(&self) -> &Attributes
fn get_attributes(&self) -> &Attributes
Attributes
instanceSource§fn get_mut_attributes(&mut self) -> &mut Attributes
fn get_mut_attributes(&mut self) -> &mut Attributes
Attributes
instanceAuto 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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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