Struct substrate::scir::LibraryBuilder
source · pub struct LibraryBuilder<S = NoSchema>{ /* private fields */ }
Expand description
A library of SCIR cells with schema S
.
Implementations§
source§impl<S> LibraryBuilder<S>
impl<S> LibraryBuilder<S>
sourcepub fn merge(&mut self, other: LibraryBuilder<S>) -> MergedMapping
pub fn merge(&mut self, other: LibraryBuilder<S>) -> MergedMapping
Merges another SCIR library into the current library.
sourcepub fn merge_cells(
&mut self,
other: LibraryBuilder<S>,
cells: impl IntoIterator<Item = CellId>
) -> MergedMapping
pub fn merge_cells( &mut self, other: LibraryBuilder<S>, cells: impl IntoIterator<Item = CellId> ) -> MergedMapping
Merges the given cells from another SCIR library into the current library.
source§impl<S> LibraryBuilder<S>
impl<S> LibraryBuilder<S>
sourcepub fn validate_drivers(&self) -> IssueSet<DriverIssue>
pub fn validate_drivers(&self) -> IssueSet<DriverIssue>
Perform driver analysis on this library.
source§impl<S> LibraryBuilder<S>
impl<S> LibraryBuilder<S>
sourcepub fn validate(&self) -> IssueSet<ValidatorIssue>
pub fn validate(&self) -> IssueSet<ValidatorIssue>
Check whether this library is valid.
source§impl<S> LibraryBuilder<S>
impl<S> LibraryBuilder<S>
sourcepub fn new() -> LibraryBuilder<S>
pub fn new() -> LibraryBuilder<S>
Creates a new, empty library.
sourcepub fn add_cell(&mut self, cell: Cell) -> CellId
pub fn add_cell(&mut self, cell: Cell) -> CellId
Adds the given cell to the library.
Returns the ID of the newly added cell.
sourcepub fn merge_cell(&mut self, cell: Cell) -> CellId
pub fn merge_cell(&mut self, cell: Cell) -> CellId
Merges the given cell into the library.
Returns the ID of the newly added cell. May rename the cell if the name is already taken.
sourcepub fn add_primitive(
&mut self,
primitive: <S as Schema>::Primitive
) -> PrimitiveId
pub fn add_primitive( &mut self, primitive: <S as Schema>::Primitive ) -> PrimitiveId
Adds the given primitive to the library.
Returns the ID of the newly added primitive.
sourcepub fn cell_named(&self, name: &str) -> &Cell
pub fn cell_named(&self, name: &str) -> &Cell
sourcepub fn try_cell_named(&self, name: &str) -> Option<&Cell>
pub fn try_cell_named(&self, name: &str) -> Option<&Cell>
Gets the cell with the given name.
sourcepub fn cell_id_named(&self, name: &str) -> CellId
pub fn cell_id_named(&self, name: &str) -> CellId
Gets the cell ID corresponding to the given name.
§Panics
Panics if no cell has the given name.
For a non-panicking alternative, see try_cell_id_named
.
sourcepub fn try_cell_id_named(&self, name: &str) -> Option<CellId>
pub fn try_cell_id_named(&self, name: &str) -> Option<CellId>
Gets the cell ID corresponding to the given name.
sourcepub fn cells(&self) -> impl Iterator<Item = (CellId, &Cell)>
pub fn cells(&self) -> impl Iterator<Item = (CellId, &Cell)>
Iterates over the (id, cell)
pairs in this library.
sourcepub fn primitive(&self, id: PrimitiveId) -> &<S as Schema>::Primitive
pub fn primitive(&self, id: PrimitiveId) -> &<S as Schema>::Primitive
Gets the primitive with the given ID.
§Panics
Panics if no primitive has the given ID.
For a non-panicking alternative, see try_primitive
.
sourcepub fn try_primitive(
&self,
id: PrimitiveId
) -> Option<&<S as Schema>::Primitive>
pub fn try_primitive( &self, id: PrimitiveId ) -> Option<&<S as Schema>::Primitive>
Gets the primitive with the given ID.
sourcepub fn primitives(
&self
) -> impl Iterator<Item = (PrimitiveId, &<S as Schema>::Primitive)>
pub fn primitives( &self ) -> impl Iterator<Item = (PrimitiveId, &<S as Schema>::Primitive)>
Iterates over the (id, primitive)
pairs in this library.
sourcepub fn annotate_instance_path(
&self,
path: InstancePath
) -> AnnotatedInstancePath
pub fn annotate_instance_path( &self, path: InstancePath ) -> AnnotatedInstancePath
Annotates an InstancePath
with additional metadata.
Finds cell IDs associated with instances in the path if they are in the SCIR library, and converts the top of the path to a cell ID if possible.
sourcepub fn convert_annotated_instance_path(
&self,
conv: Option<&NetlistLibConversion>,
path: AnnotatedInstancePath
) -> NamedPath
pub fn convert_annotated_instance_path( &self, conv: Option<&NetlistLibConversion>, path: AnnotatedInstancePath ) -> NamedPath
Annotates an instance path with additional metadata, such as whether each instance in the path corresponds to an actual SCIR instance.
sourcepub fn convert_instance_path(&self, path: InstancePath) -> NamedPath
pub fn convert_instance_path(&self, path: InstancePath) -> NamedPath
Converts an InstancePath
to a NamedPath
.
§Panics
Panics if the path contains instance or cell IDs that do not exist.
sourcepub fn convert_instance_path_with_conv(
&self,
conv: &NetlistLibConversion,
path: InstancePath
) -> NamedPath
pub fn convert_instance_path_with_conv( &self, conv: &NetlistLibConversion, path: InstancePath ) -> NamedPath
Converts an InstancePath
to a NamedPath
, using the provided conv
to modify instance names that were converted during netlisting.
§Panics
Panics if the path contains instance or cell IDs that do not exist.
sourcepub fn convert_slice_one_path(
&self,
path: SliceOnePath,
index_fmt: impl FnOnce(&ArcStr, Option<usize>) -> ArcStr
) -> NamedPath
pub fn convert_slice_one_path( &self, path: SliceOnePath, index_fmt: impl FnOnce(&ArcStr, Option<usize>) -> ArcStr ) -> NamedPath
Converts a SliceOnePath
to a NamedPath
.
to modify instance names that were converted during netlisting.
§Panics
Panics if the path contains instance or cell IDs that do not exist.
sourcepub fn convert_slice_one_path_with_conv(
&self,
conv: &NetlistLibConversion,
path: SliceOnePath,
index_fmt: impl FnOnce(&ArcStr, Option<usize>) -> ArcStr
) -> NamedPath
pub fn convert_slice_one_path_with_conv( &self, conv: &NetlistLibConversion, path: SliceOnePath, index_fmt: impl FnOnce(&ArcStr, Option<usize>) -> ArcStr ) -> NamedPath
Converts a SliceOnePath
to a NamedPath
, using the provided conv
to modify instance names that were converted during netlisting.
§Panics
Panics if the path contains instance or cell IDs that do not exist.
sourcepub fn simplify_path(&self, path: SliceOnePath) -> SliceOnePath
pub fn simplify_path(&self, path: SliceOnePath) -> SliceOnePath
Returns a simplified path to the provided node, bubbling up through IOs.
§Panics
Panics if the provided path does not exist within the SCIR library.
sourcepub fn build(self) -> Result<Library<S>, Issues>
pub fn build(self) -> Result<Library<S>, Issues>
Validate and construct a SCIR Library
.
If errors are encountered during validation,
returns an Err(_)
containing the set of issues found.
If no errors are encountered, returns an Ok(_)
containing
the SCIR library. Warnings and infos are discarded.
If you want to inspect warnings/infos, consider using
try_build
instead.
sourcepub fn try_build(self) -> Result<(Library<S>, Issues), Issues>
pub fn try_build(self) -> Result<(Library<S>, Issues), Issues>
Validate and construct a SCIR Library
.
If errors are encountered during validation,
returns an Err(_)
containing the set of issues found.
If no errors are encountered, returns Ok((library, issues))
.
The issues returned will not have any errors, but may have
warnings or infos.
If you do not want to inspect warnings/infos, consider using
build
instead.
sourcepub fn drop_schema(self) -> Result<LibraryBuilder, NoSchemaError>
pub fn drop_schema(self) -> Result<LibraryBuilder, NoSchemaError>
Converts a LibraryBuilder<S>
to a LibraryBuilder<NoSchema>
, throwing an error if there
are any primitives.
sourcepub fn convert_schema<C>(
self
) -> Result<LibraryBuilder<C>, <C as FromSchema<S>>::Error>
pub fn convert_schema<C>( self ) -> Result<LibraryBuilder<C>, <C as FromSchema<S>>::Error>
Converts a LibraryBuilder<S>
into a LibraryBuilder<C>
.
Instances associated with non-existent primitives will remain unchanged.
source§impl<S> LibraryBuilder<S>
impl<S> LibraryBuilder<S>
sourcepub fn from_cell_named(lib: &LibraryBuilder<S>, cell: &str) -> LibraryBuilder<S>
pub fn from_cell_named(lib: &LibraryBuilder<S>, cell: &str) -> LibraryBuilder<S>
Creates a new SCIR library builder containing only the named cell and its children from an existing library builder.
Trait Implementations§
source§impl<S> Clone for LibraryBuilder<S>
impl<S> Clone for LibraryBuilder<S>
source§fn clone(&self) -> LibraryBuilder<S>
fn clone(&self) -> LibraryBuilder<S>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<S> Debug for LibraryBuilder<S>
impl<S> Debug for LibraryBuilder<S>
Auto Trait Implementations§
impl<S: ?Sized> RefUnwindSafe for LibraryBuilder<S>
impl<S: ?Sized> Send for LibraryBuilder<S>
impl<S: ?Sized> Sync for LibraryBuilder<S>
impl<S: ?Sized> Unpin for LibraryBuilder<S>
impl<S: ?Sized> UnwindSafe for LibraryBuilder<S>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T, U> CustomHardwareType<Flipped<T>> for Uwhere
U: CustomHardwareType<T>,
T: HardwareType,
impl<T, U> CustomHardwareType<Flipped<T>> for Uwhere
U: CustomHardwareType<T>,
T: HardwareType,
source§fn from_layout_type(other: &Flipped<T>) -> U
fn from_layout_type(other: &Flipped<T>) -> U
source§impl<T, U> CustomHardwareType<InOut<T>> for Uwhere
U: CustomHardwareType<T>,
T: HardwareType,
impl<T, U> CustomHardwareType<InOut<T>> for Uwhere
U: CustomHardwareType<T>,
T: HardwareType,
source§fn from_layout_type(other: &InOut<T>) -> U
fn from_layout_type(other: &InOut<T>) -> U
source§impl<T, U> CustomHardwareType<Input<T>> for Uwhere
U: CustomHardwareType<T>,
T: HardwareType,
impl<T, U> CustomHardwareType<Input<T>> for Uwhere
U: CustomHardwareType<T>,
T: HardwareType,
source§fn from_layout_type(other: &Input<T>) -> U
fn from_layout_type(other: &Input<T>) -> U
source§impl<T, U> CustomHardwareType<Output<T>> for Uwhere
U: CustomHardwareType<T>,
T: HardwareType,
impl<T, U> CustomHardwareType<Output<T>> for Uwhere
U: CustomHardwareType<T>,
T: HardwareType,
source§fn from_layout_type(other: &Output<T>) -> U
fn from_layout_type(other: &Output<T>) -> U
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request