Skip to content

Add initial values to primitive sequential models - #545

Open
xtofalex wants to merge 2 commits into
mainfrom
sequential-initial-values
Open

xtofalex wants to merge 2 commits into
mainfrom
sequential-initial-values

Conversation

@xtofalex

@xtofalex xtofalex commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Primitive sequential models can now describe power-up state using init: 0 | 1 or init_from: {"parameter": "INIT_VAL", "bit": 0}. Both static models and parameter-selected tables support these fields, and C++/Python instance resolvers read current instance overrides or design defaults. Unknown or missing values remain free; missing parameter declarations are rejected when the model is defined.

Sequential models were previously kept only in memory. This change saves their expressions, state/output order, parameter tables, and initial-value metadata through a versioned NajaIF dumpable property, including restoration in a fresh process. Snapshot writing rejects models with missing or foreign terminals while retaining existing in-memory consumer diagnostics. The built-in Xilinx flip-flop models now declare their INIT sources, and the raw Python API documentation describes the new fields and resolver.

Validation

  • CMake modeling and Cap'n Proto round-trip regressions, including foreign-terminal rejection.
  • Raw Python model tests (32 passing) and primitive-library tests (8 passing).
  • Full determinism contract and the new five-process sequential-model snapshot regression.
  • Sphinx HTML build with the built-in theme and reuse lint.
  • git diff --check.

Bazel was not run locally; no build-system or dependency revisions change in this PR.

Follow-up scope

The kepler-formal SEC consumer, its end-to-end regressions, and its documentation are tracked separately in keplertech/kepler-formal#319, after this Naja API is available.

An RTL register without an initial value remains free even when synthesis chooses a fixed power-up value. Automatically equating undefined RTL initial values with the netlist is outside this change. Reset bootstrap (sec_reset) remains the workflow for designs initialized by reset.

@codecov-commenter

codecov-commenter commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.89655% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...c/nl/python/naja_wrapping/PySNLSequentialModel.cpp 89.36% 5 Missing ⚠️
src/nl/netlist/decorators/SNLDesignModeling.cpp 98.63% 3 Missing ⚠️
.../netlist/serialization/capnp/SNLCapnPInterface.cpp 94.44% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@codspeed

codspeed Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 18.54%

3 warnings

⚠️ 13 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ 2 benchmarks with a significant change ran on different hardware

Their base and head results were measured on machines with a different CPU, core count or memory, so the changes might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

⚠️ 2 benchmarks with a significant change ran in a different software environment

Their base and head results were measured with a different OS or toolchain, such as compiler, runtime or library versions, so the changes might come from this difference rather than from the code. Open an affected benchmark to see what changed.

See affected benchmarks

❌ 2 regressed benchmarks
✅ 109 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ BM_SnapshotEncode[64] 1.7 ms 2.3 ms -23.49%
❌ BM_SnapshotDecode[64] 4.8 ms 5.6 ms -13.28%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing sequential-initial-values (dd32d39) with main (f1db5dd)

Open in CodSpeed

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants