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 find<S>(&self, name: S) -> Option<RRC<Port>>where
S: Display + Clone,
Id: PartialEq<S>,
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.
sourcepub fn find_with_attr<A>(&self, attr: A) -> Option<RRC<Port>>where
A: Into<Attribute>,
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
.
sourcepub fn find_all_with_attr<A>(
&self,
attr: A
) -> impl Iterator<Item = RRC<Port>> + '_where
A: Into<Attribute>,
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
.
sourcepub fn get<S>(&self, name: S) -> RRC<Port>where
S: Display + Clone,
Id: PartialEq<S>,
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.
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>) -> boolwhere
Id: PartialEq<S>,
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.
sourcepub fn get_with_attr<A>(&self, attr: A) -> RRC<Port>where
A: Into<Attribute> + Display + Copy,
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.
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>where
Id: PartialEq<S>,
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.
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
instance