Struct substrate::schematic::CellBuilder
source · pub struct CellBuilder<S: Schema + ?Sized> { /* private fields */ }
Expand description
A builder for creating a schematic cell.
Implementations§
source§impl<S: Schema + ?Sized> CellBuilder<S>
impl<S: Schema + ?Sized> CellBuilder<S>
sourcepub fn signal<TY: HardwareType>(
&mut self,
name: impl Into<ArcStr>,
ty: TY
) -> <TY as HardwareType>::Bundle
pub fn signal<TY: HardwareType>( &mut self, name: impl Into<ArcStr>, ty: TY ) -> <TY as HardwareType>::Bundle
Create a new signal with the given name and hardware type.
sourcepub fn connect<D1, D2>(&mut self, s1: D1, s2: D2)
pub fn connect<D1, D2>(&mut self, s1: D1, s2: D2)
Connect all signals in the given data instances.
sourcepub fn connect_multiple<D>(&mut self, s2: &[D])
pub fn connect_multiple<D>(&mut self, s2: &[D])
Connect all signals in the given data instances.
sourcepub fn set_scir(&mut self, scir: ScirBinding<S>)
pub fn set_scir(&mut self, scir: ScirBinding<S>)
Marks this cell as a SCIR cell.
sourcepub fn set_primitive(&mut self, primitive: PrimitiveBinding<S>)
pub fn set_primitive(&mut self, primitive: PrimitiveBinding<S>)
Marks this cell as a primitive.
sourcepub fn generate<B: Schematic<S>>(&mut self, block: B) -> SchemaCellHandle<S, B>
pub fn generate<B: Schematic<S>>(&mut self, block: B) -> SchemaCellHandle<S, B>
Starts generating a block in a new thread and returns a handle to its cell.
Can be used to check data stored in the cell or other generated results before adding the
cell to the current schematic with CellBuilder::add
.
To generate and add the block simultaneously, use CellBuilder::instantiate
.
sourcepub fn generate_blocking<B: Schematic<S>>(
&mut self,
block: B
) -> Result<SchemaCellHandle<S, B>>
pub fn generate_blocking<B: Schematic<S>>( &mut self, block: B ) -> Result<SchemaCellHandle<S, B>>
Generates a cell corresponding to block
and returns a handle to it.
Blocks on generation. Useful for handling errors thrown by the generation of a cell immediately.
As with CellBuilder::generate
, the resulting handle must be added to the schematic with
CellBuilder::add
before it can be connected as an instance.
sourcepub fn add<B: ExportsNestedData>(
&mut self,
cell: SchemaCellHandle<S, B>
) -> Instance<B>
pub fn add<B: ExportsNestedData>( &mut self, cell: SchemaCellHandle<S, B> ) -> Instance<B>
Adds a cell generated with CellBuilder::generate
to the current schematic.
Does not block on generation. If immediate error recovery is desired,
check errors before calling this function using CellHandle::try_cell
.
§Panics
If the instantiated cell fails to generate, this function will eventually cause a panic after
the parent cell’s generator completes. To avoid this, return errors using Instance::try_data
before your generator returns.
sourcepub fn instantiate<B: Schematic<S>>(&mut self, block: B) -> Instance<B>
pub fn instantiate<B: Schematic<S>>(&mut self, block: B) -> Instance<B>
Instantiates a schematic view of the given block.
This function generates and adds the cell to the schematic. If checks need to be done on
the generated cell before it is added to the schematic, use CellBuilder::generate
and
CellBuilder::add
.
Spawns a thread that generates the underlying cell. If immediate error recovery is desired, use the generate and add workflow mentioned above.
§Panics
If the instantiated cell fails to generate, this function will eventually cause a panic after
the parent cell’s generator completes. To avoid this, return errors using Instance::try_data
before your generator returns.
If an error is not returned from the enclosing generator, but this function returns an error, the enclosing generator will panic since the instantiation irrecoverably failed.
sourcepub fn instantiate_named<B: Schematic<S>>(
&mut self,
block: B,
name: impl Into<ArcStr>
) -> Instance<B>
pub fn instantiate_named<B: Schematic<S>>( &mut self, block: B, name: impl Into<ArcStr> ) -> Instance<B>
Instantiates a block and assigns a name to the instance.
See CellBuilder::instantiate
for details.
Callers must ensure that instance names are unique.
sourcepub fn instantiate_blocking<B: Schematic<S>>(
&mut self,
block: B
) -> Result<Instance<B>>
pub fn instantiate_blocking<B: Schematic<S>>( &mut self, block: B ) -> Result<Instance<B>>
Instantiates a schematic view of the given block, blocking on generator for underlying cell. Returns an error if the generator returned an error.
See SubCellBuilder::instantiate
for details.
§Panics
If an error is not returned from the enclosing generator, but this function returns an error, the enclosing generator will panic since the instantiation irrecoverably failed.
sourcepub fn instantiate_connected<B, C>(&mut self, block: B, io: C)
pub fn instantiate_connected<B, C>(&mut self, block: B, io: C)
Creates an instance using CellBuilder::instantiate
and immediately connects its ports.
sourcepub fn instantiate_connected_named<B, C>(
&mut self,
block: B,
io: C,
name: impl Into<ArcStr>
)
pub fn instantiate_connected_named<B, C>( &mut self, block: B, io: C, name: impl Into<ArcStr> )
Creates an instance using CellBuilder::instantiate
and immediately connects its ports.
sourcepub fn sub_builder<S2: Schema + ?Sized>(&mut self) -> SubCellBuilder<'_, S, S2>where
S: FromSchema<S2>,
pub fn sub_builder<S2: Schema + ?Sized>(&mut self) -> SubCellBuilder<'_, S, S2>where
S: FromSchema<S2>,
Creates a SubCellBuilder
for instantiating blocks from schema S2
.
Auto Trait Implementations§
impl<S> !RefUnwindSafe for CellBuilder<S>
impl<S: ?Sized> Send for CellBuilder<S>
impl<S: ?Sized> Sync for CellBuilder<S>
impl<S: ?Sized> Unpin for CellBuilder<S>
impl<S> !UnwindSafe for CellBuilder<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