Struct libreda_pnr::db::Circuit [−][src]
Copied from KLayout: Circuits are the basic building blocks of the netlist. A circuit has pins by which it can connect to the outside. Pins are created using create_pin and are represented by the Pin class.
Implementations
impl Circuit
[src]
pub fn name(&self) -> &String
[src]
Get the name of this circuit.
pub fn connect_pin_by_id(
&self,
pin_id: usize,
net: Option<Rc<Net>>
) -> Option<Rc<Net>>
[src]
&self,
pin_id: usize,
net: Option<Rc<Net>>
) -> Option<Rc<Net>>
Connects pin with the given internal net.
Returns the previously connected net.
Panics
Panics if the pin with this ID does not exist.
pub fn connect_pin(
&self,
pin: &Rc<Pin>,
net: Option<Rc<Net>>
) -> Option<Rc<Net>>
[src]
&self,
pin: &Rc<Pin>,
net: Option<Rc<Net>>
) -> Option<Rc<Net>>
Connects pin with the given internal net.
Returns the previously connected net.
Panics
Panics if the pin does not live in this circuit.
pub fn net_zero(&self) -> Rc<Net>
[src]
Get the net of the logical constant zero.
pub fn net_one(&self) -> Rc<Net>
[src]
Get the net of the logical constant one.
pub fn create_net<S>(&self, name: Option<S>) -> Rc<Net> where
S: Into<String>,
[src]
S: Into<String>,
Create a named or anonymous net.
pub fn each_circuit_dependency(&self) -> impl Iterator<Item = Rc<Circuit>>
[src]
Get all circuits (not instances) that are direct children of this circuit.
pub fn each_dependent_circuit(&self) -> impl Iterator<Item = Rc<Circuit>>
[src]
Get all circuits that directly depend on this circuit, i.e. have an instance of this circuit as a direct child.
pub fn create_circuit_instance<S>(
&self,
template_circuit: &Rc<Circuit>,
name: Option<S>
) -> Rc<CircuitInstance> where
S: Into<String>,
[src]
&self,
template_circuit: &Rc<Circuit>,
name: Option<S>
) -> Rc<CircuitInstance> where
S: Into<String>,
pub fn disconnect_pin_by_id(&self, pin_id: usize)
[src]
pub fn disconnect_pin(&self, pin: &Rc<Pin>)
[src]
pub fn for_each_child_recursive<F>(&self, f: F) where
F: Fn(&Rc<CircuitInstance>),
[src]
F: Fn(&Rc<CircuitInstance>),
Call a closure for each child recursively.
pub fn each_child_recursive(&self) -> impl Iterator<Item = Rc<CircuitInstance>>
[src]
Iterate recursively over all child circuit instances. TODO: This does not work as intended yet. Create test cases.
pub fn num_instances(&self) -> usize
[src]
Get the number of circuit instances that live in this circuit.
pub fn instances(
&self
) -> impl Deref<Target = HashMap<Index<CircuitInstance>, Rc<CircuitInstance>, RandomState>>
[src]
&self
) -> impl Deref<Target = HashMap<Index<CircuitInstance>, Rc<CircuitInstance>, RandomState>>
Borrow a reference to the instance hash map.
pub fn each_instance(&self) -> impl Iterator<Item = Rc<CircuitInstance>>
[src]
Iterate over all sub circuit instances that live in this circuit.
Hint: with_instance_iter()
might be more performant.
pub fn with_instance_iter<F, R>(&self, f: F) -> R where
F: FnOnce(Values<'_, Index<CircuitInstance>, Rc<CircuitInstance>>) -> R,
[src]
F: FnOnce(Values<'_, Index<CircuitInstance>, Rc<CircuitInstance>>) -> R,
Iterate over all instances.
pub fn references(
&self
) -> impl Deref<Target = HashSet<Rc<CircuitInstance>, RandomState>>
[src]
&self
) -> impl Deref<Target = HashSet<Rc<CircuitInstance>, RandomState>>
Borrow a reference to the reference hash map.
pub fn num_references(&self) -> usize
[src]
Get the number of circuit instances that reference this circuit.
pub fn has_references(&self) -> bool
[src]
Test if the circuit has references.
pub fn each_reference(&self) -> impl Iterator<Item = Rc<CircuitInstance>>
[src]
Iterate over all circuit instances that reference this circuit.
pub fn with_reference_iter<F, R>(&self, f: F) -> R where
F: FnOnce(Iter<'_, Rc<CircuitInstance>>) -> R,
[src]
F: FnOnce(Iter<'_, Rc<CircuitInstance>>) -> R,
Iterate over all circuit instances that reference this circuit.
pub fn nets(
&self
) -> impl Deref<Target = HashMap<Index<Net>, Rc<Net>, RandomState>>
[src]
&self
) -> impl Deref<Target = HashMap<Index<Net>, Rc<Net>, RandomState>>
Borrow a reference to the net hash map.
pub fn num_nets(&self) -> usize
[src]
Get the number of internal nets in this cell.
pub fn each_net(&self) -> impl Iterator<Item = Rc<Net>>
[src]
Iterate over all internal nets of this cell.
Hint: with_net_iter()
might be more performant.
pub fn with_net_iter<F, R>(&self, f: F) -> R where
F: FnOnce(Values<'_, Index<Net>, Rc<Net>>) -> R,
[src]
F: FnOnce(Values<'_, Index<Net>, Rc<Net>>) -> R,
Iterate over all internal nets of this cell.
pub fn each_pin(&self) -> impl ExactSizeIterator + Iterator<Item = &Rc<Pin>>
[src]
Iterate over all pins.
pub fn each_pin_vec(&self) -> Vec<Rc<Pin>, Global>
[src]
Get a Vec
with all pins.
pub fn flatten_circuit_instance(&self, circuit_instance: &Rc<CircuitInstance>)
[src]
Replace the circuit instance with its contents. Remove the circuit instance afterwards. Does not purge nets nor unconnected instances. So there could be unconnected nets or unconnected instances.
Nets keep their names if possible. If the net name already exists in this circuit, the name will
be set to None
.
The content of the circuit instance will be renamed by appending the names like a path.
pub fn id(&self) -> Index<Circuit>
[src]
Get the ID of this circuit. The ID uniquely identifies a circuit within the netlist.
pub fn contains_instance(&self, circuit_instance: &Rc<CircuitInstance>) -> bool
[src]
Check if the instance is a child of this cell.
pub fn net_count(&self) -> usize
[src]
Return the number of defined nets in this circuit. This also includes unconnected nets.
pub fn net_by_index(&self, index: &Index<Net>) -> Option<Rc<Net>>
[src]
Get a net by its index.
Returns None
if there is no net with this index.
pub fn net_index_by_name<S>(&self, name: &S) -> Option<Index<Net>> where
S: Hash + Eq + ?Sized,
String: Borrow<S>,
[src]
S: Hash + Eq + ?Sized,
String: Borrow<S>,
Get a net by its name.
Returns None
if there is no net with this name.
pub fn net_by_name<S>(&self, name: &S) -> Option<Rc<Net>> where
S: Hash + Eq + ?Sized,
String: Borrow<S>,
[src]
S: Hash + Eq + ?Sized,
String: Borrow<S>,
Find net by its name. Returns None
if the net name does not exist.
pub fn net_for_pin(&self, pin_id: usize) -> Option<Rc<Net>>
[src]
pub fn pin_by_id(&self, pin_id: usize) -> Option<Rc<Pin>>
[src]
Get a pin by its ID.
Returns None
if the ID does not exist.
pub fn pin_by_name<N>(&self, pin_name: &N) -> Option<Rc<Pin>> where
N: Eq + Hash + ?Sized,
String: Borrow<N>,
[src]
N: Eq + Hash + ?Sized,
String: Borrow<N>,
Find a pin by its name.
Returns None
if the name is not found.
pub fn pin_count(&self) -> usize
[src]
Get the number of pins.
pub fn purge_nets(&self) -> usize
[src]
Remove all floating nets (nets that are not connected to any pin). Returns the number of purged nets.
pub fn remove_net(&self, net: &Rc<Net>)
[src]
Remove the given net from this circuit and disconnect every pin connected to this net.
pub fn replace_net(&self, old_net: &Rc<Net>, new_net: &Rc<Net>)
[src]
Take all terminals that are connected to old_net
and connect them to new_net
instead.
The old net is no longer used and removed.
pub fn remove_circuit_instance(&self, circuit_instance: &Rc<CircuitInstance>)
[src]
Remove the given sub circuit instance from this circuit.
Panics
Panics if the circuit instance does not live in this circuit. TODO: Return an Err and let the user decide how to handle the error.
pub fn circuit_instance_by_id(
&self,
id: &Index<CircuitInstance>
) -> Option<Rc<CircuitInstance>>
[src]
&self,
id: &Index<CircuitInstance>
) -> Option<Rc<CircuitInstance>>
Gets a reference to the sub circuit with the given index.
Returns None
if there is no sub circuit with this index.
pub fn circuit_instance_by_name<S>(
&self,
name: &S
) -> Option<Rc<CircuitInstance>> where
S: Hash + Eq + ?Sized,
String: Borrow<S>,
[src]
&self,
name: &S
) -> Option<Rc<CircuitInstance>> where
S: Hash + Eq + ?Sized,
String: Borrow<S>,
Gets a reference to the sub circuit with the given name.
Returns None
if there is no sub circuit with this name.
Trait Implementations
impl Debug for Circuit
[src]
impl Display for Circuit
[src]
impl Eq for Circuit
[src]
impl Hash for Circuit
[src]
pub fn hash<H>(&self, state: &mut H) where
H: Hasher,
[src]
H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Circuit> for Circuit
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Circuit
impl !Send for Circuit
impl !Sync for Circuit
impl Unpin for Circuit
impl !UnwindSafe for Circuit
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,