From 11dd2c6c0980f3ededd796aa1e9bad1be9dbfe71 Mon Sep 17 00:00:00 2001 From: Erin Le Date: Mon, 28 Oct 2024 15:00:19 -0700 Subject: [PATCH] stdlib: address requested changes to X86, Riscv boards This commit addresses the requested changes. An additional comment is added for clarification, the exception type is changed, and a few of the error messages have been modified. --- .../gem5/components/boards/riscv_board.py | 20 ++++++++++--------- .../gem5/components/boards/x86_board.py | 19 +++++++++--------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/python/gem5/components/boards/riscv_board.py b/src/python/gem5/components/boards/riscv_board.py index e71015c046..5c3eb187bd 100644 --- a/src/python/gem5/components/boards/riscv_board.py +++ b/src/python/gem5/components/boards/riscv_board.py @@ -147,6 +147,7 @@ class RiscvBoard(AbstractSystemBoard, KernelDiskWorkload, SEBinaryWorkload): self._off_chip_devices = [self.platform.uart, self.disk, self.rng] else: + # SE mode board setup pass def _setup_io_devices(self) -> None: @@ -213,9 +214,9 @@ class RiscvBoard(AbstractSystemBoard, KernelDiskWorkload, SEBinaryWorkload): @overrides(AbstractSystemBoard) def get_dma_ports(self) -> List[Port]: - raise NotImplementedError( - "RISCVBoard does not have DMA Ports. " - "Use `has_dma_ports()` to check this." + raise Exception( + "Cannot execute `get_dma_ports()`: Board does not have DMA ports " + "to return. Use `has_dma_ports()` to check this." ) @overrides(AbstractSystemBoard) @@ -227,9 +228,9 @@ class RiscvBoard(AbstractSystemBoard, KernelDiskWorkload, SEBinaryWorkload): if self.has_io_bus(): return self.iobus else: - raise NotImplementedError( - "Board was not configured for FS mode and does not have an " - "I/O bus. Use `has_io_bus()` to check this." + raise Exception( + "Cannot execute `get_io_bus()`: Board does not have an I/O " + "bus to return. Use `has_io_bus()` to check this." ) @overrides(AbstractSystemBoard) @@ -241,9 +242,10 @@ class RiscvBoard(AbstractSystemBoard, KernelDiskWorkload, SEBinaryWorkload): if self.has_coherent_io(): return self.iobus.mem_side_ports else: - raise NotImplementedError( - "Board was not configured for FS mode and does not have any " - "I/O ports. Use has_coherent_io to check this." + raise Exception( + "Cannot execute `get_mem_side_coherent_io_port()`: Board does " + "not have any I/O ports to return. Use `has_coherent_io()` to " + "check this." ) @overrides(AbstractSystemBoard) diff --git a/src/python/gem5/components/boards/x86_board.py b/src/python/gem5/components/boards/x86_board.py index eb2cbaa942..557c96881e 100644 --- a/src/python/gem5/components/boards/x86_board.py +++ b/src/python/gem5/components/boards/x86_board.py @@ -300,9 +300,9 @@ class X86Board(AbstractSystemBoard, KernelDiskWorkload, SEBinaryWorkload): if self.has_io_bus(): return self.iobus else: - raise NotImplementedError( - "Board was not configured for FS mode and does not have an " - "I/O bus. Use `has_io_bus()` to check this." + raise Exception( + "Cannot execute `get_io_bus()`: Board does not have an I/O " + "bus to return. Use `has_io_bus()` to check this." ) @overrides(AbstractSystemBoard) @@ -314,9 +314,9 @@ class X86Board(AbstractSystemBoard, KernelDiskWorkload, SEBinaryWorkload): if self.has_dma_ports(): return [self.pc.south_bridge.ide.dma, self.iobus.mem_side_ports] else: - raise NotImplementedError( - "Board was not configured for FS mode and does not have DMA " - "ports. Use `has_dma_ports()` to check this." + raise Exception( + "Cannot execute `get_dma_ports()`: Board does not have DMA " + "ports to return. Use `has_dma_ports()` to check this." ) @overrides(AbstractSystemBoard) @@ -328,9 +328,10 @@ class X86Board(AbstractSystemBoard, KernelDiskWorkload, SEBinaryWorkload): if self.has_coherent_io(): return self.iobus.mem_side_ports else: - raise NotImplementedError( - "Board was not configured for FS mode and does not have I/O " - "ports. Use has_coherent_io to check this." + raise Exception( + "Cannot execute `get_mem_side_coherent_io_port()`: Board does " + "not have I/O ports to return. Use `has_coherent_io()` to " + "check this." ) @overrides(AbstractSystemBoard)