Skip to content

fix(sim)!: preserve global precision in VCD and VPI - #1471

Merged
mergify[bot] merged 1 commit into
masterfrom
stack/tignear/fix/design-time-precision/preserve-global-precision-vcd-vpi--a5ff9cd5
Oct 18, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
stack/tignear/fix/design-time-precision/preserve-global-precision-vcd-vpi--a5ff9cd5

Conversation

@tignear

@tignear tignear commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

VCD headers labeled every timestamp as 1ns and VPI reported 1ps regardless
of the design. Carry the analyzer's global precision through symbolic modules
and assembly into the runtime design, and retain it in native images. Use it
for VCD headers and null-handle VPI queries, including restarted waveforms and
NAPI compiled-code cache hits. Retain local module units and precisions in
reflected scopes so module and signal VPI queries report their own scales
(IEEE 1800-2023 37.10 and 38.6), including after native-image reload.

Default Veryl and scale-free frontend ticks to 1ps, matching SV's default.
Update Playground VCD downloads and document the waveform compatibility
change. Bump the native image container to version 14 for the added metadata.

Validation:

  • Precision regressions on native, Cranelift, Wasm, interpreter, tiered, and native/Cranelift parallel configurations; mixed-language designs, package precision, image roundtrips, and VCD restarts.
  • Existing VCD and time-query regressions, Celox and affected frontend/runtime unit tests, VPI tests, Rust doctests, and the portable compiler configuration.
  • Live cocotb attached-image integration.
  • Rebuilt NAPI; simulator, simulation, checkpoint, e2e and timing-addon JS tests; cached-waveform precision regression.
  • Playground waveform export test and TypeScript checks; formatting, Clippy, and Biome.

BREAKING CHANGE: Default VCD headers now use 1ps instead of 1ns. Recompile
native images for container version 14. SimModule and ElaboratedDesign struct
literals must provide the added timing metadata fields; ReflectionScope literals
must provide time_scale.

Fixes #1463

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T02:02:27.617851Z 02ef771 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 18, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 78c3310e70

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/celox-vpi/src/lib.rs Outdated
Comment on lines +612 to +614
if matches!(property, VPI_TIME_UNIT | VPI_TIME_PRECISION) {
return -12;
return with_runtime(|runtime| runtime.time_precision().exponent())
.unwrap_or_else(|| celox_design::TimePrecision::default().exponent());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep per-module scales for non-null VPI queries

When reference identifies a module whose declared scale differs from the design-wide minimum, this early return ignores the handle and reports the global precision for both properties. The VPI definitions define these as the module time unit and module time precision for an object handle; only a null-handle query returns the simulation-wide unit. For example, a 1us / 100ns module in a design with global precision 1fs now reports -15 for both instead of -6 and -7, causing VPI clients to apply the wrong scale to module-local timing. Preserve each reflected scope's unit and precision and use the global value only for null references.

Useful? React with 👍 / 👎.

VCD headers labeled every timestamp as 1ns and VPI reported 1ps regardless
of the design. Carry the analyzer's global precision through symbolic modules
and assembly into the runtime design, and retain it in native images. Use it
for VCD headers and null-handle VPI queries, including restarted waveforms and
NAPI compiled-code cache hits. Retain local module units and precisions in
reflected scopes so module and signal VPI queries report their own scales
(IEEE 1800-2023 37.10 and 38.6), including after native-image reload.

Default Veryl and scale-free frontend ticks to 1ps, matching SV's default.
Update Playground VCD downloads and document the waveform compatibility
change. Bump the native image container to version 14 for the added metadata.

Validation:
- Precision regressions on native, Cranelift, Wasm, interpreter, tiered, and native/Cranelift parallel configurations; mixed-language designs, package precision, image roundtrips, and VCD restarts.
- Existing VCD and time-query regressions, Celox and affected frontend/runtime unit tests, VPI tests, Rust doctests, and the portable compiler configuration.
- Live cocotb attached-image integration.
- Rebuilt NAPI; simulator, simulation, checkpoint, e2e and timing-addon JS tests; cached-waveform precision regression.
- Playground waveform export test and TypeScript checks; formatting, Clippy, and Biome.

BREAKING CHANGE: Default VCD headers now use 1ps instead of 1ns. Recompile
native images for container version 14. SimModule and ElaboratedDesign struct
literals must provide the added timing metadata fields; ReflectionScope literals
must provide time_scale.

Fixes #1463

Change-Id: Ia5ff9cd5337ce608ea2f6fdd56fda0711d1a21bb
@tignear
tignear force-pushed the stack/tignear/fix/design-time-precision/preserve-global-precision-vcd-vpi--a5ff9cd5 branch from 78c3310 to 02ef771 Compare October 18, 2026 01:59
@tignear

tignear commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

Revision history

# Type Changes Reason Date
1 initial 78c3310 2026-10-18 01:58 UTC
2 content 78c3310 → 02ef771 Address PR #1471 review: preserve per-module VPI time units and precisions in reflected scopes instead of returning global precision for every handle. 2026-10-18 01:58 UTC

@mergify mergify Bot added the queued Mergify queue entry label Oct 18, 2026
@mergify

mergify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 54 minutes 15 seconds in the queue, including 47 minutes 41 seconds running CI.

Required conditions to merge
  • check-success = Conventional Commit title
  • check-success = Queue validation
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Lint & Format
    • check-neutral = @github-actions/Lint & Format
    • check-skipped = @github-actions/Lint & Format
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-neutral = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-skipped = @github-actions/NAPI Build (Linux ARM64 GNU)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/NAPI Build (Windows)
    • check-neutral = @github-actions/NAPI Build (Windows)
    • check-skipped = @github-actions/NAPI Build (Windows)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Rust Test & NAPI Build
    • check-neutral = @github-actions/Rust Test & NAPI Build
    • check-skipped = @github-actions/Rust Test & NAPI Build
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/JS Test (Ubuntu)
    • check-neutral = @github-actions/JS Test (Ubuntu)
    • check-skipped = @github-actions/JS Test (Ubuntu)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/JS Test (Windows)
    • check-neutral = @github-actions/JS Test (Windows)
    • check-skipped = @github-actions/JS Test (Windows)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Conventional Commit title
    • check-neutral = @github-actions/Conventional Commit title
    • check-skipped = @github-actions/Conventional Commit title

@mergify
mergify Bot merged commit 7045c50 into master Oct 18, 2026
32 checks passed
@mergify
mergify Bot deleted the stack/tignear/fix/design-time-precision/preserve-global-precision-vcd-vpi--a5ff9cd5 branch October 18, 2026 03:30
@mergify mergify Bot removed the queued Mergify queue entry label Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-ready Request merging through Mergify after required checks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VCD timescale and VPI time precision ignore the design precision

1 participant