Skip to content

Commit

Permalink
Generalize where wire_inliner looks for go and done ports. (#2114)
Browse files Browse the repository at this point in the history
* Generalize wire inliner to look for ports with a given attributes as opposed to hardcoded  and  signals

* formatting wire_inliner generalization

* trigger CI
  • Loading branch information
nathanielnrn authored Jun 6, 2024
1 parent c9fdd23 commit 427babc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions calyx-opt/src/passes/wire_inliner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,21 @@ impl Visitor for WireInliner {
let this = Rc::clone(&comp.signature);
let mut builder = ir::Builder::new(comp, sigs);
let group = &data.group;
let this_go_port = this
.borrow()
.find_unique_with_attr(ir::NumAttr::Go)?
.unwrap();
let this_done_port = this
.borrow()
.find_unique_with_attr(ir::NumAttr::Done)?
.unwrap();

structure!(builder;
let one = constant(1, 1);
);
let group_done = guard!(group["done"]);
let group_done = guard!(group[this_done_port.borrow().name]);
let assigns = build_assignments!(builder;
group["go"] = ? this["go"];
group["go"] = ? this[this_go_port.borrow().name];
this["done"] = group_done ? one["out"];
);
comp.continuous_assignments.extend(assigns);
Expand Down

0 comments on commit 427babc

Please sign in to comment.