pub struct Context {
pub executor: Arc<dyn Executor>,
pub cache: Cache,
/* private fields */
}
Expand description
The global context.
Stores configuration such as the PDK and tool plugins to use during generation.
Cheaply clonable.
§Examples
let ctx = PdkContext::new(ExamplePdk);
let handle = ctx.generate_layout(Buffer::new(5));
let cell: &Cell<Buffer> = handle.cell();
assert_eq!(cell.block(), &Buffer::new(5));
assert_eq!(cell.data().inv1.block(), &Inverter::new(5));
assert_eq!(cell.data().inv2.block(), &Inverter::new(5));
assert_eq!(
cell.data().inv1.bbox(),
Some(Rect::from_sides(0, 0, 100, 200))
);
assert_eq!(
cell.data().inv2.bbox(),
Some(Rect::from_sides(110, 0, 210, 200))
);
assert_eq!(cell.bbox(), Some(Rect::from_sides(0, 0, 210, 200)));
Fields§
§executor: Arc<dyn Executor>
The executor to which commands should be submitted.
cache: Cache
A cache for storing the results of expensive computations.
Implementations§
source§impl Context
impl Context
sourcepub fn builder() -> ContextBuilder
pub fn builder() -> ContextBuilder
Creates a builder for constructing a context.
sourcepub fn with_pdk<PDK: Pdk>(&self) -> PdkContext<PDK>
pub fn with_pdk<PDK: Pdk>(&self) -> PdkContext<PDK>
Creates a PdkContext
for the given installed PDK.
The PDK must first be installed in the context.
sourcepub fn generate_cross_schematic<S1: Schema + ?Sized, S2: FromSchema<S1> + ?Sized, B: Schematic<S1>>(
&self,
block: B
) -> SchemaCellHandle<S2, B>
pub fn generate_cross_schematic<S1: Schema + ?Sized, S2: FromSchema<S1> + ?Sized, B: Schematic<S1>>( &self, block: B ) -> SchemaCellHandle<S2, B>
Generates a schematic of a block in schema S1
for use in schema S2
.
Can only generate a cross schematic with one layer of FromSchema
indirection.
sourcepub fn generate_schematic<S: Schema + ?Sized, T: Schematic<S>>(
&self,
block: T
) -> SchemaCellHandle<S, T>
pub fn generate_schematic<S: Schema + ?Sized, T: Schematic<S>>( &self, block: T ) -> SchemaCellHandle<S, T>
Generates a schematic for block
in the background.
Returns a handle to the cell being generated.
sourcepub fn export_scir<S: Schema + ?Sized, T: Schematic<S>>(
&self,
block: T
) -> Result<RawLib<S>, ConvError>
pub fn export_scir<S: Schema + ?Sized, T: Schematic<S>>( &self, block: T ) -> Result<RawLib<S>, ConvError>
Export the given block and all sub-blocks as a SCIR library.
Returns a SCIR library and metadata for converting between SCIR and Substrate formats.
sourcepub fn export_scir_all<S: Schema + ?Sized>(
&self,
cells: &[&RawCell<S>]
) -> Result<RawLib<S>, ConvError>
pub fn export_scir_all<S: Schema + ?Sized>( &self, cells: &[&RawCell<S>] ) -> Result<RawLib<S>, ConvError>
Export the given cells and all their subcells as a SCIR library.
Returns a SCIR library and metadata for converting between SCIR and Substrate formats.
sourcepub fn simulate<S, T>(
&self,
block: T,
work_dir: impl Into<PathBuf>
) -> Result<T::Output>
pub fn simulate<S, T>( &self, block: T, work_dir: impl Into<PathBuf> ) -> Result<T::Output>
Simulate the given testbench.
The simulator must be installed in the context.
sourcepub fn install<I>(&mut self, installation: I) -> Arc<I>where
I: PrivateInstallation,
pub fn install<I>(&mut self, installation: I) -> Arc<I>where
I: PrivateInstallation,
Installs the given PrivateInstallation
.
Only one installation of any given type can exist. Overwrites conflicting installations of the same type.
sourcepub fn get_or_install<I>(&self, installation: I) -> Arc<I>where
I: PrivateInstallation,
pub fn get_or_install<I>(&self, installation: I) -> Arc<I>where
I: PrivateInstallation,
Installs the given PrivateInstallation
.
Returns the existing installation if one is present.
sourcepub fn get_private_installation<I: PrivateInstallation>(&self) -> Option<Arc<I>>
pub fn get_private_installation<I: PrivateInstallation>(&self) -> Option<Arc<I>>
Gets a private installation from the context installation map.
sourcepub fn get_installation<I: Installation>(&self) -> Option<Arc<I>>
pub fn get_installation<I: Installation>(&self) -> Option<Arc<I>>
Gets an installation from the context installation map.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
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