Trait libreda_db::hierarchy::traits::HierarchyEdit

source ·
pub trait HierarchyEdit: HierarchyBase {
    // Required methods
    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);

    // Provided methods
    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§

source

fn create_cell(&mut self, name: Self::NameType) -> Self::CellId

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));
source

fn remove_cell(&mut self, cell_id: &Self::CellId)

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);
source

fn create_cell_instance( &mut self, parent_cell: &Self::CellId, template_cell: &Self::CellId, name: Option<Self::NameType> ) -> Self::CellInstId

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);
source

fn remove_cell_instance(&mut self, inst: &Self::CellInstId)

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);
source

fn rename_cell_instance( &mut self, inst: &Self::CellInstId, new_name: Option<Self::NameType> )

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.

source

fn rename_cell(&mut self, cell: &Self::CellId, new_name: Self::NameType)

Change the name of a cell.

§Panics

Panics if a cell with this name already exists.

Provided Methods§

source

fn set_chip_property(&mut self, key: Self::NameType, value: PropertyValue)

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

source

fn set_cell_property( &mut self, cell: &Self::CellId, key: Self::NameType, value: PropertyValue )

Set a property of a cell.

source

fn set_cell_instance_property( &mut self, inst: &Self::CellInstId, key: Self::NameType, value: PropertyValue )

Set a property of a cell instance.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T> HierarchyEdit for &mut T
where T: HierarchyEdit,

source§

fn rename_cell(&mut self, cell: &Self::CellId, new_name: Self::NameType)

source§

fn rename_cell_instance( &mut self, inst: &Self::CellInstId, new_name: Option<Self::NameType> )

source§

fn create_cell_instance( &mut self, parent_cell: &Self::CellId, template_cell: &Self::CellId, name: Option<Self::NameType> ) -> Self::CellInstId

source§

fn create_cell(&mut self, name: Self::NameType) -> Self::CellId

source§

fn remove_cell_instance(&mut self, inst: &Self::CellInstId)

source§

fn remove_cell(&mut self, cell_id: &Self::CellId)

source§

fn set_chip_property(&mut self, key: Self::NameType, value: PropertyValue)

source§

fn set_cell_property( &mut self, cell: &Self::CellId, key: Self::NameType, value: PropertyValue )

source§

fn set_cell_instance_property( &mut self, inst: &Self::CellInstId, key: Self::NameType, value: PropertyValue )

source§

impl<T> HierarchyEdit for Box<T>
where T: HierarchyEdit,

source§

fn remove_cell(&mut self, cell_id: &Self::CellId)

source§

fn create_cell(&mut self, name: Self::NameType) -> Self::CellId

source§

fn set_cell_property( &mut self, cell: &Self::CellId, key: Self::NameType, value: PropertyValue )

source§

fn remove_cell_instance(&mut self, inst: &Self::CellInstId)

source§

fn set_chip_property(&mut self, key: Self::NameType, value: PropertyValue)

source§

fn create_cell_instance( &mut self, parent_cell: &Self::CellId, template_cell: &Self::CellId, name: Option<Self::NameType> ) -> Self::CellInstId

source§

fn rename_cell(&mut self, cell: &Self::CellId, new_name: Self::NameType)

source§

fn rename_cell_instance( &mut self, inst: &Self::CellInstId, new_name: Option<Self::NameType> )

source§

fn set_cell_instance_property( &mut self, inst: &Self::CellInstId, key: Self::NameType, value: PropertyValue )

Implementors§