peripherals: sync trng blocks with latest bitstream

The bitstream definition for the TRNG blocks has changed. Update the
Renode models to match.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2021-06-21 13:54:53 +08:00
parent 80860f0a51
commit 6691c6e4a7
2 changed files with 28 additions and 7 deletions

View file

@ -33,6 +33,14 @@ namespace Antmicro.Renode.Peripherals.Miscellaneous
{ {
return (uint)rng.Next(); return (uint)rng.Next();
}, name: "DATA"); }, name: "DATA");
Registers.URANDOM.Define(this)
.WithValueField(0, 32, FieldMode.Read, valueProviderCallback: _ =>
{
return (uint)rng.Next();
}, name: "URANDOM");
Registers.URANDOM_VALID.Define(this)
.WithFlag(0, FieldMode.Read, valueProviderCallback: _ => { return true; }, name: "URANDOM_VALID");
} }
private readonly PseudorandomNumberGenerator rng = EmulationManager.Instance.CurrentEmulation.RandomGenerator; private readonly PseudorandomNumberGenerator rng = EmulationManager.Instance.CurrentEmulation.RandomGenerator;
@ -42,9 +50,11 @@ namespace Antmicro.Renode.Peripherals.Miscellaneous
{ {
STATUS = 0x0, STATUS = 0x0,
DATA = 0x4, DATA = 0x4,
EV_STATUS = 0x8, URANDOM = 0x8,
EV_PENDING = 0x0c, URANDOM_VALID = 0xc,
EV_ENABLE = 0x10, EV_STATUS = 0x10,
EV_PENDING = 0x14,
EV_ENABLE = 0x18,
} }
} }
} }

View file

@ -33,6 +33,13 @@ namespace Antmicro.Renode.Peripherals.Miscellaneous
{ {
return (uint)rng.Next(); return (uint)rng.Next();
}, name: "DATA"); }, name: "DATA");
Registers.URANDOM.Define(this)
.WithValueField(0, 32, FieldMode.Read, valueProviderCallback: _ =>
{
return (uint)rng.Next();
}, name: "URANDOM");
Registers.URANDOM_VALID.Define(this)
.WithFlag(0, FieldMode.Read, valueProviderCallback: _ => { return true; }, name: "URANDOM_VALID");
} }
private readonly PseudorandomNumberGenerator rng = EmulationManager.Instance.CurrentEmulation.RandomGenerator; private readonly PseudorandomNumberGenerator rng = EmulationManager.Instance.CurrentEmulation.RandomGenerator;
@ -45,10 +52,14 @@ namespace Antmicro.Renode.Peripherals.Miscellaneous
STATUS = 0x8, STATUS = 0x8,
AV_CONFIG = 0xc, AV_CONFIG = 0xc,
RO_CONFIG = 0x10, RO_CONFIG = 0x10,
ERRORS = 0x14,
EV_STATUS = 0x18, READY = 0xd8,
EV_PENDING = 0x1c, EV_STATUS = 0xdc,
EV_ENABLE = 0x20, EV_PENDING = 0xe0,
EV_ENABLE = 0xe4,
URANDOM = 0xf0,
URANDOM_VALID = 0xf4,
TEST = 0xf8,
} }
} }
} }