[sw, dif_plic] Fulfil S1 Checklist DIF_TEST_SANITY requirement
DIF_TEST_SANITY (requirement):
Sanity tests exist for the DIF in sw/device/tests/dif named dif_<ip>_sanitytest.c.
This should perform a basic test of the main datapath of the hardware
module by the embedded core, via the DIF, and should be able to be run
on all OpenTitan platforms (including FPGA, simulation, and DV). This
test will be shared with DV.
Sanity tests are for diagnosing major issues in both software and
hardware, and with this in mind, they should execute
quickly. Initially we expect this kind of test to be written by
hardware designers for debugging issues during module
development. This happens long before a DIF is implemented, so there
are no requirements on how these should work, though we suggest they
are placed in sw/device/tests/<ip>/<ip>.c as this has been the
convention until now. Later, when a DIF is written, the DIF author is
responsible for updating this test to use the DIF, and for moving this
test into the aforementioned location.
CHANGE:
This change renames consecutive_irqs_test to dif_plic_sanitytest, and
places the source from sw/device/tests/ to sw/device/tests/dif/.
Signed-off-by: Silvestrs Timofejevs <silvestrst@lowrisc.org>
diff --git a/ci/run_verilator_pytest.sh b/ci/run_verilator_pytest.sh
index 46f774a..09ebb11 100755
--- a/ci/run_verilator_pytest.sh
+++ b/ci/run_verilator_pytest.sh
@@ -17,7 +17,7 @@
TEST_TARGETS=(
"examples/hello_usbdev/hello_usbdev_sim_verilator.elf"
"tests/aes_test_sim_verilator.elf"
- "tests/consecutive_irqs_test_sim_verilator.elf"
+ "tests/dif_plic_sanitytest_sim_verilator.elf"
"tests/flash_ctrl_test_sim_verilator.elf"
"tests/sha256_test_sim_verilator.elf"
"tests/rv_timer_test_sim_verilator.elf"
diff --git a/hw/top_earlgrey/dv/chip_sim_cfg.hjson b/hw/top_earlgrey/dv/chip_sim_cfg.hjson
index b348be1..a174b8d 100644
--- a/hw/top_earlgrey/dv/chip_sim_cfg.hjson
+++ b/hw/top_earlgrey/dv/chip_sim_cfg.hjson
@@ -109,9 +109,9 @@
sw_test: sw/device/tests/aes_test
}
{
- name: chip_consecutive_irqs_test
+ name: chip_dif_plic_sanitytest
uvm_test_seq: chip_sw_base_vseq
- sw_test: sw/device/tests/consecutive_irqs_test
+ sw_test: sw/device/tests/dif/dif_plic_sanitytest
}
{
name: chip_flash_ctrl_test
diff --git a/sw/device/tests/consecutive_irqs_test.c b/sw/device/tests/dif/dif_plic_sanitytest.c
similarity index 99%
rename from sw/device/tests/consecutive_irqs_test.c
rename to sw/device/tests/dif/dif_plic_sanitytest.c
index a37a6b6..5d8a3b0 100644
--- a/sw/device/tests/consecutive_irqs_test.c
+++ b/sw/device/tests/dif/dif_plic_sanitytest.c
@@ -2,11 +2,11 @@
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
-#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h" // Generated.
+#include "sw/device/lib/dif/dif_plic.h"
+
#include "sw/device/lib/arch/device.h"
#include "sw/device/lib/base/log.h"
#include "sw/device/lib/base/mmio.h"
-#include "sw/device/lib/dif/dif_plic.h"
#include "sw/device/lib/dif/dif_uart.h"
#include "sw/device/lib/handler.h"
#include "sw/device/lib/irq.h"
@@ -14,6 +14,8 @@
#include "sw/device/lib/testing/test_main.h"
#include "sw/device/lib/testing/test_status.h"
+#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h" // Generated.
+
#define PLIC_TARGET kTopEarlgreyPlicTargetIbex0
#define kDifPlicMinPriority 0u
diff --git a/sw/device/tests/dif/meson.build b/sw/device/tests/dif/meson.build
index 63b8d68..1074cd7 100644
--- a/sw/device/tests/dif/meson.build
+++ b/sw/device/tests/dif/meson.build
@@ -48,4 +48,22 @@
native: true,
c_args: ['-DMOCK_MMIO'],
cpp_args: ['-DMOCK_MMIO'],
-))
\ No newline at end of file
+))
+
+dif_plic_sanitytest_lib = declare_dependency(
+ link_with: static_library(
+ 'dif_plic_sanitytest_lib',
+ sources: ['dif_plic_sanitytest.c'],
+ dependencies: [
+ dif_uart,
+ dif_plic,
+ sw_lib_irq,
+ sw_lib_mmio,
+ sw_lib_base_log,
+ sw_lib_runtime_hart,
+ sw_lib_testing_test_status,
+ ],
+ ),
+)
+
+sw_tests += { 'dif_plic_sanitytest': dif_plic_sanitytest_lib }
diff --git a/sw/device/tests/meson.build b/sw/device/tests/meson.build
index 05b559c..351443b 100644
--- a/sw/device/tests/meson.build
+++ b/sw/device/tests/meson.build
@@ -18,22 +18,6 @@
),
)
-consecutive_irqs_test_lib = declare_dependency(
- link_with: static_library(
- 'consecutive_irqs_test_lib',
- sources: ['consecutive_irqs_test.c'],
- dependencies: [
- dif_uart,
- dif_plic,
- sw_lib_irq,
- sw_lib_mmio,
- sw_lib_base_log,
- sw_lib_runtime_hart,
- sw_lib_testing_test_status,
- ],
- ),
-)
-
flash_ctrl_test_lib = declare_dependency(
link_with: static_library(
'flash_ctrl_test_lib',
@@ -75,7 +59,6 @@
sw_tests += {
'aes_test': aes_test_lib,
- 'consecutive_irqs_test': consecutive_irqs_test_lib,
'flash_ctrl_test': flash_ctrl_test_lib,
'rv_timer_test': rv_timer_test_lib,
'sha256_test': sha256_test_lib,