Instantiable

Trait Instantiable 

Source
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§

Source

fn get_name(&self) -> &Identifier

Returns the name of the primitive

Source

fn get_input_ports(&self) -> impl IntoIterator<Item = &Net>

Returns the input ports of the primitive

Source

fn get_output_ports(&self) -> impl IntoIterator<Item = &Net>

Returns the output ports of the primitive

Source

fn has_parameter(&self, id: &Identifier) -> bool

Returns true if the type intakes a parameter with this name.

Source

fn get_parameter(&self, id: &Identifier) -> Option<Parameter>

Returns the parameter value for the given key, if it exists.

Source

fn set_parameter( &mut self, id: &Identifier, val: Parameter, ) -> Option<Parameter>

Returns the old parameter value for the given key, if it existed.

Source

fn parameters(&self) -> impl Iterator<Item = (Identifier, Parameter)>

Returns an iterator over the parameters of the primitive.

Source

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.

Source

fn get_constant(&self) -> Option<Logic>

Returns the constant value represented by this primitive, if it is constant.

Source

fn is_seq(&self) -> bool

Returns ‘true’ if the primitive is sequential.

Provided Methods§

Source

fn is_parameterized(&self) -> bool

Returns true if the primitive is parameterized (has at least one parameter).

Source

fn get_single_output_port(&self) -> &Net

Returns the single output port of the primitive.

Source

fn get_output_port(&self, index: usize) -> &Net

Returns the output port at the given index.

§Panics

If the index is out of bounds.

Source

fn get_input_port(&self, index: usize) -> &Net

Returns the input port at the given index.

§Panics

If the index is out of bounds.

Source

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.

Source

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.

Source

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.

Implementors§