Skip to content

SimulatorAvr runs on past 71.6 minutes - #131

Merged
theAndreas merged 1 commit into
mainfrom
simulator-avr-time-wrap
Nov 17, 2026
Merged

theAndreas merged 1 commit into
mainfrom
simulator-avr-time-wrap

Conversation

@theAndreas

Copy link
Copy Markdown
Owner

SimulatorAvr with --web, --tcp or without --for runs until Ctrl+C. After 71.6 minutes of simulated time it stood still: the panel froze, and the page or the control program got no answers any more. Now it runs on. Nothing changes for a sketch or for the library.

The simulated time to run to was converted into cycles through simavr's own helper, which takes the microseconds as a 32-bit number; past 4294967 ms that wrapped, and every stretch after it ended before it began. The cycles are computed in 64 bits now. Found in the review of the chapter Types of OIL item 41, though it is no rule of that chapter.

The simulated time as milliseconds, which nothing asked for, goes with it.

Checked:

  • A new test, simulator/SimulatorAvrTest.*, checks the cycles of a time past the wrap; with the old arithmetic put back it fails, with the fix it passes. It is built wherever simavr is, as SimulatorAvr, which CI installs.
  • make check passes, the examples in simavr among it.
  • A run of 72 minutes was not made; the test checks the arithmetic alone.

The end of each stretch of simulated time was taken from simavr's own
conversion, which takes the microseconds as a uint32_t: past 4294967 ms
it wrapped, the end fell below the cycles already run, and Run() ran
none. A run of the page or the control program lasts until Ctrl+C, so
the AVR stood still after 71.6 minutes. The cycles are computed in 64
bits now, by a function of SimulatorAvr's own, which SimulatorAvrTest
checks past the wrap; it fails with the old arithmetic.

GetMillis(), which nothing called, goes.
@theAndreas
theAndreas merged commit 4bebf9d into main Nov 17, 2026
12 checks passed
@theAndreas
theAndreas deleted the simulator-avr-time-wrap branch November 17, 2026 16:09
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