Skip to content

Comments

codegen: switch testbench RNG to 64-bit#11

Merged
strimo378 merged 1 commit intomainfrom
codex/add-custom-libc-independent-random-number-generator
Jan 10, 2026
Merged

codegen: switch testbench RNG to 64-bit#11
strimo378 merged 1 commit intomainfrom
codex/add-custom-libc-independent-random-number-generator

Conversation

@strimo378
Copy link
Contributor

Motivation

  • Replace the libc rand()-based generator with a deterministic 64-bit RNG to improve portability and randomness quality in generated testbenches.
  • Produce reproducible testbench inputs without relying on environment-specific rand() behavior.

Description

  • Update the testbench template to use a 64-bit xorshift RNG with static uint64_t rng_state, rng_next_u64() and rng_next_float() scaled by 2^64.
  • Replace emitted testbench include from <stdlib.h> to <stdint.h> in c_emitter.py so the generated code compiles with the new 64-bit types.
  • Refresh the golden snapshot tests/golden/add_model_testbench.c to reflect the new 64-bit RNG helper and float generation.

Testing

  • Ran the test suite with pytest -n auto -q and all tests passed.
  • Test run result: 11 passed.

Codex Task

@strimo378 strimo378 merged commit d885abc into main Jan 10, 2026
0 of 2 checks passed
@strimo378 strimo378 deleted the codex/add-custom-libc-independent-random-number-generator branch January 10, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant