The reference names an expression reads.
Equations
- Sparkle.IR.Reorder.refsOf (Sparkle.IR.AST.Expr.const value width) = []
- Sparkle.IR.Reorder.refsOf (Sparkle.IR.AST.Expr.ref n) = [n]
- Sparkle.IR.Reorder.refsOf (Sparkle.IR.AST.Expr.op operator args) = Sparkle.IR.Reorder.refsOf.refsList args
- Sparkle.IR.Reorder.refsOf (Sparkle.IR.AST.Expr.concat args) = Sparkle.IR.Reorder.refsOf.refsList args
- Sparkle.IR.Reorder.refsOf (e.slice hi lo) = Sparkle.IR.Reorder.refsOf e
- Sparkle.IR.Reorder.refsOf (e.sliceDim hi lo) = Sparkle.IR.Reorder.refsOf e
- Sparkle.IR.Reorder.refsOf (a.index i) = Sparkle.IR.Reorder.refsOf a ++ Sparkle.IR.Reorder.refsOf i
Instances For
Equations
Instances For
Environments agreeing on an expression's refs evaluate it equally (widths and the concat combiner are env-free).
Names a statement WRITES during the combinational fold.
Equations
- One or more equations did not get rendered due to their size.
- Sparkle.IR.Reorder.stmtWrites (Sparkle.IR.AST.Stmt.assign l rhs) = [l]
- Sparkle.IR.Reorder.stmtWrites x✝ = []
Instances For
Names a statement READS during the combinational fold.
Equations
- One or more equations did not get rendered due to their size.
- Sparkle.IR.Reorder.stmtReads (Sparkle.IR.AST.Stmt.assign l rhs) = Sparkle.IR.Reorder.refsOf rhs
- Sparkle.IR.Reorder.stmtReads x✝ = []
Instances For
Equations
Instances For
The reorder fragment: with the open-module semantics (instances are no-ops) EVERY statement is in it. Kept as a def so the fragment can narrow again if a closed hierarchical semantics lands.
Equations
Instances For
Well-ordered w.r.t. already-evaluated names done: every read of a
locally-written name comes after its (unique) write. This is the
semantic content of "topologically sorted".
- nil {done : List String} : WO done []
- cons {done : List String} {s : AST.Stmt} {rest : List AST.Stmt} (hok : SimpleStmt s) (hreads : ∀ (n : String), n ∈ stmtReads s → ¬n ∈ writesOf rest) (hw : ∀ (n : String), n ∈ stmtWrites s → ¬n ∈ done ∧ ¬n ∈ writesOf rest) (hrest : WO (done ++ stmtWrites s) rest) : WO done (s :: rest)
Instances For
In the v1 fragment, a non-writing statement is a combinational no-op.
Rewriting under one leading statement: if two tails agree at every environment, so do the bodies with the same head.
A no-op in SECOND position can be dropped.
An assign and a combo-read memory with disjoint footprints commute.
Two combo-read memories with disjoint footprints commute.
Adjacent independent statements commute.
Bubble an independent statement to the front.
Reorder invariance: two well-ordered arrangements of the same
statements fold to the same environment. This is the semantic
license for the shipping topoSortBody: any topological order of
the roundtrip image evaluates like the original order.
One statement's contribution to the register-update list.
Equations
- One or more equations did not get rendered due to their size.
- Sparkle.IR.Reorder.stmtNexts we mems envF x✝ = some []
Instances For
regNexts is the in-order concatenation of contributions.
The register-update lists of two permuted bodies are permutations of each other (or both fail).
Payload evaluation depends on the memory state only through its OWN array's slice.
One statement's memory-state effect: mems0 for read resolution is
the state the statement receives (Verilog nonblocking: payloads see
the pre-write state — and earlier statements only touch OTHER
arrays, so this equals the pre-cycle state of the OWN array).
Equations
- One or more equations did not get rendered due to their size.
- Sparkle.IR.Reorder.stmtMemUpd we envF x✝ = fun (m : Sparkle.IR.Semantics.MEnv) => some m
Instances For
Success of a write fold does not depend on the THREADED state, and tracks the read-resolution state only through the own slice.
A write fold leaves every OTHER array untouched.
A write fold's OWN slice is determined by the incoming own slices (both the read-resolution state's and the threaded state's).
Equations
- Sparkle.IR.Reorder.stmtMemName (Sparkle.IR.AST.Stmt.memory name aw dw clock wa wd wen readAddr readData comboRead ew extraReads) = some name
- Sparkle.IR.Reorder.stmtMemName x✝ = none
Instances For
Memory effects of two statements with distinct array names commute: each fold touches only its own slice, resolves reads only against its own slice, and its success is independent of everything else.
The memory phase only cares about the statement MULTISET when array names are distinct.
The update list's keys are nextKeys, independent of values.
Invert one step into its three stages.
One cycle under reordering: the final env and the memory state agree exactly; the register updates agree as a multiset.
Trace equivalence under reordering: with unique update keys the observable trace is identical for any well-ordered arrangement.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Structural equality on Expr (the DERIVED BEq is well-founded
recursion and opaque to both kernel reduction and lawfulness
proofs, so we roll a structural one and prove it sound).
Equations
- Sparkle.IR.Reorder.eqExpr (Sparkle.IR.AST.Expr.const v w) (Sparkle.IR.AST.Expr.const v' w') = (v == v' && w == w')
- Sparkle.IR.Reorder.eqExpr (Sparkle.IR.AST.Expr.ref n) (Sparkle.IR.AST.Expr.ref n') = (n == n')
- Sparkle.IR.Reorder.eqExpr (Sparkle.IR.AST.Expr.op o args) (Sparkle.IR.AST.Expr.op o' args') = (decide (o = o') && Sparkle.IR.Reorder.eqList args args')
- Sparkle.IR.Reorder.eqExpr (Sparkle.IR.AST.Expr.concat args) (Sparkle.IR.AST.Expr.concat args') = Sparkle.IR.Reorder.eqList args args'
- Sparkle.IR.Reorder.eqExpr (e.slice hi lo) (e'.slice hi' lo') = (Sparkle.IR.Reorder.eqExpr e e' && hi == hi' && lo == lo')
- Sparkle.IR.Reorder.eqExpr (e.sliceDim hi lo) (e'.sliceDim hi' lo') = (Sparkle.IR.Reorder.eqExpr e e' && decide (hi = hi') && decide (lo = lo'))
- Sparkle.IR.Reorder.eqExpr (a.index i) (a'.index i') = (Sparkle.IR.Reorder.eqExpr a a' && Sparkle.IR.Reorder.eqExpr i i')
- Sparkle.IR.Reorder.eqExpr x✝¹ x✝ = false
Instances For
Equations
- Sparkle.IR.Reorder.eqList [] [] = true
- Sparkle.IR.Reorder.eqList (a :: rest) (a' :: rest') = (Sparkle.IR.Reorder.eqExpr a a' && Sparkle.IR.Reorder.eqList rest rest')
- Sparkle.IR.Reorder.eqList x✝¹ x✝ = false
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
- Sparkle.IR.Reorder.instDecidableEqStmt.decEq (Sparkle.IR.AST.Stmt.assign lhs rhs) (Sparkle.IR.AST.Stmt.register output clock reset input initValue) = isFalse ⋯
- Sparkle.IR.Reorder.instDecidableEqStmt.decEq (Sparkle.IR.AST.Stmt.assign lhs rhs) (Sparkle.IR.AST.Stmt.inst moduleName instName connections) = isFalse ⋯
- Sparkle.IR.Reorder.instDecidableEqStmt.decEq (Sparkle.IR.AST.Stmt.register output clock reset input initValue) (Sparkle.IR.AST.Stmt.assign lhs rhs) = isFalse ⋯
- Sparkle.IR.Reorder.instDecidableEqStmt.decEq (Sparkle.IR.AST.Stmt.register output clock reset input initValue) (Sparkle.IR.AST.Stmt.inst moduleName instName connections) = isFalse ⋯
- Sparkle.IR.Reorder.instDecidableEqStmt.decEq (Sparkle.IR.AST.Stmt.inst moduleName instName connections) (Sparkle.IR.AST.Stmt.assign lhs rhs) = isFalse ⋯
- Sparkle.IR.Reorder.instDecidableEqStmt.decEq (Sparkle.IR.AST.Stmt.inst moduleName instName connections) (Sparkle.IR.AST.Stmt.register output clock reset input initValue) = isFalse ⋯
Instances For
Sound (one-directional) permutation check, erase-based.