pub trait Instantiable: Clone {
Show 17 methods
// Required methods
fn get_name(&self) -> &Identifier;
fn get_input_ports(&self) -> impl IntoIterator<Item = &Net>;
fn get_output_ports(&self) -> impl IntoIterator<Item = &Net>;
fn has_parameter(&self, id: &Identifier) -> bool;
fn get_parameter(&self, id: &Identifier) -> Option<Parameter>;
fn set_parameter(
&mut self,
id: &Identifier,
val: Parameter,
) -> Option<Parameter>;
fn parameters(&self) -> impl Iterator<Item = (Identifier, Parameter)>;
fn from_constant(val: Logic) -> Option<Self>;
fn get_constant(&self) -> Option<Logic>;
fn is_seq(&self) -> bool;
// Provided methods
fn is_parameterized(&self) -> bool { ... }
fn get_single_output_port(&self) -> &Net { ... }
fn get_output_port(&self, index: usize) -> &Net { ... }
fn get_input_port(&self, index: usize) -> &Net { ... }
fn find_input(&self, id: &Identifier) -> Option<usize> { ... }
fn find_output(&self, id: &Identifier) -> Option<usize> { ... }
fn is_driverless(&self) -> bool { ... }
}Expand description
A trait for primitives in a digital circuit, such as gates or other components.
Required Methods§
Sourcefn get_name(&self) -> &Identifier
fn get_name(&self) -> &Identifier
Returns the name of the primitive
Sourcefn get_input_ports(&self) -> impl IntoIterator<Item = &Net>
fn get_input_ports(&self) -> impl IntoIterator<Item = &Net>
Returns the input ports of the primitive
Sourcefn get_output_ports(&self) -> impl IntoIterator<Item = &Net>
fn get_output_ports(&self) -> impl IntoIterator<Item = &Net>
Returns the output ports of the primitive
Sourcefn has_parameter(&self, id: &Identifier) -> bool
fn has_parameter(&self, id: &Identifier) -> bool
Returns true if the type intakes a parameter with this name.
Sourcefn get_parameter(&self, id: &Identifier) -> Option<Parameter>
fn get_parameter(&self, id: &Identifier) -> Option<Parameter>
Returns the parameter value for the given key, if it exists.
Sourcefn set_parameter(
&mut self,
id: &Identifier,
val: Parameter,
) -> Option<Parameter>
fn set_parameter( &mut self, id: &Identifier, val: Parameter, ) -> Option<Parameter>
Returns the old parameter value for the given key, if it existed.
Sourcefn parameters(&self) -> impl Iterator<Item = (Identifier, Parameter)>
fn parameters(&self) -> impl Iterator<Item = (Identifier, Parameter)>
Returns an iterator over the parameters of the primitive.
Sourcefn from_constant(val: Logic) -> Option<Self>
fn from_constant(val: Logic) -> Option<Self>
Creates the primitive used to represent a constant value, like VDD or GND.
If the implementer does not support the specific constant, None is returned.
Sourcefn get_constant(&self) -> Option<Logic>
fn get_constant(&self) -> Option<Logic>
Returns the constant value represented by this primitive, if it is constant.
Provided Methods§
Sourcefn is_parameterized(&self) -> bool
fn is_parameterized(&self) -> bool
Returns true if the primitive is parameterized (has at least one parameter).
Sourcefn get_single_output_port(&self) -> &Net
fn get_single_output_port(&self) -> &Net
Returns the single output port of the primitive.
Sourcefn get_output_port(&self, index: usize) -> &Net
fn get_output_port(&self, index: usize) -> &Net
Sourcefn get_input_port(&self, index: usize) -> &Net
fn get_input_port(&self, index: usize) -> &Net
Sourcefn find_input(&self, id: &Identifier) -> Option<usize>
fn find_input(&self, id: &Identifier) -> Option<usize>
Returns the index of the input port with the given identifier, if it exists. This method should be overriden if the implemenation is capable of O(1) lookup.
Sourcefn find_output(&self, id: &Identifier) -> Option<usize>
fn find_output(&self, id: &Identifier) -> Option<usize>
Returns the index of the output port with the given identifier, if it exists. This method should be overriden if the implemenation is capable of O(1) lookup.
Sourcefn is_driverless(&self) -> bool
fn is_driverless(&self) -> bool
Returns true if the primitive has no input ports. In most cases, this means the cell represents a constant.
This method should be overriden if the implemenation of get_input_ports() is expensive.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.