pub struct LibraryBuilder<S = NoSchema>
where S: Schema + ?Sized,
{ /* private fields */ }
Expand description

A library of SCIR cells with schema S.

Implementations§

source§

impl<S> LibraryBuilder<S>
where S: Schema + ?Sized,

source

pub fn merge(&mut self, other: LibraryBuilder<S>) -> MergedMapping

Merges another SCIR library into the current library.

source

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>
where S: Schema + ?Sized,

source

pub fn validate_drivers(&self) -> IssueSet<DriverIssue>

Perform driver analysis on this library.

source§

impl<S> LibraryBuilder<S>
where S: Schema + ?Sized,

source

pub fn validate(&self) -> IssueSet<ValidatorIssue>

Check whether this library is valid.

source§

impl<S> LibraryBuilder<S>
where S: Schema + ?Sized,

source

pub fn new() -> LibraryBuilder<S>

Creates a new, empty library.

source

pub fn add_cell(&mut self, cell: Cell) -> CellId

Adds the given cell to the library.

Returns the ID of the newly added cell.

source

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.

source

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.

source

pub fn set_top(&mut self, cell: CellId)

Sets the top cell to the given cell ID.

source

pub fn top_cell(&self) -> Option<CellId>

The ID of the top-level cell, if there is one.

source

pub fn is_top(&self, cell: CellId) -> bool

Returns true if the given cell is the top cell.

source

pub fn cell(&self, id: CellId) -> &Cell

Gets the cell with the given ID.

§Panics

Panics if no cell has the given ID. For a non-panicking alternative, see try_cell.

source

pub fn try_cell(&self, id: CellId) -> Option<&Cell>

Gets the cell with the given ID.

source

pub fn cell_named(&self, name: &str) -> &Cell

Gets the cell with the given name.

§Panics

Panics if no cell has the given name.

source

pub fn try_cell_named(&self, name: &str) -> Option<&Cell>

Gets the cell with the given name.

source

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.

source

pub fn try_cell_id_named(&self, name: &str) -> Option<CellId>

Gets the cell ID corresponding to the given name.

source

pub fn cells(&self) -> impl Iterator<Item = (CellId, &Cell)>

Iterates over the (id, cell) pairs in this library.

source

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.

source

pub fn try_primitive( &self, id: PrimitiveId ) -> Option<&<S as Schema>::Primitive>

Gets the primitive with the given ID.

source

pub fn primitives( &self ) -> impl Iterator<Item = (PrimitiveId, &<S as Schema>::Primitive)>

Iterates over the (id, primitive) pairs in this library.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

pub fn drop_schema(self) -> Result<LibraryBuilder, NoSchemaError>

Converts a LibraryBuilder<S> to a LibraryBuilder<NoSchema>, throwing an error if there are any primitives.

source

pub fn convert_schema<C>( self ) -> Result<LibraryBuilder<C>, <C as FromSchema<S>>::Error>
where C: Schema + FromSchema<S> + ?Sized,

Converts a LibraryBuilder<S> into a LibraryBuilder<C>.

Instances associated with non-existent primitives will remain unchanged.

source§

impl<S> LibraryBuilder<S>
where S: Schema<Primitive = impl Clone> + ?Sized,

source

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>
where S: Schema<Primitive = impl Clone> + ?Sized,

source§

fn clone(&self) -> LibraryBuilder<S>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<S> Debug for LibraryBuilder<S>
where S: Schema<Primitive = impl Debug> + ?Sized,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<S> Default for LibraryBuilder<S>
where S: Schema + ?Sized,

source§

fn default() -> LibraryBuilder<S>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<S: ?Sized> RefUnwindSafe for LibraryBuilder<S>

§

impl<S: ?Sized> Send for LibraryBuilder<S>
where <S as Schema>::Primitive: Send,

§

impl<S: ?Sized> Sync for LibraryBuilder<S>
where <S as Schema>::Primitive: Sync,

§

impl<S: ?Sized> Unpin for LibraryBuilder<S>
where <S as Schema>::Primitive: Unpin,

§

impl<S: ?Sized> UnwindSafe for LibraryBuilder<S>
where <S as Schema>::Primitive: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CustomHardwareType<Flipped<T>> for U

source§

fn from_layout_type(other: &Flipped<T>) -> U

Creates this layout type from another layout type.
source§

impl<T, U> CustomHardwareType<InOut<T>> for U

source§

fn from_layout_type(other: &InOut<T>) -> U

Creates this layout type from another layout type.
source§

impl<T, U> CustomHardwareType<Input<T>> for U

source§

fn from_layout_type(other: &Input<T>) -> U

Creates this layout type from another layout type.
source§

impl<T, U> CustomHardwareType<Output<T>> for U

source§

fn from_layout_type(other: &Output<T>) -> U

Creates this layout type from another layout type.
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> Connect<&T> for T

source§

impl<T> Connect<T> for T

source§

impl<T> Primitive for T
where T: Clone + Send + Sync + Any,

source§

impl<T> Primitive for T