Skip to content

Commit

Permalink
fix borrow error
Browse files Browse the repository at this point in the history
  • Loading branch information
calebmkim committed Feb 5, 2024
1 parent f076408 commit 7bf4aad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions calyx-ir/src/from_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn get_comp_latency(
});
// Annoying thing we have to do bc NonZeroU64.
match interval_value {
Some(lat) => Ok(Some(NonZeroU64::new(lat)).unwrap()),
Some(lat) => Ok(NonZeroU64::new(lat)),
None => Ok(None),
}
}
Expand All @@ -71,7 +71,7 @@ fn get_comp_latency(
});
// Annoying thing we have to do bc NonZeroU64.
match interval_value {
Some(lat) => Ok(Some(NonZeroU64::new(lat)).unwrap()),
Some(lat) => Ok(NonZeroU64::new(lat)),
None => Ok(None),
}
}
Expand Down
6 changes: 4 additions & 2 deletions calyx-opt/src/analysis/inference_analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,12 @@ impl From<&ir::Cell> for GoDone {
Some(st) => Some(st),
None => port.attributes.get(ir::NumAttr::Promotable),
};
if st.is_some() {
if let Some(static_latency) = st {
return done_ports
.get(&port.attributes.get(ir::NumAttr::Go))
.map(|done_port| (port.name, *done_port, st.unwrap()));
.map(|done_port| {
(port.name, *done_port, static_latency)
});
}
None
})
Expand Down
6 changes: 3 additions & 3 deletions calyx-opt/src/passes/compile_static_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ impl CompileStaticInterface {
let go_guard = guard!(comp_sig["go"]);
let not_go_guard = !guard!(comp_sig["go"]);
let first_state_guard = guard!(fsm["out"] == first_state["out"]);
let signal_on_guard = guard!(sig_reg["out"]);
let comp_done_guard = first_state_guard & signal_on_guard;
let comp_done_guard =
guard!(fsm["out"] == first_state["out"]) & guard!(sig_reg["out"]);
let assigns = build_assignments!(builder;
// only set sig_reg when fsm == 0
sig_reg["write_en"] = first_state_guard ? one["out"];
Expand All @@ -237,7 +237,7 @@ impl CompileStaticInterface {
let zero = constant(0, 1);
);
let go_guard = guard!(comp_sig["go"]);
let not_go = !go_guard;
let not_go = !guard!(comp_sig["go"]);
let signal_on_guard = guard!(sig_reg["out"]);
let assigns = build_assignments!(builder;
// comp.done is just whatever comp.go was on the previous cycle.
Expand Down

0 comments on commit 7bf4aad

Please sign in to comment.