Trait libreda_db::netlist::traits::NetlistBase[][src]

pub trait NetlistBase {
    type NameType: Eq + Hash + From<String> + Into<String> + Clone + Borrow<String> + Borrow<str> + PartialOrd + Ord + Display + Debug;
    type PinId: Eq + Hash + Clone + Debug;
    type PinInstId: Eq + Hash + Clone + Debug;
    type TerminalId: Eq + Hash + Clone + Debug;
    type CircuitId: Eq + Hash + Clone + Debug;
    type CircuitInstId: Eq + Hash + Clone + Debug;
    type NetId: Eq + Hash + Clone + Debug;
    fn new() -> Self;
fn circuit_by_name<N: ?Sized + Eq + Hash>(
        &self,
        name: &N
    ) -> Option<Self::CircuitId>
    where
        Self::NameType: Borrow<N>
;
fn circuit_instance_by_name<N: ?Sized + Eq + Hash>(
        &self,
        parent_circuit: &Self::CircuitId,
        name: &N
    ) -> Option<Self::CircuitInstId>
    where
        Self::NameType: Borrow<N>
;
fn template_circuit(
        &self,
        circuit_instance: &Self::CircuitInstId
    ) -> Self::CircuitId;
fn template_pin(&self, pin_instance: &Self::PinInstId) -> Self::PinId;
fn pin_direction(&self, pin: &Self::PinId) -> Direction;
fn pin_name(&self, pin: &Self::PinId) -> Self::NameType;
fn pin_by_name<N: ?Sized + Eq + Hash>(
        &self,
        parent_circuit: &Self::CircuitId,
        name: &N
    ) -> Option<Self::PinId>
    where
        Self::NameType: Borrow<N>
;
fn parent_circuit(
        &self,
        circuit_instance: &Self::CircuitInstId
    ) -> Self::CircuitId;
fn parent_circuit_of_pin(&self, pin: &Self::PinId) -> Self::CircuitId;
fn parent_of_pin_instance(
        &self,
        pin_inst: &Self::PinInstId
    ) -> Self::CircuitInstId;
fn net_of_pin(&self, pin: &Self::PinId) -> Option<Self::NetId>;
fn net_of_pin_instance(
        &self,
        pin_instance: &Self::PinInstId
    ) -> Option<Self::NetId>;
fn net_zero(&self, parent_circuit: &Self::CircuitId) -> Self::NetId;
fn net_one(&self, parent_circuit: &Self::CircuitId) -> Self::NetId;
fn net_by_name<N: ?Sized + Eq + Hash>(
        &self,
        parent_circuit: &Self::CircuitId,
        name: &N
    ) -> Option<Self::NetId>
    where
        Self::NameType: Borrow<N>
;
fn net_name(&self, net: &Self::NetId) -> Option<Self::NameType>;
fn circuit_name(&self, circuit: &Self::CircuitId) -> Self::NameType;
fn circuit_instance_name(
        &self,
        circuit_inst: &Self::CircuitInstId
    ) -> Option<Self::NameType>;
fn for_each_circuit<F>(&self, f: F)
    where
        F: FnMut(Self::CircuitId)
;
fn for_each_instance<F>(&self, circuit: &Self::CircuitId, f: F)
    where
        F: FnMut(Self::CircuitInstId)
;
fn for_each_circuit_dependency<F>(&self, circuit: &Self::CircuitId, f: F)
    where
        F: FnMut(Self::CircuitId)
;
fn for_each_dependent_circuit<F>(&self, circuit: &Self::CircuitId, f: F)
    where
        F: FnMut(Self::CircuitId)
;
fn for_each_reference<F>(&self, circuit: &Self::CircuitId, f: F)
    where
        F: FnMut(Self::CircuitInstId)
;
fn for_each_pin<F>(&self, circuit: &Self::CircuitId, f: F)
    where
        F: FnMut(Self::PinId)
;
fn for_each_pin_instance<F>(&self, circuit_inst: &Self::CircuitInstId, f: F)
    where
        F: FnMut(Self::PinInstId)
;
fn for_each_internal_net<F>(&self, circuit: &Self::CircuitId, f: F)
    where
        F: FnMut(Self::NetId)
;
fn num_child_instances(&self, circuit: &Self::CircuitId) -> usize;
fn num_circuits(&self) -> usize;
fn num_pins(&self, circuit: &Self::CircuitId) -> usize;
fn for_each_pin_of_net<F>(&self, net: &Self::NetId, f: F)
    where
        F: FnMut(Self::PinId)
;
fn for_each_pin_instance_of_net<F>(&self, net: &Self::NetId, f: F)
    where
        F: FnMut(Self::PinInstId)
; fn each_circuit_vec(&self) -> Vec<Self::CircuitId> { ... }
fn each_circuit<'a>(
        &'a self
    ) -> Box<dyn Iterator<Item = Self::CircuitId> + 'a> { ... }
fn each_instance_vec(
        &self,
        circuit: &Self::CircuitId
    ) -> Vec<Self::CircuitInstId> { ... }
fn each_instance<'a>(
        &'a self,
        circuit: &Self::CircuitId
    ) -> Box<dyn Iterator<Item = Self::CircuitInstId> + 'a> { ... }
fn each_circuit_dependency_vec(
        &self,
        circuit: &Self::CircuitId
    ) -> Vec<Self::CircuitId> { ... }
fn each_circuit_dependency<'a>(
        &'a self,
        circuit: &Self::CircuitId
    ) -> Box<dyn Iterator<Item = Self::CircuitId> + 'a> { ... }
fn each_dependent_circuit_vec(
        &self,
        circuit: &Self::CircuitId
    ) -> Vec<Self::CircuitId> { ... }
fn each_dependent_circuit<'a>(
        &'a self,
        circuit: &Self::CircuitId
    ) -> Box<dyn Iterator<Item = Self::CircuitId> + 'a> { ... }
fn each_reference_vec(
        &self,
        circuit: &Self::CircuitId
    ) -> Vec<Self::CircuitInstId> { ... }
fn each_reference<'a>(
        &'a self,
        circuit: &Self::CircuitId
    ) -> Box<dyn Iterator<Item = Self::CircuitInstId> + 'a> { ... }
fn each_pin_vec(&self, circuit: &Self::CircuitId) -> Vec<Self::PinId> { ... }
fn each_pin<'a>(
        &'a self,
        circuit: &Self::CircuitId
    ) -> Box<dyn Iterator<Item = Self::PinId> + 'a> { ... }
fn each_pin_instance_vec(
        &self,
        circuit_instance: &Self::CircuitInstId
    ) -> Vec<Self::PinInstId> { ... }
fn each_pin_instance<'a>(
        &'a self,
        circuit_instance: &Self::CircuitInstId
    ) -> Box<dyn Iterator<Item = Self::PinInstId> + 'a> { ... }
fn each_external_net<'a>(
        &'a self,
        circuit_instance: &Self::CircuitInstId
    ) -> Box<dyn Iterator<Item = Self::NetId> + 'a> { ... }
fn each_internal_net_vec(
        &self,
        circuit: &Self::CircuitId
    ) -> Vec<Self::NetId> { ... }
fn each_internal_net<'a>(
        &'a self,
        circuit: &Self::CircuitId
    ) -> Box<dyn Iterator<Item = Self::NetId> + 'a> { ... }
fn num_net_pins(&self, net: &Self::NetId) -> usize { ... }
fn num_net_pin_instances(&self, net: &Self::NetId) -> usize { ... }
fn num_net_terminals(&self, net: &Self::NetId) -> usize { ... }
fn num_references(&self, circuit: &Self::CircuitId) -> usize { ... }
fn each_pin_of_net_vec(&self, net: &Self::NetId) -> Vec<Self::PinId> { ... }
fn each_pin_of_net<'a>(
        &'a self,
        net: &Self::NetId
    ) -> Box<dyn Iterator<Item = Self::PinId> + 'a> { ... }
fn each_pin_instance_of_net_vec(
        &self,
        net: &Self::NetId
    ) -> Vec<Self::PinInstId> { ... }
fn each_pin_instance_of_net<'a>(
        &'a self,
        net: &Self::NetId
    ) -> Box<dyn Iterator<Item = Self::PinInstId> + 'a> { ... }
fn for_each_circuit_instance_of_net<F>(&self, net: &Self::NetId, f: F)
    where
        F: FnMut(Self::CircuitInstId)
, { ... }
fn each_circuit_instance_of_net_vec(
        &self,
        net: &Self::NetId
    ) -> Vec<Self::CircuitInstId> { ... }
fn circuit(&self, id: Self::CircuitId) -> Box<dyn CircuitRef<N = Self>>
    where
        Self: Sized
, { ... }
fn circuit_inst(
        &self,
        id: Self::CircuitInstId
    ) -> Box<dyn CircuitInstRef<N = Self>>
    where
        Self: Sized
, { ... }
fn fmt(&self, f: &mut Formatter<'_>) -> Result { ... } }

Most basic trait of a netlist.

Netlist component relations

A netlist consists of circuits which are templates for circuit instances. Each circuit may contain such instances of other circuits.

The following diagram illustrates how this composition graph can be traversed using the functions defined by NetlistBase.

                         each_circuit_dependency
                     +---------------------------+
                     |                           |
                     +                           v
      +----------------+ each_dependent_circuit +------------------+
      |Circuit (Top)   |<----------------------+|Circuit (Sub)     |
      +----------------+                        +------------------+
      |+              ^|                        | ^   +            |
      ||each_instance ||                        | |   |            |
      ||              ||                        | |   |            |
      ||              |parent_circuit           | |   |            |
      ||              ||                        | |   |            |
      ||+-----------+ ||                        | |   |            |
 +--> |>|Inst1 (Sub)|-+|                        | |   |            |
 |    ||+-----------+  |                        | |   |            |
 |    ||               |                        | |   |            |
 |    ||               |                        +-|---|------------+
 |    ||               |                          |   |
 |    ||+-----------+  |  template_circuit        |   |
 +--> |>|Inst2 (Sub)|+----------------------------+   |
 |    | +-----------+  |                              |
 |    |                |                              |
 |    |                |                              |
 |    +----------------+                              |
 |                                                    |
 |                         each_reference             |
 +----------------------------------------------------+

Associated Types

type NameType: Eq + Hash + From<String> + Into<String> + Clone + Borrow<String> + Borrow<str> + PartialOrd + Ord + Display + Debug[src]

Type for names of circuits, instances, pins, etc.

type PinId: Eq + Hash + Clone + Debug[src]

Pin identifier type.

type PinInstId: Eq + Hash + Clone + Debug[src]

Pin instance identifier type. A pin instance is a pin of a circuit instance.

type TerminalId: Eq + Hash + Clone + Debug[src]

Either a pin or a pin instance ID.

type CircuitId: Eq + Hash + Clone + Debug[src]

Circuit identifier type.

type CircuitInstId: Eq + Hash + Clone + Debug[src]

Circuit instance identifier type.

type NetId: Eq + Hash + Clone + Debug[src]

Net identifier type.

Loading content...

Required methods

fn new() -> Self[src]

Create a new empty netlist.

fn circuit_by_name<N: ?Sized + Eq + Hash>(
    &self,
    name: &N
) -> Option<Self::CircuitId> where
    Self::NameType: Borrow<N>, 
[src]

Find a circuit by its name. Return the circuit with the given name. Returns None if the circuit does not exist.

fn circuit_instance_by_name<N: ?Sized + Eq + Hash>(
    &self,
    parent_circuit: &Self::CircuitId,
    name: &N
) -> Option<Self::CircuitInstId> where
    Self::NameType: Borrow<N>, 
[src]

Find a circuit instance by its name. Returns None if the name does not exist.

fn template_circuit(
    &self,
    circuit_instance: &Self::CircuitInstId
) -> Self::CircuitId
[src]

Get the ID of the template circuit of this instance.

fn template_pin(&self, pin_instance: &Self::PinInstId) -> Self::PinId[src]

Get the ID of the template pin of this pin instance.

fn pin_direction(&self, pin: &Self::PinId) -> Direction[src]

Get the signal direction of the pin.

fn pin_name(&self, pin: &Self::PinId) -> Self::NameType[src]

Get the name of the pin.

fn pin_by_name<N: ?Sized + Eq + Hash>(
    &self,
    parent_circuit: &Self::CircuitId,
    name: &N
) -> Option<Self::PinId> where
    Self::NameType: Borrow<N>, 
[src]

Find a pin by its name. Returns None if no such pin can be found.

fn parent_circuit(
    &self,
    circuit_instance: &Self::CircuitInstId
) -> Self::CircuitId
[src]

Get the ID of the parent circuit of this instance.

fn parent_circuit_of_pin(&self, pin: &Self::PinId) -> Self::CircuitId[src]

Get the ID of the parent circuit of this pin.

fn parent_of_pin_instance(
    &self,
    pin_inst: &Self::PinInstId
) -> Self::CircuitInstId
[src]

Get the ID of the circuit instance that holds this pin instance.

fn net_of_pin(&self, pin: &Self::PinId) -> Option<Self::NetId>[src]

Get the internal net attached to this pin.

fn net_of_pin_instance(
    &self,
    pin_instance: &Self::PinInstId
) -> Option<Self::NetId>
[src]

Get the external net attached to this pin instance.

fn net_zero(&self, parent_circuit: &Self::CircuitId) -> Self::NetId[src]

Get the net of the logical constant zero.

fn net_one(&self, parent_circuit: &Self::CircuitId) -> Self::NetId[src]

Get the net of the logical constant one.

fn net_by_name<N: ?Sized + Eq + Hash>(
    &self,
    parent_circuit: &Self::CircuitId,
    name: &N
) -> Option<Self::NetId> where
    Self::NameType: Borrow<N>, 
[src]

Find a net by its name inside the parent circuit. Returns None if no such net can be found.

fn net_name(&self, net: &Self::NetId) -> Option<Self::NameType>[src]

Get the name of the net.

fn circuit_name(&self, circuit: &Self::CircuitId) -> Self::NameType[src]

Get the name of the circuit.

fn circuit_instance_name(
    &self,
    circuit_inst: &Self::CircuitInstId
) -> Option<Self::NameType>
[src]

Get the name of the circuit instance.

fn for_each_circuit<F>(&self, f: F) where
    F: FnMut(Self::CircuitId), 
[src]

Call a function on each circuit of the netlist.

fn for_each_instance<F>(&self, circuit: &Self::CircuitId, f: F) where
    F: FnMut(Self::CircuitInstId), 
[src]

Call a function on each instance in this circuit.

fn for_each_circuit_dependency<F>(&self, circuit: &Self::CircuitId, f: F) where
    F: FnMut(Self::CircuitId), 
[src]

Call a function for each circuit that is a child of this circuit.

fn for_each_dependent_circuit<F>(&self, circuit: &Self::CircuitId, f: F) where
    F: FnMut(Self::CircuitId), 
[src]

Call a function for each circuit that directly depends on circuit.

fn for_each_reference<F>(&self, circuit: &Self::CircuitId, f: F) where
    F: FnMut(Self::CircuitInstId), 
[src]

Iterate over all instances of this circuit, i.e. instances that use this circuit as a template.

fn for_each_pin<F>(&self, circuit: &Self::CircuitId, f: F) where
    F: FnMut(Self::PinId), 
[src]

Call a function for each pin of the circuit.

fn for_each_pin_instance<F>(&self, circuit_inst: &Self::CircuitInstId, f: F) where
    F: FnMut(Self::PinInstId), 
[src]

Call a function for each pin instance of the circuit instance.

fn for_each_internal_net<F>(&self, circuit: &Self::CircuitId, f: F) where
    F: FnMut(Self::NetId), 
[src]

Call a function for net of the circuit.

fn num_child_instances(&self, circuit: &Self::CircuitId) -> usize[src]

Get the number of cell instances inside the circuit.

fn num_circuits(&self) -> usize[src]

Get the number of cells inside in this netlist.

fn num_pins(&self, circuit: &Self::CircuitId) -> usize[src]

Get the number of pins of a circuit.

fn for_each_pin_of_net<F>(&self, net: &Self::NetId, f: F) where
    F: FnMut(Self::PinId), 
[src]

Call a function for each pin connected to this net.

fn for_each_pin_instance_of_net<F>(&self, net: &Self::NetId, f: F) where
    F: FnMut(Self::PinInstId), 
[src]

Call a function for each pin instance connected to this net.

Loading content...

Provided methods

fn each_circuit_vec(&self) -> Vec<Self::CircuitId>[src]

Get a Vec of all circuit IDs in this netlist.

fn each_circuit<'a>(&'a self) -> Box<dyn Iterator<Item = Self::CircuitId> + 'a>[src]

Iterate over all circuits.

fn each_instance_vec(
    &self,
    circuit: &Self::CircuitId
) -> Vec<Self::CircuitInstId>
[src]

Get a Vec of the IDs of all instances in this circuit.

fn each_instance<'a>(
    &'a self,
    circuit: &Self::CircuitId
) -> Box<dyn Iterator<Item = Self::CircuitInstId> + 'a>
[src]

Iterate over all instances in a circuit.

fn each_circuit_dependency_vec(
    &self,
    circuit: &Self::CircuitId
) -> Vec<Self::CircuitId>
[src]

Get a Vec of each circuit that is a child of this circuit.

fn each_circuit_dependency<'a>(
    &'a self,
    circuit: &Self::CircuitId
) -> Box<dyn Iterator<Item = Self::CircuitId> + 'a>
[src]

Iterate over all circuits that are childs of this circuit.

fn each_dependent_circuit_vec(
    &self,
    circuit: &Self::CircuitId
) -> Vec<Self::CircuitId>
[src]

Get a Vec of each circuit that directly depends on circuit.

fn each_dependent_circuit<'a>(
    &'a self,
    circuit: &Self::CircuitId
) -> Box<dyn Iterator<Item = Self::CircuitId> + 'a>
[src]

Iterate over each circuit that directly depends on circuit.

fn each_reference_vec(
    &self,
    circuit: &Self::CircuitId
) -> Vec<Self::CircuitInstId>
[src]

Get a Vec with all circuit instances referencing this circuit.

fn each_reference<'a>(
    &'a self,
    circuit: &Self::CircuitId
) -> Box<dyn Iterator<Item = Self::CircuitInstId> + 'a>
[src]

Iterate over all instances of this circuit, i.e. instances that use this circuit as a template.

fn each_pin_vec(&self, circuit: &Self::CircuitId) -> Vec<Self::PinId>[src]

Get a Vec with the IDs of all pins of this circuit.

fn each_pin<'a>(
    &'a self,
    circuit: &Self::CircuitId
) -> Box<dyn Iterator<Item = Self::PinId> + 'a>
[src]

Iterate over all pins of a circuit.

fn each_pin_instance_vec(
    &self,
    circuit_instance: &Self::CircuitInstId
) -> Vec<Self::PinInstId>
[src]

Get a Vec with the IDs of all pin instance of this circuit instance.

fn each_pin_instance<'a>(
    &'a self,
    circuit_instance: &Self::CircuitInstId
) -> Box<dyn Iterator<Item = Self::PinInstId> + 'a>
[src]

Iterate over all pin instances of a circuit.

fn each_external_net<'a>(
    &'a self,
    circuit_instance: &Self::CircuitInstId
) -> Box<dyn Iterator<Item = Self::NetId> + 'a>
[src]

Iterate over all external nets connected to the circuit instance. A net might appear more than once.

fn each_internal_net_vec(&self, circuit: &Self::CircuitId) -> Vec<Self::NetId>[src]

Get a Vec with all nets in this circuit.

fn each_internal_net<'a>(
    &'a self,
    circuit: &Self::CircuitId
) -> Box<dyn Iterator<Item = Self::NetId> + 'a>
[src]

Iterate over all defined nets inside a circuit.

fn num_net_pins(&self, net: &Self::NetId) -> usize[src]

Get the number of pins that are connected to this net.

fn num_net_pin_instances(&self, net: &Self::NetId) -> usize[src]

Get the number of pin instances that are connected to this net.

fn num_net_terminals(&self, net: &Self::NetId) -> usize[src]

Get the number of terminals that are connected to this net.

fn num_references(&self, circuit: &Self::CircuitId) -> usize[src]

Get the number of references that point to this circuit, i.e. the number of instances of this circuit.

fn each_pin_of_net_vec(&self, net: &Self::NetId) -> Vec<Self::PinId>[src]

Get a Vec with all pin IDs connected to this net.

fn each_pin_of_net<'a>(
    &'a self,
    net: &Self::NetId
) -> Box<dyn Iterator<Item = Self::PinId> + 'a>
[src]

Iterate over all pins of a net.

fn each_pin_instance_of_net_vec(
    &self,
    net: &Self::NetId
) -> Vec<Self::PinInstId>
[src]

Get a Vec with all pin instance IDs connected to this net.

fn each_pin_instance_of_net<'a>(
    &'a self,
    net: &Self::NetId
) -> Box<dyn Iterator<Item = Self::PinInstId> + 'a>
[src]

Iterate over all pins of a net.

fn for_each_circuit_instance_of_net<F>(&self, net: &Self::NetId, f: F) where
    F: FnMut(Self::CircuitInstId), 
[src]

Visit all circuit instances connected to this net. An instance is touched not more than once.

fn each_circuit_instance_of_net_vec(
    &self,
    net: &Self::NetId
) -> Vec<Self::CircuitInstId>
[src]

Iterate over all circuit instances connected to this net. An instance is touched not more than once.

fn circuit(&self, id: Self::CircuitId) -> Box<dyn CircuitRef<N = Self>> where
    Self: Sized
[src]

Return a reference to the circuit with this ID.

fn circuit_inst(
    &self,
    id: Self::CircuitInstId
) -> Box<dyn CircuitInstRef<N = Self>> where
    Self: Sized
[src]

Return a reference to the circuit instance with this ID.

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Write the netlist in a human readable form.

Loading content...

Implementors

impl NetlistBase for HashMapNetlist[src]

type NameType = RcString

type PinId = PinId

type PinInstId = PinInstId

type TerminalId = TerminalId

type CircuitId = CircuitId

type CircuitInstId = CircuitInstId

type NetId = NetId

fn new() -> Self[src]

Create an empty netlist.

fn circuit_by_name<S: ?Sized + Eq + Hash>(&self, name: &S) -> Option<CircuitId> where
    Self::NameType: Borrow<S>, 
[src]

Find a circuit by its name.

fn net_of_pin(&self, pin: &Self::PinId) -> Option<Self::NetId>[src]

Get the net connected to this pin.

fn net_of_pin_instance(&self, pin_inst: &Self::PinInstId) -> Option<Self::NetId>[src]

Get the net connected to this pin instance.

fn each_circuit(&self) -> Box<dyn Iterator<Item = CircuitId>>[src]

Iterate over all circuits.

fn each_pin(&self, circuit_id: &CircuitId) -> Box<dyn Iterator<Item = PinId>>[src]

Iterate over all pins of a circuit.

impl NetlistBase for RcNetlist[src]

type NameType = String

type PinId = Rc<Pin>

type PinInstId = Rc<PinInstance>

type TerminalId = ()

type CircuitId = Rc<Circuit>

type CircuitInstId = Rc<CircuitInstance>

type NetId = Rc<Net>

fn each_pin_vec(&self, circuit: &Self::CircuitId) -> Vec<Self::PinId>[src]

Get a Vec with the IDs of all pins of this circuit.

fn each_pin_instance_vec(
    &self,
    circuit_instance: &Self::CircuitInstId
) -> Vec<Self::PinInstId>
[src]

Get a Vec with the IDs of all pin instance of this circuit instance.

Loading content...