Trait libreda_db::traits::HierarchyEdit[][src]

pub trait HierarchyEdit: HierarchyBase {
    fn new() -> Self;
fn create_cell(&mut self, name: Self::NameType) -> Self::CellId;
fn remove_cell(&mut self, cell_id: &Self::CellId);
fn create_cell_instance(
        &mut self,
        parent_cell: &Self::CellId,
        template_cell: &Self::CellId,
        name: Option<Self::NameType>
    ) -> Self::CellInstId;
fn remove_cell_instance(&mut self, inst: &Self::CellInstId);
fn rename_cell_instance(
        &mut self,
        inst: &Self::CellInstId,
        new_name: Option<Self::NameType>
    );
fn rename_cell(&mut self, cell: &Self::CellId, new_name: Self::NameType); fn set_chip_property(&mut self, key: Self::NameType, value: PropertyValue) { ... }
fn set_cell_property(
        &mut self,
        cell: &Self::CellId,
        key: Self::NameType,
        value: PropertyValue
    ) { ... }
fn set_cell_instance_property(
        &mut self,
        inst: &Self::CellInstId,
        key: Self::NameType,
        value: PropertyValue
    ) { ... } }
Expand description

Edit functions for a hierarchical flyweight structure like a netlist or a cell-based layout.

Required methods

Create a new empty data structure.

Create a new and empty cell template. A cell template can be be instantiated in other cells.

Example

use libreda_db::prelude::*;
let mut chip = Chip::new();
let my_cell = chip.create_cell("myCell".into());

assert_eq!(chip.num_cells(), 1);
assert_eq!(chip.cell_by_name("myCell"), Some(my_cell));

Remove a cell and all the instances of it.

Example

use libreda_db::prelude::*;
let mut chip = Chip::new();
let top = chip.create_cell("TOP".into());
assert_eq!(chip.num_cells(), 1);
chip.remove_cell(&top);
assert_eq!(chip.num_cells(), 0);

Create a new instance of template_cell in parent_cell. Recursive instantiation is forbidden and might panic.

Example

use libreda_db::prelude::*;
let mut chip = Chip::new();
let top = chip.create_cell("TOP".into());
let sub = chip.create_cell("SUB".into());

// Create two instances of "SUB" inside "TOP".
let inst1 = chip.create_cell_instance(&top, &sub, Some("sub1".into())); // Create named instance.
let inst2 = chip.create_cell_instance(&top, &sub, None); // Create unnamed instance.

assert_eq!(chip.num_child_instances(&top), 2);
assert_eq!(chip.num_cell_references(&sub), 2);

Remove cell instance if it exists.

Example

use libreda_db::prelude::*;
let mut chip = Chip::new();
let top = chip.create_cell("TOP".into());
let sub = chip.create_cell("SUB".into());

// Create two instances of "SUB" inside "TOP".
let inst1 = chip.create_cell_instance(&top, &sub, Some("sub1".into())); // Create named instance.
let inst2 = chip.create_cell_instance(&top, &sub, None); // Create unnamed instance.

assert_eq!(chip.num_child_instances(&top), 2);
assert_eq!(chip.num_cell_references(&sub), 2);

chip.remove_cell_instance(&inst2);

assert_eq!(chip.num_child_instances(&top), 1);
assert_eq!(chip.num_cell_references(&sub), 1);

Change the name of a cell instance.

Clears the name when None is passed.

Panics

Panics if an instance with this name already exists in the parent cell.

Change the name of a cell.

Panics

Panics if a cell with this name already exists.

Provided methods

Set a property of the top-level chip data structure..

Set a property of a cell.

Set a property of a cell instance.

Implementors