Repository navigation
fix(sv): scale and round real-valued delays - #1723
Merged
Merged
Conversation
A real delay used its IEEE bit pattern as an integral delay. Scale it to precision steps of its scope, round ties away from zero (IEEE 1800-2023 3.14.1, 6.12.1), and read a negative result as a two's-complement time (9.4.1); a NaN delay waits zero. Unparenthesized real literals such as #1.5 are accepted as delay values. Fixes #1707. Change-Id: I3456fc82b11d94301a99a1f26713e53cedc36b02
Change-Id: I16e53bbe8443848786f4d8debb9e84409384645e
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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
|
Queued — the merge queue status continues in this comment ↓. |
Contributor
Merge Queue Status
This pull request spent 1 hour 3 minutes 19 seconds in the queue, including 1 hour 1 minute 6 seconds running CI. Required conditions to merge
|
40 of 71 tasks
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.
Fixes #1707. Part of #1123.
A real-valued delay used its IEEE bit pattern as an integral delay.
shortreal r = 1.5; #rwaited 1069547520 ticks.real r = 1.5; #rand#(0.5 + 1)stopped with "simulation delay overflows the simulation time range".Change
Analyzer:
Stmt::Delayalso carriesticks_per_precision, the global ticks in one precision step of the declaring scope. It comes from the same timescale lookup asticks_per_unit(time_divisorand the newprecision_divisorshare one helper).Frontend (
ff.rsdelay/real_delay): a delay whose amount is real or shortreal is:Integral delays take the same path as before.
Analyzer: an unparenthesized real literal such as
#1.5is accepted as a delay value (delay_value ::= real_number, A.2.2.3). It was rejected as "delay value" before; the analyzer test that pinned that rejection is removed.Tests
timing.vtestreal_delays_round_at_the_scope_precision(default 1ns/1ps):#(r * 2)waits 5.5 ns.negative_real_delays_wait_their_twos_complement:#(-1.5)does not wake before$finish.verify-sv-icarusandverify-sv-verilator --freshpass both cases, and the retainedtiming.jsondiffs only add lines.real_delays_round_at_scope_precision: exact picosecond times at O0 and O1, in a 1 ns/1 ps scope (2.7505 → 2751 ps) and a 1 ns/100 ps scope (2.75 → 2.8, 1.25 → 1.3, shortreal 0.05 → 0.1).Docs
The EN and JA SV guide and reference now describe real delays (rounding, negative, NaN) and drop the #1707 links.
Validation
--test systemverilog: 3661 passed.-D warningsand fmt are clean.pnpm docs:buildpasses.expected.tsv.