mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-08 04:56:43 +00:00
emulation: update renode models to include trng
Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
21b54a5033
commit
e88b4cae7c
5 changed files with 861 additions and 751 deletions
|
|
@ -4,41 +4,36 @@ cpu: CPU.VexRiscv @ sysbus
|
|||
privilegeArchitecture: PrivilegeArchitecture.Priv1_10
|
||||
|
||||
uart: UART.LiteX_UART @ {
|
||||
sysbus 0x60008000;
|
||||
sysbus 0xF0008000 // shadow
|
||||
sysbus 0x60006000;
|
||||
sysbus 0xF0006000 // shadow
|
||||
}
|
||||
-> cpu@1002
|
||||
|
||||
uartconsole: UART.LiteX_UART @ {
|
||||
sysbus 0x6000A000;
|
||||
sysbus 0xF000A000 // shadow
|
||||
sysbus 0x60007000;
|
||||
sysbus 0xF0007000 // shadow
|
||||
}
|
||||
-> cpu@1003
|
||||
|
||||
uartserver0: UART.LiteX_UART @ {
|
||||
sysbus 0x6000C000;
|
||||
sysbus 0xF000C000 // shadow
|
||||
sysbus 0x60008000;
|
||||
sysbus 0xF0008000 // shadow
|
||||
}
|
||||
-> cpu@1004
|
||||
|
||||
uartserver1: UART.LiteX_UART @ {
|
||||
sysbus 0x6000E000;
|
||||
sysbus 0xF000E000 // shadow
|
||||
sysbus 0x60009000;
|
||||
sysbus 0xF0009000 // shadow
|
||||
}
|
||||
-> cpu@1005
|
||||
|
||||
timer0: Timers.LiteX_Timer_32 @ {
|
||||
sysbus 0x60003000;
|
||||
sysbus 0xF0003000 // shadow
|
||||
sysbus 0x60002000;
|
||||
sysbus 0xF0002000 // shadow
|
||||
}
|
||||
frequency: 100000000
|
||||
-> cpu@1001
|
||||
|
||||
//spi: SPI.PicoRV_SPI @ {
|
||||
// sysbus 0x60004000;
|
||||
// sysbus 0xe0004000 // shadow
|
||||
//}
|
||||
|
||||
rom: Memory.MappedMemory @ {
|
||||
sysbus 0x00000000;
|
||||
sysbus 0x80000000 // shadow
|
||||
|
|
@ -54,16 +49,20 @@ sram: Memory.MappedMemory @ {
|
|||
fbmem: Memory.MappedMemory @ sysbus 0xB0000000
|
||||
size: 0x6000
|
||||
|
||||
memlcd: Video.BetrustedLCD @ sysbus 0xF0011000
|
||||
memlcd: Video.BetrustedLCD @ sysbus 0xF000C000
|
||||
|
||||
kbd: Input.BetrustedKbd @ sysbus 0xF0006000
|
||||
keyboard: Input.BetrustedKbd @ sysbus 0xF0015000
|
||||
|
||||
trng_server: Miscellaneous.BetrustedRNGServer @ sysbus 0xF001A000
|
||||
|
||||
trng_kernel: Miscellaneous.BetrustedRNGKernel @ sysbus 0xF0019000
|
||||
|
||||
cpu_timer: Timers.LiteX_CPUTimer @ sysbus 0xf0000800
|
||||
frequency: 100000000
|
||||
// IRQ #100 is Machine Timer Interrupt
|
||||
-> cpu@100
|
||||
|
||||
ticktimer: Timers.TickTimer @ sysbus 0xF0017000
|
||||
ticktimer: Timers.TickTimer @ sysbus 0xF0012000
|
||||
periodInMs: 1
|
||||
-> cpu @ 1008
|
||||
|
||||
|
|
@ -78,7 +77,5 @@ flash_mem: Memory.MappedMemory @ {
|
|||
|
||||
sysbus:
|
||||
init:
|
||||
Tag <0xe0000000 0x800> "CTRL"
|
||||
Tag <0xE0006000 0x800> "REBOOT"
|
||||
Tag <0xE0006800 0x800> "RGB"
|
||||
Tag <0xE0007000 0x800> "VERSION"
|
||||
Tag <0xF0000000 0x1000> "CTRL"
|
||||
Tag <0xF001B000 0x1000> "TRNG"
|
||||
|
|
|
|||
48
emulation/peripherals/trng_kernel.cs
Normal file
48
emulation/peripherals/trng_kernel.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
//
|
||||
// Copyright (c) 2010-2019 Antmicro
|
||||
//
|
||||
// This file is licensed under the MIT License.
|
||||
// Full license text is available in 'licenses/MIT.txt'.
|
||||
//
|
||||
using Antmicro.Renode.Core;
|
||||
using Antmicro.Renode.Core.Structure.Registers;
|
||||
using Antmicro.Renode.Logging;
|
||||
|
||||
namespace Antmicro.Renode.Peripherals.Miscellaneous
|
||||
{
|
||||
public class BetrustedRNGKernel : BasicDoubleWordPeripheral, IKnownSize
|
||||
{
|
||||
public BetrustedRNGKernel(Machine machine) : base(machine)
|
||||
{
|
||||
DefineRegisters();
|
||||
}
|
||||
|
||||
public long Size { get { return 0x1000; } }
|
||||
|
||||
private void DefineRegisters()
|
||||
{
|
||||
Registers.STATUS.Define(this) // RDY is set on reset
|
||||
.WithValueField(0, 32, FieldMode.Read, valueProviderCallback: _ =>
|
||||
{
|
||||
return 3;
|
||||
}, name: "STATUS");
|
||||
|
||||
Registers.DATA.Define(this)
|
||||
.WithValueField(0, 32, FieldMode.Read, valueProviderCallback: _ =>
|
||||
{
|
||||
return (uint)rng.Next();
|
||||
}, name: "DATA");
|
||||
}
|
||||
|
||||
private readonly PseudorandomNumberGenerator rng = EmulationManager.Instance.CurrentEmulation.RandomGenerator;
|
||||
|
||||
private enum Registers
|
||||
{
|
||||
STATUS = 0x0,
|
||||
DATA = 0x4,
|
||||
EV_STATUS = 0x8,
|
||||
EV_PENDING = 0x0c,
|
||||
EV_ENABLE = 0x10,
|
||||
}
|
||||
}
|
||||
}
|
||||
52
emulation/peripherals/trng_server.cs
Normal file
52
emulation/peripherals/trng_server.cs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
//
|
||||
// Copyright (c) 2010-2019 Antmicro
|
||||
//
|
||||
// This file is licensed under the MIT License.
|
||||
// Full license text is available in 'licenses/MIT.txt'.
|
||||
//
|
||||
using Antmicro.Renode.Core;
|
||||
using Antmicro.Renode.Core.Structure.Registers;
|
||||
using Antmicro.Renode.Logging;
|
||||
|
||||
namespace Antmicro.Renode.Peripherals.Miscellaneous
|
||||
{
|
||||
public class BetrustedRNGServer : BasicDoubleWordPeripheral, IKnownSize
|
||||
{
|
||||
public BetrustedRNGServer(Machine machine) : base(machine)
|
||||
{
|
||||
DefineRegisters();
|
||||
}
|
||||
|
||||
public long Size { get { return 0x1000; } }
|
||||
|
||||
private void DefineRegisters()
|
||||
{
|
||||
Registers.STATUS.Define(this) // RDY is set on reset
|
||||
.WithValueField(0, 32, FieldMode.Read, valueProviderCallback: _ =>
|
||||
{
|
||||
return (1 << 0) | (1 << 21);
|
||||
}, name: "STATUS");
|
||||
|
||||
Registers.DATA.Define(this)
|
||||
.WithValueField(0, 32, FieldMode.Read, valueProviderCallback: _ =>
|
||||
{
|
||||
return (uint)rng.Next();
|
||||
}, name: "DATA");
|
||||
}
|
||||
|
||||
private readonly PseudorandomNumberGenerator rng = EmulationManager.Instance.CurrentEmulation.RandomGenerator;
|
||||
|
||||
private enum Registers
|
||||
{
|
||||
CONTROL = 0x0,
|
||||
STATUS = 0x4,
|
||||
DATA = 0x8,
|
||||
AV_CONFIG = 0xc,
|
||||
RO_CONFIG = 0x10,
|
||||
ERRORS = 0x14,
|
||||
EV_STATUS = 0x18,
|
||||
EV_PENDING = 0x1c,
|
||||
EV_ENABLE = 0x20,
|
||||
}
|
||||
}
|
||||
}
|
||||
1469
emulation/renode.svd
1469
emulation/renode.svd
File diff suppressed because it is too large
Load diff
|
|
@ -13,6 +13,8 @@ i @peripherals/LiteX_Timer_32.cs
|
|||
i @peripherals/memlcd.cs
|
||||
i @peripherals/keyboard.cs
|
||||
i @peripherals/ticktimer.cs
|
||||
i @peripherals/trng_kernel.cs
|
||||
i @peripherals/trng_server.cs
|
||||
|
||||
# Load the Betrusted Renode Platform file
|
||||
machine LoadPlatformDescription @betrusted.repl
|
||||
|
|
|
|||
Loading…
Reference in a new issue