pub struct Externalize;
Expand description

Externalize input/output ports for cells marked with the @external(1) attribute. The ports of these cells are exposed through the ports of the parent component.

For example:

component main() -> () {
    cells {
        // Inputs: addr0, write_data, write_en
        // Outputs: read_data, done
        @external(1) m1 = prim comb_mem_d1(32, 10, 4);
    }
    wires {
        m1.addr0 = 1'd1;
        x.in = m1.read_data;
    }
}

is transformed into:

component main(
    m1_read_data: 32,
    m1_done: 1
) -> (m1_add0: 4, m1_write_data: 32, m1_write_en: 1) {
    cells {
        // m1 removed.
    }
    wires {
        m1_add0 = 1'd1;
        x.in = m1_read_data;
    }
}

Trait Implementations§

source§

impl ConstructVisitor for Externalize

source§

fn from(_ctx: &Context) -> CalyxResult<Self>
where Self: Sized,

Construct the visitor using information from the Context
source§

fn clear_data(&mut self)

Clear the data stored in the visitor. Called before traversing the next component by [ir::traversal::Visitor].
source§

fn get_opts(ctx: &Context) -> LinkedHashMap<&'static str, ParseVal>
where Self: Named,

source§

impl Named for Externalize

source§

fn name() -> &'static str

The name of a pass. Is used for identifying passes.
source§

fn description() -> &'static str

A short description of the pass.
source§

fn opts() -> Vec<PassOpt>

Set of options that can be passed to the pass. The options contains a tuple of the option name and a description.
source§

impl Visitor for Externalize

source§

fn start( &mut self, comp: &mut Component, _ctx: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed before the traversal begins.
source§

fn precondition(_ctx: &Context) -> Option<String>
where Self: Sized,

Precondition for this pass to run on the program. If this function returns None, the pass triggers. Otherwise it aborts and logs the string as the reason.
source§

fn start_context(&mut self, _ctx: &mut Context) -> VisResult

Transform the ir::Context before visiting the components.
source§

fn finish_context(&mut self, _ctx: &mut Context) -> VisResult

Transform the ir::Context after visiting the components.
source§

fn iteration_order() -> Order
where Self: Sized,

Define the iteration order in which components should be visited
source§

fn traverse_component( &mut self, comp: &mut Component, signatures: &LibrarySignatures, components: &[Component] ) -> CalyxResult<()>
where Self: Sized,

Define the traversal over a component. Calls Visitor::start, visits each control node, and finally calls Visitor::finish.
source§

fn do_pass(&mut self, context: &mut Context) -> CalyxResult<()>
where Self: Sized + ConstructVisitor + Named,

Run the visitor on a given program ir::Context. The function mutably borrows the control program in each component and traverses it. Read more
source§

fn do_pass_default(context: &mut Context) -> CalyxResult<Self>
where Self: ConstructVisitor + Sized + Named,

Build a Default implementation of this pass and call Visitor::do_pass using it.
source§

fn finish( &mut self, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed after the traversal ends. This method is always invoked regardless of the Action returned from the children.
source§

fn start_seq( &mut self, _s: &mut Seq, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed before visiting the children of a ir::Seq node.
source§

fn finish_seq( &mut self, _s: &mut Seq, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed after visiting the children of a ir::Seq node.
source§

fn start_par( &mut self, _s: &mut Par, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed before visiting the children of a ir::Par node.
source§

fn finish_par( &mut self, _s: &mut Par, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed after visiting the children of a ir::Par node.
source§

fn start_if( &mut self, _s: &mut If, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed before visiting the children of a ir::If node.
source§

fn finish_if( &mut self, _s: &mut If, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed after visiting the children of a ir::If node.
source§

fn start_while( &mut self, _s: &mut While, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed before visiting the children of a ir::While node.
source§

fn finish_while( &mut self, _s: &mut While, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed after visiting the children of a ir::While node.
source§

fn start_repeat( &mut self, _s: &mut Repeat, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed before visiting the children of a ir::Repeat node.
source§

fn finish_repeat( &mut self, _s: &mut Repeat, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed after visiting the children of a ir::Repeat node.
source§

fn start_static_control( &mut self, _s: &mut StaticControl, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed before visiting the contents of an ir::StaticControl node.
source§

fn finish_static_control( &mut self, _s: &mut StaticControl, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed after visiting the conetnts of an ir::StaticControl node.
source§

fn enable( &mut self, _s: &mut Enable, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed at an ir::Enable node.
source§

fn static_enable( &mut self, _s: &mut StaticEnable, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed at an ir::StaticEnable node.
source§

fn start_static_if( &mut self, _s: &mut StaticIf, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed before visiting the children of a ir::StaticIf node.
source§

fn finish_static_if( &mut self, _s: &mut StaticIf, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed after visiting the children of a ir::StaticIf node.
source§

fn start_static_repeat( &mut self, _s: &mut StaticRepeat, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed before visiting the children of a ir::StaticRepeat node.
source§

fn finish_static_repeat( &mut self, _s: &mut StaticRepeat, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed after visiting the children of a ir::StaticRepeat node.
source§

fn start_static_seq( &mut self, _s: &mut StaticSeq, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

source§

fn finish_static_seq( &mut self, _s: &mut StaticSeq, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

source§

fn start_static_par( &mut self, _s: &mut StaticPar, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

source§

fn finish_static_par( &mut self, _s: &mut StaticPar, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

source§

fn invoke( &mut self, _s: &mut Invoke, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed at an ir::Invoke node.
source§

fn static_invoke( &mut self, _s: &mut StaticInvoke, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed at a ir::StaticInvoke node.
source§

fn empty( &mut self, _s: &mut Empty, _comp: &mut Component, _sigs: &LibrarySignatures, _comps: &[Component] ) -> VisResult

Executed at an ir::Empty node.

Auto Trait Implementations§

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.