mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
fixup rand for simulation target
TRNG doesn't exist in simulation - substitute it for a deterministic PRNG when the simulation target is specified.
This commit is contained in:
parent
4b99406277
commit
4f8169c3d9
2 changed files with 8 additions and 2 deletions
|
|
@ -2,7 +2,11 @@
|
|||
// SPDX-FileCopyrightText: 2024 bunnie <bunnie@kosagi.com>
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#[cfg(feature = "bao1x")]
|
||||
#[cfg(all(feature = "bao1x", not(feature = "verilator-only")))]
|
||||
#[path = "rand.rs"]
|
||||
pub mod rand;
|
||||
#[cfg(all(feature = "bao1x", feature = "verilator-only"))]
|
||||
#[path = "rand_fake.rs"]
|
||||
pub mod rand;
|
||||
|
||||
#[cfg(any(feature = "debug-print", feature = "print-panics"))]
|
||||
|
|
|
|||
|
|
@ -24,7 +24,9 @@ static LOCAL_RNG_STATE: [AtomicU32; 8] = [
|
|||
|
||||
pub fn init() {}
|
||||
|
||||
/// This a fully deterministic PRNG that relies on Chacha8 for state evolution.
|
||||
/// This a fully deterministic PRNG that relies on Chacha8 for state evolution. This is
|
||||
/// used in verilator simulation environments.
|
||||
#[cfg(feature = "verilator-only")]
|
||||
pub fn get_u32() -> u32 {
|
||||
// Local storage for the seed.
|
||||
let mut seed = [0u8; 32];
|
||||
|
|
|
|||
Loading…
Reference in a new issue