Skip to content

Commit

Permalink
Begin implementaton of non-unrolled repeats
Browse files Browse the repository at this point in the history
- Using TDCC-like method: will compile StaticRepeat bodies to FSMs using finish_repeat
- Will call construct_schedule on a static schedule: need to StaticFSMEnable node
- Will need to compile par blocks in finish_par: allocate an enable or an fsm_enable for each block
  • Loading branch information
parthsarkar17 committed Mar 8, 2025
1 parent e35de23 commit 0bd7178
Show file tree
Hide file tree
Showing 5 changed files with 256 additions and 41 deletions.
2 changes: 1 addition & 1 deletion calyx-ir/src/guard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ impl Guard<StaticTiming> {
}
Self::Info(static_timing) => {
let (b, e) = static_timing.interval;
(b..=e).collect()
(b..e).collect()
}
Self::CompOp(..) | Self::Port(_) => HashSet::new(),
}
Expand Down
19 changes: 15 additions & 4 deletions calyx-ir/src/structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,11 +569,11 @@ impl<T> Assignment<T> {
.chain(std::iter::once(Rc::clone(&self.src)))
}

pub fn and_guard(&mut self, addition_opt: Option<Guard<T>>)
pub fn and_guard(&mut self, addition: Guard<T>)
where
T: Eq,
{
if let Some(addition) = addition_opt {
if !(addition.is_true()) {
self.guard.update(|g| g.and(addition));
}
}
Expand Down Expand Up @@ -616,7 +616,7 @@ impl<StaticTiming> Assignment<StaticTiming> {
}
}

#[derive(Debug)]
#[derive(Debug, Clone)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
pub enum Transition {
Unconditional(u64),
Expand Down Expand Up @@ -831,7 +831,6 @@ impl CombGroup {
pub struct FSM {
/// Name of this construct
pub(super) name: Id,

/// Attributes for this FSM
pub attributes: Attributes,
/// State indexes into assignments that are supposed to be enabled at that state
Expand Down Expand Up @@ -881,6 +880,18 @@ impl FSM {
})
}

/// Extend the FSM with new transitions and assignments. Will panic if
/// the lengths are not consistent.
pub fn extend_fsm<A, T>(&mut self, assigns: A, transitions: T)
where
A: IntoIterator<Item = Vec<Assignment<Nothing>>>,
T: IntoIterator<Item = Transition>,
{
self.assignments.extend(assigns);
self.transitions.extend(transitions);
}

/// Extend the assignments that are supposed to be active at a given state.
pub fn extend_state_assignments<I>(&mut self, state: u64, assigns: I)
where
I: IntoIterator<Item = Assignment<Nothing>>,
Expand Down
3 changes: 1 addition & 2 deletions calyx-opt/src/default_passes.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
//! Defines the default passes available to [PassManager].
use petgraph::visit::Data;

use crate::pass_manager::PassResult;
use crate::passes::{
AddGuard, Canonicalize, CellShare, ClkInsertion, CollapseControl, CombProp,
Expand Down Expand Up @@ -134,6 +132,7 @@ impl PassManager {
StaticInference,
StaticPromotion,
StaticFSMAllocation,
CompileRepeat,
DeadGroupRemoval,
MergeAssign,
TopDownCompileControl,
Expand Down
Loading

0 comments on commit 0bd7178

Please # to comment.