Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Sparkle.IR.AST.instReprPort = { reprPrec := Sparkle.IR.AST.instReprPort.repr }
Equations
Instances For
Equations
Hardware operators
These represent primitive operations that map directly to hardware gates.
- and : Operator
- or : Operator
- xor : Operator
- not : Operator
- add : Operator
- sub : Operator
- mul : Operator
- eq : Operator
- lt_u : Operator
- lt_s : Operator
- le_u : Operator
- le_s : Operator
- gt_u : Operator
- gt_s : Operator
- ge_u : Operator
- ge_s : Operator
- mux : Operator
- shl : Operator
- shr : Operator
- asr : Operator
- neg : Operator
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
- Sparkle.IR.AST.instBEqOperator.beq x✝ y✝ = (x✝.ctorIdx == y✝.ctorIdx)
Instances For
Convert operator to string representation
Equations
- Sparkle.IR.AST.Operator.and.toString = "and"
- Sparkle.IR.AST.Operator.or.toString = "or"
- Sparkle.IR.AST.Operator.xor.toString = "xor"
- Sparkle.IR.AST.Operator.not.toString = "not"
- Sparkle.IR.AST.Operator.add.toString = "add"
- Sparkle.IR.AST.Operator.sub.toString = "sub"
- Sparkle.IR.AST.Operator.mul.toString = "mul"
- Sparkle.IR.AST.Operator.eq.toString = "eq"
- Sparkle.IR.AST.Operator.lt_u.toString = "lt_u"
- Sparkle.IR.AST.Operator.lt_s.toString = "lt_s"
- Sparkle.IR.AST.Operator.le_u.toString = "le_u"
- Sparkle.IR.AST.Operator.le_s.toString = "le_s"
- Sparkle.IR.AST.Operator.gt_u.toString = "gt_u"
- Sparkle.IR.AST.Operator.gt_s.toString = "gt_s"
- Sparkle.IR.AST.Operator.ge_u.toString = "ge_u"
- Sparkle.IR.AST.Operator.ge_s.toString = "ge_s"
- Sparkle.IR.AST.Operator.mux.toString = "mux"
- Sparkle.IR.AST.Operator.shl.toString = "shl"
- Sparkle.IR.AST.Operator.shr.toString = "shr"
- Sparkle.IR.AST.Operator.asr.toString = "asr"
- Sparkle.IR.AST.Operator.neg.toString = "neg"
Instances For
Equations
Expression in the netlist IR
- Const: Literal constant value
- Ref: Reference to a wire or port by name
- Op: Application of an operator to arguments
- const (value : Int) (width : Nat) : Expr
- ref (name : String) : Expr
- op (operator : Operator) (args : List Expr) : Expr
- concat (args : List Expr) : Expr
- slice (expr : Expr) (hi lo : Nat) : Expr
- index (array idx : Expr) : Expr
Instances For
Equations
- Sparkle.IR.AST.instReprExpr = { reprPrec := Sparkle.IR.AST.instReprExpr.repr }
Equations
Equations
Create a constant expression from a BitVec
Equations
Instances For
Create a wire reference
Equations
- Sparkle.IR.AST.Expr.wire name = Sparkle.IR.AST.Expr.ref name
Instances For
Helper constructors for common operations
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
- cond.mux then_ else_ = Sparkle.IR.AST.Expr.op Sparkle.IR.AST.Operator.mux [cond, then_, else_]
Instances For
Convert expression to string (for debugging)
Equations
- Sparkle.IR.AST.Expr.instToString = { toString := Sparkle.IR.AST.Expr.toString }
Statement in the netlist IR
- Assign: Continuous assignment (combinational logic)
- Register: Sequential logic (D flip-flop)
- Memory: Synchronous RAM/BRAM primitive
- Inst: Instantiation of another module
- assign (lhs : String) (rhs : Expr) : Stmt
- register (output clock : String) (reset : String × «Type».ResetKind) (input : Expr) (initValue : Int) : Stmt
- memory (name : String) (addrWidth dataWidth : Nat) (clock : String) (writeAddr writeData writeEnable readAddr : Expr) (readData : String) (comboRead : Bool := false) : Stmt
- inst (moduleName instName : String) (connections : List (String × Expr)) : Stmt
Instances For
Equations
- Sparkle.IR.AST.instReprStmt = { reprPrec := Sparkle.IR.AST.instReprStmt.repr }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Sparkle.IR.AST.instBEqStmt.beq (Sparkle.IR.AST.Stmt.assign a a_1) (Sparkle.IR.AST.Stmt.assign b b_1) = (a == b && a_1 == b_1)
- Sparkle.IR.AST.instBEqStmt.beq (Sparkle.IR.AST.Stmt.inst a a_1 a_2) (Sparkle.IR.AST.Stmt.inst b b_1 b_2) = (a == b && (a_1 == b_1 && a_2 == b_2))
- Sparkle.IR.AST.instBEqStmt.beq x✝¹ x✝ = false
Instances For
Equations
Equations
- Sparkle.IR.AST.Stmt.instToString = { toString := Sparkle.IR.AST.Stmt.toString }
Module: A hardware module with inputs, outputs, internal wires, and logic
This represents a synthesizable hardware component.
If isPrimitive is true, this is a blackbox module (e.g., vendor SRAM, clock gate) that should be instantiated but not defined. The body is ignored for primitives.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
Equations
- One or more equations did not get rendered due to their size.
- Sparkle.IR.AST.instBEqModule.beq x✝¹ x✝ = false
Instances For
Create a primitive (blackbox) module with specified interface
Equations
Instances For
Append-vs-prepend perf note #
`addInput` / `addOutput` / `addWire` / `addStmt` are called
in the inner loop of every IP synthesis — once per port,
wire, and statement. The natural definition (`m.body ++ [s]`)
is O(n) per call, which makes the whole module-building
loop O(n²) and dominated runtime for FSM-shape circuits
(memcached server top-level synth went from ~0.5 s for the
first multi-output leaf to 32+ s for the sixth — same Δcalls,
but `module.body` had grown 6× and every `++ [s]` paid
for that).
Fix: build the lists in REVERSE order via head-prepend
(O(1)), then reverse them once at the end of synthesis
in `Module.finalize`. External callers that read
`m.body` / `m.wires` after `finalize` see the same forward
order they always did.
Convert module to string (for debugging)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Create an empty design
Instances For
Find a module by name
Equations
- d.findModule name = List.find? (fun (x : Sparkle.IR.AST.Module) => x.name == name) d.modules