Trait 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.

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.

Implementations on Foreign Types§

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

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_cell_instance_property( &mut self, inst: &Self::CellInstId, key: Self::NameType, value: PropertyValue, )

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Implementors§