Total width mirror (matches Sparkle.IR.Semantics.widthOf's
rules; only used to detect width-0 concat elements).
Equations
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.const value w) = w
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.ref n) = Std.HashMap.getD wm n 0
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.op Sparkle.IR.AST.Operator.mux [head, t, head_1]) = Sparkle.IR.ZeroWidth.exprWidth wm t
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.op Sparkle.IR.AST.Operator.mux args) = 0
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.op Sparkle.IR.AST.Operator.eq args) = 1
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.op Sparkle.IR.AST.Operator.lt_u args) = 1
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.op Sparkle.IR.AST.Operator.lt_s args) = 1
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.op Sparkle.IR.AST.Operator.le_u args) = 1
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.op Sparkle.IR.AST.Operator.le_s args) = 1
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.op Sparkle.IR.AST.Operator.gt_u args) = 1
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.op Sparkle.IR.AST.Operator.gt_s args) = 1
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.op Sparkle.IR.AST.Operator.ge_u args) = 1
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.op Sparkle.IR.AST.Operator.ge_s args) = 1
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.op Sparkle.IR.AST.Operator.not [a]) = Sparkle.IR.ZeroWidth.exprWidth wm a
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.op Sparkle.IR.AST.Operator.not args) = 0
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.op Sparkle.IR.AST.Operator.shr [a, head]) = Sparkle.IR.ZeroWidth.exprWidth wm a
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.op Sparkle.IR.AST.Operator.shr args) = 0
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.op operator [a, b]) = max (Sparkle.IR.ZeroWidth.exprWidth wm a) (Sparkle.IR.ZeroWidth.exprWidth wm b)
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.op operator [a]) = Sparkle.IR.ZeroWidth.exprWidth wm a
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.op operator args) = 0
- Sparkle.IR.ZeroWidth.exprWidth wm (Sparkle.IR.AST.Expr.concat args) = Sparkle.IR.ZeroWidth.exprWidth.go wm args
- Sparkle.IR.ZeroWidth.exprWidth wm (expr.slice hi lo) = hi - lo + 1
- Sparkle.IR.ZeroWidth.exprWidth wm (expr.sliceDim hi lo) = 0
- Sparkle.IR.ZeroWidth.exprWidth wm (array.index idx) = 0
Instances For
Equations
- Sparkle.IR.ZeroWidth.exprWidth.go wm [] = 0
- Sparkle.IR.ZeroWidth.exprWidth.go wm (a :: rest) = Sparkle.IR.ZeroWidth.exprWidth wm a + Sparkle.IR.ZeroWidth.exprWidth.go wm rest
Instances For
Drop width-0 concat elements (they contribute no bits); collapse a resulting singleton concat to its element.
Equations
- One or more equations did not get rendered due to their size.
- Sparkle.IR.ZeroWidth.dzExpr wm (Sparkle.IR.AST.Expr.op o args) = Sparkle.IR.AST.Expr.op o (Sparkle.IR.ZeroWidth.dzList wm args)
- Sparkle.IR.ZeroWidth.dzExpr wm (e.slice hi lo) = (Sparkle.IR.ZeroWidth.dzExpr wm e).slice hi lo
- Sparkle.IR.ZeroWidth.dzExpr wm (e.sliceDim d i) = (Sparkle.IR.ZeroWidth.dzExpr wm e).sliceDim d i
- Sparkle.IR.ZeroWidth.dzExpr wm (a.index i) = (Sparkle.IR.ZeroWidth.dzExpr wm a).index (Sparkle.IR.ZeroWidth.dzExpr wm i)
- Sparkle.IR.ZeroWidth.dzExpr wm x✝ = x✝
Instances For
Equations
- Sparkle.IR.ZeroWidth.dzList wm [] = []
- Sparkle.IR.ZeroWidth.dzList wm (a :: rest) = Sparkle.IR.ZeroWidth.dzExpr wm a :: Sparkle.IR.ZeroWidth.dzList wm rest
Instances For
Drop assignments to width-0 wires (their value is unobservable and
they no longer appear anywhere after dzExpr); clean every other
statement's expressions.
Equations
- One or more equations did not get rendered due to their size.
- Sparkle.IR.ZeroWidth.dzStmt wm (Sparkle.IR.AST.Stmt.assign l r) = match Std.HashMap.get? wm l with | some 0 => none | x => some (Sparkle.IR.AST.Stmt.assign l (Sparkle.IR.ZeroWidth.dzExpr wm r))
- Sparkle.IR.ZeroWidth.dzStmt wm (Sparkle.IR.AST.Stmt.register o c rs i iv) = some (Sparkle.IR.AST.Stmt.register o c rs (Sparkle.IR.ZeroWidth.dzExpr wm i) iv)
Instances For
A module with any SYMBOLIC-width port/wire (W, W+1, …) is left
untouched: buildWidthMap/bitWidth panic on non-concrete dims,
and the zero-width pack tails this pass removes only ever occur in
fully concrete circuit do designs anyway (the Unit/PUnit
HList terminator). bitWidth? is the total, panic-free probe.
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Sparkle.IR.ZeroWidth.dropZeroWidthDesign d = { topModule := d.topModule, modules := List.map Sparkle.IR.ZeroWidth.dropZeroWidthModule d.modules }