pub struct Library<S: Schema + ?Sized = NoSchema>(/* private fields */);
Expand description
A SCIR library that is guaranteed to be valid (with the exception of primitives, which are opaque to SCIR).
The contents of the library cannot be mutated.
Implementations§
source§impl<S: Schema + ?Sized> Library<S>
impl<S: Schema + ?Sized> Library<S>
sourcepub fn drop_schema(self) -> Result<Library<NoSchema>, NoSchemaError>
pub fn drop_schema(self) -> Result<Library<NoSchema>, NoSchemaError>
Converts a Library<S>
to a Library<NoSchema>
, throwing an error if there
are any primitives.
sourcepub fn convert_schema<C>(self) -> Result<LibraryBuilder<C>, C::Error>
pub fn convert_schema<C>(self) -> Result<LibraryBuilder<C>, C::Error>
Converts a Library<S>
into a LibraryBuilder<C>
.
A LibraryBuilder
is created to indicate that validation must be done again
to ensure errors were not introduced during the conversion.
sourcepub fn into_builder(self) -> LibraryBuilder<S>
pub fn into_builder(self) -> LibraryBuilder<S>
Converts this library into a LibraryBuilder
that can be modified.
Methods from Deref<Target = LibraryBuilder<S>>§
sourcepub fn validate_drivers(&self) -> IssueSet<DriverIssue>
pub fn validate_drivers(&self) -> IssueSet<DriverIssue>
Perform driver analysis on this library.
sourcepub fn validate(&self) -> IssueSet<ValidatorIssue>
pub fn validate(&self) -> IssueSet<ValidatorIssue>
Check whether this library is valid.
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::Primitive
pub fn primitive(&self, id: PrimitiveId) -> &S::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::Primitive>
pub fn try_primitive(&self, id: PrimitiveId) -> Option<&S::Primitive>
Gets the primitive with the given ID.
sourcepub fn primitives(&self) -> impl Iterator<Item = (PrimitiveId, &S::Primitive)>
pub fn primitives(&self) -> impl Iterator<Item = (PrimitiveId, &S::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.