Merge "Update DV make script"
diff --git a/hw/top_matcha/dv/chip_sim_cfg.hjson b/hw/top_matcha/dv/chip_sim_cfg.hjson
index 1712c5b..f32f306 100644
--- a/hw/top_matcha/dv/chip_sim_cfg.hjson
+++ b/hw/top_matcha/dv/chip_sim_cfg.hjson
@@ -1148,7 +1148,7 @@
     {
       name: chip_sw_alert_handler_escalation
       uvm_test_seq: chip_sw_alert_handler_escalation_vseq
-      sw_images: ["//sw/device/tests/sim_dv:alert_handler_escalation_test:1"]
+      sw_images: ["//sw/device/tests/sim_dv:alert_handler_escalation_test:1:matcha"]
       en_run_modes: ["sw_test_mode_test_rom"]
       // Disable scoreboard to avoid incorrect alert prediction from the alert_monitor. Due to the
       // cross-domain alert senders and receivers, the monitor from the chip level did not support
@@ -1158,7 +1158,7 @@
     {
       name: chip_sw_alert_handler_ping_timeout
       uvm_test_seq: chip_sw_base_vseq
-      sw_images: ["//sw/device/tests:alert_handler_ping_timeout_test:1"]
+      sw_images: ["//sw/device/tests:alert_handler_ping_timeout_test:1:matcha"]
       en_run_modes: ["sw_test_mode_test_rom"]
       // Disable scoreboard to avoid incorrect alert prediction from the alert_monitor. Due to the
       // cross-domain alert senders and receivers, the monitor from the chip level did not support
@@ -1874,6 +1874,8 @@
       tests: [
         "chip_rv_dm_ndm_reset_req",
         "chip_sw_aes_smoketest",
+        "chip_sw_alert_handler_escalation",
+        "chip_sw_alert_handler_ping_timeout",
         "chip_sw_alert_test",
         "chip_sw_aon_timer_smoketest",
         "chip_sw_clkmgr_smoketest",
@@ -1911,6 +1913,8 @@
       tests: [
         "chip_rv_dm_ndm_reset_req",
         "chip_sw_aes_smoketest",
+        "chip_sw_alert_handler_escalation",
+        "chip_sw_alert_handler_ping_timeout",
         "chip_sw_alert_test",
         "chip_sw_aon_timer_smoketest",
         "chip_sw_clkmgr_smoketest",
diff --git a/rules/matcha_test.bzl b/rules/matcha_test.bzl
index da5e54d..f24991f 100644
--- a/rules/matcha_test.bzl
+++ b/rules/matcha_test.bzl
@@ -14,7 +14,12 @@
 
 """Rules to build matcha test targets"""
 
-load("//rules:matcha.bzl", "flash_binary", "opentitan_rom_binary")
+load(
+    "//rules:matcha.bzl",
+    "DV_CORE_TARGETS",
+    "flash_binary",
+    "opentitan_rom_binary",
+)
 
 def matcha_verilator_test(
         name,
@@ -168,6 +173,8 @@
         signed = False,
         dv = None,
         test_binary = None,
+        per_device_deps = {"sim_dv": [DV_CORE_TARGETS.get("secure_core")]},
+        word_size = 64,
         **kwargs):
     """A helper macro for generating Matcha functional tests.
 
@@ -188,6 +195,9 @@
       signed: Whether to sign the test image. Unsigned by default.
       dv: DV test parameters.
       test_binary: Use the named binary as the test program rather than building one from srcs/deps.
+      per_device_deps: Target deps that are forwared to flash_binary. Default to build for secure
+                       core DV only.
+      word_size: The word size that is forwared to flash_binary. Default to 64 for secure core.
       **kwargs: Arguments to forward to `flash_binary`.
 
     This macro emits the following rules:
@@ -208,7 +218,8 @@
         flash_binary(
             name = test_binary,
             signed = signed,
-            word_size = 64,
+            per_device_deps = per_device_deps,
+            word_size = word_size,
             deps = deps,
             **kwargs
         )
diff --git a/sw/device/tests/BUILD b/sw/device/tests/BUILD
index c7df613..1f7375c 100644
--- a/sw/device/tests/BUILD
+++ b/sw/device/tests/BUILD
@@ -710,6 +710,22 @@
     ],
 )
 
+matcha_dv_test(
+    name = "alert_handler_ping_timeout_test",
+    srcs = ["@lowrisc_opentitan//sw/device/tests:alert_handler_ping_timeout_test.c"],
+    deps = [
+        ":test_dv_lib_opentitan",
+        "//hw/top_matcha:alert_handler_regs",
+        "//sw/device/lib/dif:alert_handler",
+        "@lowrisc_opentitan//sw/device/lib/base:math",
+        "@lowrisc_opentitan//sw/device/lib/dif:rv_core_ibex",
+        "@lowrisc_opentitan//sw/device/lib/dif:rv_plic",
+        "@lowrisc_opentitan//sw/device/lib/testing:alert_handler_testutils",
+        "@lowrisc_opentitan//sw/device/lib/testing:isr_testutils",
+        "@lowrisc_opentitan//sw/device/lib/testing:rv_plic_testutils",
+    ],
+)
+
 # Smoke tests
 matcha_dv_test(
     name = "aes_smoketest",
diff --git a/sw/device/tests/sim_dv/BUILD b/sw/device/tests/sim_dv/BUILD
index 17d264a..fe999fc 100644
--- a/sw/device/tests/sim_dv/BUILD
+++ b/sw/device/tests/sim_dv/BUILD
@@ -92,3 +92,21 @@
         "@lowrisc_opentitan//sw/device/lib/testing/test_framework:status",
     ],
 )
+
+matcha_dv_test(
+    name = "alert_handler_escalation_test",
+    srcs = ["@lowrisc_opentitan//sw/device/tests/sim_dv:alert_handler_escalation.c"],
+    deps = [
+        "//hw/top_matcha:alert_handler_regs",
+        "//sw/device/lib/arch:device",
+        "//sw/device/lib/dif:alert_handler",
+        "//sw/device/lib/dif:clkmgr",
+        "//sw/device/lib/dif:rstmgr",
+        "//sw/device/tests:test_dv_lib_opentitan",
+        "@lowrisc_opentitan//sw/device/lib/dif:keymgr",
+        "@lowrisc_opentitan//sw/device/lib/dif:rv_core_ibex",
+        "@lowrisc_opentitan//sw/device/lib/testing:alert_handler_testutils",
+        "@lowrisc_opentitan//sw/device/lib/testing:keymgr_testutils",
+        "@lowrisc_opentitan//sw/device/lib/testing:rstmgr_testutils",
+    ],
+)