Repository navigation
refactor(runtime): generate the edges of derived clock domains as SIR - #1844
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
A derived-edge generator emits one edge of an event's signal as SIR, with the rules of DerivedTickPlan: gated clocks judged from their gate programs at the signal's old and new level and fired with the event's domain (one at a time first when they are independent), a settle, then cascade rounds that fire every state-derived or gated domain whose clock moved to its active edge, each at most once, until none does. One fire section serves the edge and the rounds; the mask of domains to fire and those fired so far are its block parameters. It covers two-state plans whose gated clocks all have gate programs. Nothing runs it yet: its tests attach a unit per edge case and compare each edge with the Rust plan walk on gated, inverted, falling-edge, divided and commit-enabled clocks and independent gated domains. Change-Id: If25bbf2ad20810c16ad37ad44998d8059c25be02
tignear
force-pushed
the
feature/derived-edge-sir-a
branch
from
October 24, 2026 05:19
27bb7ee to
491b133
Compare
Contributor
Merge Queue Status
This pull request spent 2 hours 16 minutes 25 seconds in the queue, including 1 hour 32 minutes 15 seconds running CI. Required conditions to merge
|
This was referenced Oct 24, 2026
This was referenced Oct 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1123, step 3b-2: #1786 (derived clock domains), PR A of four (A → B → D → C).
A generator that emits one edge of an event's signal, with every derived clock domain the edge reaches, as SIR. Nothing runs it yet: B uses it for
Simulator::tick, D inlines it into the compiled scheduler's slots. No user-visible change and no perf change: only the tests attach its units.What it emits
derived_edge::EdgePlaniscelox_runtime::DerivedTickPlanover the program's units: the event's own domain, the state-derived domains (EventTopology::derived_events) and the gated clocks (combinational_derived) with their gate programs.EdgePlan::emitemitsDerivedTickPlan::runfor an edge whose signal already moved, step for step:sample_domains);run_gated_fast); its level after the edge is its baseline in the rounds;eval_apply, several byeval_onlyfor each, thenapplyfor each, in entry order (fire), or, when the gated domains are independent, those first, one at a time, then the event's own (fire_with_gated); with a settle first when combinational logic is stale;rounds).One fire section serves the edge and the rounds; the domains to fire and those fired so far are its block parameters, so each domain's units and combinational logic are inlined once (logic twice: before and after a fire). Gate programs (
GateOp) become 64-bit SIR operations;settled_edge's two-state rows become the edge tests.It covers the plans the Rust walk runs without settling for its gates: two-state designs whose gated clocks all have gate programs (
DerivedTickPlan::fast). Four-state designs, gates without programs and plans of coincident sources (several levers) stay with the Rust walk.Validation
derived_edgeunit tests: a test-only builder option attaches one unit per event, edge, settle and own-edge case; each test drives 60 edges ofclk(rising, falling, repeated edges that change nothing) and host writes ofen, runs each edge through the Rust walk (celox_runtime::run_edge) and through the generated unit, and compares the whole design state and the stale-logic flag after every edge. Designs: a gated clock; an inverted clock with a falling-edge gated domain; a divider cascade (half, quarter); a gated clock whose enable the clock's domain toggles; an independent gated domain. Skipping the rounds, or never firing gated domains at the edge, fails them.--lib: 213 passed.cargo test -p celox --features systemverilog --test systemverilog(CELOX_SCHEDULER=differential): 4,351 passed, 20 ignored.napi build --platform --target wasm32-wasip1-threads: builds. clippy-D warnings(with and without tests) andcargo fmt --check: clean.