Struct calyx::passes::Externalize
source · [−]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 std_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
sourceimpl ConstructVisitor for Externalize
impl ConstructVisitor for Externalize
sourcefn from(_ctx: &Context) -> CalyxResult<Self> where
Self: Sized,
fn from(_ctx: &Context) -> CalyxResult<Self> where
Self: Sized,
Construct the visitor using information from the Context
sourcefn clear_data(&mut self)
fn clear_data(&mut self)
Clear the data stored in the visitor. Called before traversing the next component by ir::traversal::Visitor. Read more
fn get_opts(opts: &[&'static str], ctx: &Context) -> Vec<bool> where
Self: Named,
sourceimpl Named for Externalize
impl Named for Externalize
sourceimpl Visitor for Externalize
impl Visitor for Externalize
sourcefn start(
&mut self,
comp: &mut Component,
_ctx: &LibrarySignatures,
_comps: &[Component]
) -> VisResult
fn start(
&mut self,
comp: &mut Component,
_ctx: &LibrarySignatures,
_comps: &[Component]
) -> VisResult
Executed before the traversal begins.
sourcefn require_postorder() -> bool where
Self: Sized,
fn require_postorder() -> bool where
Self: Sized,
Returns true if this pass requires a post-order traversal of the
components.
In a post-order traversal, if component B
uses a component A
,
then A
is guaranteed to be traversed before B
. Read more
sourcefn traverse_component(
&mut self,
comp: &mut Component,
signatures: &LibrarySignatures,
components: &[Component]
) -> CalyxResult<()> where
Self: Sized,
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. Read more
sourcefn do_pass(&mut self, context: &mut Context) -> CalyxResult<()> where
Self: Sized + ConstructVisitor,
fn do_pass(&mut self, context: &mut Context) -> CalyxResult<()> where
Self: Sized + ConstructVisitor,
Run the visitor on a given program ir::Context
.
The function mutably borrows the control
program in each component and traverses it. Read more
sourcefn do_pass_default(context: &mut Context) -> CalyxResult<Self> where
Self: ConstructVisitor + Sized,
fn do_pass_default(context: &mut Context) -> CalyxResult<Self> where
Self: ConstructVisitor + Sized,
Build a Default implementation of this pass and call Visitor::do_pass using it. Read more
sourcefn finish(
&mut self,
_comp: &mut Component,
_sigs: &LibrarySignatures,
_comps: &[Component]
) -> VisResult
fn finish(
&mut self,
_comp: &mut Component,
_sigs: &LibrarySignatures,
_comps: &[Component]
) -> VisResult
sourcefn start_seq(
&mut self,
_s: &mut Seq,
_comp: &mut Component,
_sigs: &LibrarySignatures,
_comps: &[Component]
) -> VisResult
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.
sourcefn finish_seq(
&mut self,
_s: &mut Seq,
_comp: &mut Component,
_sigs: &LibrarySignatures,
_comps: &[Component]
) -> VisResult
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.
sourcefn start_par(
&mut self,
_s: &mut Par,
_comp: &mut Component,
_sigs: &LibrarySignatures,
_comps: &[Component]
) -> VisResult
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.
sourcefn finish_par(
&mut self,
_s: &mut Par,
_comp: &mut Component,
_sigs: &LibrarySignatures,
_comps: &[Component]
) -> VisResult
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.
sourcefn start_if(
&mut self,
_s: &mut If,
_comp: &mut Component,
_sigs: &LibrarySignatures,
_comps: &[Component]
) -> VisResult
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.
sourcefn finish_if(
&mut self,
_s: &mut If,
_comp: &mut Component,
_sigs: &LibrarySignatures,
_comps: &[Component]
) -> VisResult
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.
sourcefn start_while(
&mut self,
_s: &mut While,
_comp: &mut Component,
_sigs: &LibrarySignatures,
_comps: &[Component]
) -> VisResult
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.
sourcefn finish_while(
&mut self,
_s: &mut While,
_comp: &mut Component,
_sigs: &LibrarySignatures,
_comps: &[Component]
) -> VisResult
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.
sourcefn enable(
&mut self,
_s: &mut Enable,
_comp: &mut Component,
_sigs: &LibrarySignatures,
_comps: &[Component]
) -> VisResult
fn enable(
&mut self,
_s: &mut Enable,
_comp: &mut Component,
_sigs: &LibrarySignatures,
_comps: &[Component]
) -> VisResult
Executed at an ir::Enable node.
sourcefn invoke(
&mut self,
_s: &mut Invoke,
_comp: &mut Component,
_sigs: &LibrarySignatures,
_comps: &[Component]
) -> VisResult
fn invoke(
&mut self,
_s: &mut Invoke,
_comp: &mut Component,
_sigs: &LibrarySignatures,
_comps: &[Component]
) -> VisResult
Executed at an ir::Invoke node.
Auto Trait Implementations
impl RefUnwindSafe for Externalize
impl Send for Externalize
impl Sync for Externalize
impl Unpin for Externalize
impl UnwindSafe for Externalize
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more