Node and edge kinds #
The visual class of a diagram node.
Each variant gets its own SVG art in renderNode below — a
rectangle for a register, a trapezoid for a mux, a gate body
for combinational primitives, etc. Use gen for anything
you don't have a dedicated shape for; it falls back to a
plain box with the node's label.
- reg : NodeKind
- mux : NodeKind
- port : NodeKind
- const : NodeKind
- clk : NodeKind
- adder : NodeKind
- andG : NodeKind
- orG : NodeKind
- notG : NodeKind
- cloud : NodeKind
- gen : NodeKind
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
- Sparkle.Display.Diagram.instBEqNodeKind.beq x✝ y✝ = (x✝.ctorIdx == y✝.ctorIdx)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
- Sparkle.Display.Diagram.instBEqEdgeKind.beq Sparkle.Display.Diagram.EdgeKind.data Sparkle.Display.Diagram.EdgeKind.data = true
- Sparkle.Display.Diagram.instBEqEdgeKind.beq Sparkle.Display.Diagram.EdgeKind.clock Sparkle.Display.Diagram.EdgeKind.clock = true
- Sparkle.Display.Diagram.instBEqEdgeKind.beq (Sparkle.Display.Diagram.EdgeKind.bus a) (Sparkle.Display.Diagram.EdgeKind.bus b) = (a == b)
- Sparkle.Display.Diagram.instBEqEdgeKind.beq x✝¹ x✝ = false
Instances For
Structures #
Equations
Instances For
Equations
Instances For
SVG rendering #
Render a Diagram as a single SVG document.
Edges first (so node bodies overlay them), then nodes. Multi-input destinations distribute their incoming edges across the node's left side.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Render a Diagram and emit it to the current cell as an
image/svg+xml payload. text/html (an <img> wrapping
the SVG) is also acceptable but plain SVG keeps the output
smaller and lets JupyterLab's vector-zoom handle scaling.
Equations
Instances For
IR → Diagram #
Walk a Sparkle IR.AST.Module and synthesise a Diagram
automatically. Each statement becomes one node; each
Expr.ref inside a statement's RHS becomes one edge.
Layout: ports go in column 0 (inputs) and the rightmost column (outputs); registers and combinational gates fan out across the middle columns roughly in topological order. This isn't a real placer — the goal is "good enough to read at a glance", not to match a manually-authored figure.
Build a Diagram from a Sparkle IR module.
Strategy: each input port is a port node in column 0; each
statement gets a node in some intermediate column based on
its index in the body; each output port is a port node in
the final column. Edges follow Expr.ref dependencies.
Equations
- One or more equations did not get rendered due to their size.