stdlib: Added LupioRNG to LupVBoard
This adds the LupioRNG device to our LupVBoard, adding
random number generation capability to this RISC-V
based system.
Change-Id: I89c78c119a46cc7b056005d8abef16b1816ee4c4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/53030
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
diff --git a/src/python/gem5/components/boards/lupv_board.py b/src/python/gem5/components/boards/lupv_board.py
index 18f0337..0316def 100644
--- a/src/python/gem5/components/boards/lupv_board.py
+++ b/src/python/gem5/components/boards/lupv_board.py
@@ -48,6 +48,7 @@
Plic,
Uart8250,
Terminal,
+ LupioRNG,
LupioRTC,
LupV,
AddrRange,
@@ -97,7 +98,7 @@
# Initialize all the devices that we want to use on this board
# Interrupt IDS for PIC Device
- self._int_ids = { 'UART': 1, 'DISK': 2}
+ self._int_ids = { 'UART': 1, 'DISK': 2, 'RNG': 3}
# CLINT
self.clint = Clint(pio_addr=0x2000000)
@@ -111,6 +112,13 @@
uart_int_id = self._int_ids['UART']
)
+ # LUPIO RNG
+ self.lupio_rng = LupioRNG(
+ pio_addr=0x20005000,
+ platform = self.lupv,
+ int_id = self._int_ids['RNG']
+ )
+
# LUPIO RTC
self.lupio_rtc = LupioRTC(pio_addr=0x20004000)
@@ -128,7 +136,8 @@
pic_srcs = [
self._int_ids['UART'],
- self._int_ids['DISK']
+ self._int_ids['DISK'],
+ self._int_ids['RNG']
]
self.pic.n_contexts = self.processor.get_num_cores() * 2
self.pic.n_src = max(pic_srcs) + 1
@@ -150,6 +159,7 @@
self._off_chip_devices = [
self.uart,
self.disk,
+ self.lupio_rng,
self.lupio_rtc
]
@@ -383,6 +393,19 @@
disk_node.appendCompatible(["virtio,mmio"])
soc_node.append(disk_node)
+ # LupioRNG Device
+ lupio_rng = self.lupio_rng
+ lupio_rng_node = lupio_rng.generateBasicPioDeviceNode(soc_state,
+ "lupio-rng", lupio_rng.pio_addr,lupio_rng.pio_size)
+ lupio_rng_node.appendCompatible(["lupio,rng"])
+ lupio_rng_node.append(
+ FdtPropertyWords("interrupts",
+ [self.lupio_rng.int_id]))
+ lupio_rng_node.append(
+ FdtPropertyWords("interrupt-parent",
+ state.phandle(self.pic)))
+ soc_node.append(lupio_rng_node)
+
# LupioRTC Device
lupio_rtc = self.lupio_rtc
lupio_rtc_node = lupio_rtc.generateBasicPioDeviceNode(