Asserts that α has a known hardware bit-width.
Instances are intentionally minimal — no toBits/fromBits.
The IR elaborator recognises the structural shape of
α (BitVec / Bool / Prod / HWVector) directly when wiring,
so the typeclass only needs to expose the width for
code that reasons about state size statically.
- width : Nat
Instances
Equations
- Sparkle.Core.instWireableBool = { width := 1 }
Equations
- Sparkle.Core.instWireableBitVec n = { width := n }
Right-nested heterogeneous product over a static type list.
HList [α, β, γ] = α × β × γ × Unit. Definitionally a Prod
chain so Prod.fst / Prod.snd projections (which the IR
elaborator already lowers to bit slices) reach individual
slots without needing new wire rules.
Equations
- Sparkle.Core.HList [] = Unit
- Sparkle.Core.HList (α :: αs) = (α × Sparkle.Core.HList αs)
Instances For
Equations
Instances For
Empty HList wires to a zero-width slot. Matches the Prod
chain's Unit terminator.
Equations
- Sparkle.Core.instWireableUnit = { width := 0 }
Prod of two Wireables is Wireable. Width is the sum, exactly what the elaborator's existing Prod wire rule does.
Equations
HListWireable αs asserts that every element type in αs
has a Wireable instance. Used as a constraint on
runCircuit so users can't accidentally place non-
synthesisable types (e.g. Option Nat) into the register
state list — the type check fires at the runCircuit call
site, well before #synthesizeVerilog would.
The class is intentionally empty: its presence is the
assertion. Instances are derived structurally on the list
so any αs whose elements are individually Wireable
automatically gets an instance.
Wireable (HList αs) follows by induction over the Prod
chain α × HList αs, using the existing
Wireable (α × β) instance above.