|  | # Copyright 2023 Google LLC. | 
|  | # Copyright lowRISC contributors. | 
|  | # Licensed under the Apache License, Version 2.0, see LICENSE for details. | 
|  | # SPDX-License-Identifier: Apache-2.0 | 
|  |  | 
|  | load("//rules:matcha_test.bzl", "matcha_dv_test", "matcha_verilator_test") | 
|  | load("//rules:matcha.bzl", "NEXUS_CORE_TARGETS", "OPENTITAN_CPU", "sec_flash_binary") | 
|  |  | 
|  | package(default_visibility = ["//visibility:public"]) | 
|  |  | 
|  | sec_fpga_device = { | 
|  | "fpga_nexus": [NEXUS_CORE_TARGETS.get("secure_core")], | 
|  | } | 
|  |  | 
|  | # TODO: We could put all matcha related tests into a separate directory. | 
|  | sec_flash_binary( | 
|  | name = "smc_ctrl_test", | 
|  | srcs = [ | 
|  | "smc_ctrl_test.c", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//sw/device/lib/dif:smc_ctrl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "crt_test", | 
|  | srcs = [ | 
|  | "crt_test.c", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "i2s_rx_test", | 
|  | srcs = [ | 
|  | "simple_sec.c", | 
|  | "//sw/device/tests/smc:smc_i2s_rx_test_fpga_nexus_bin_c.h", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | defines = [ | 
|  | "I2S_RX_TEST", | 
|  | "HAS_SMC_BIN", | 
|  | ], | 
|  | per_device_deps = sec_fpga_device, | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//sw/device/lib/dif:i2s", | 
|  | "//sw/device/lib/dif:smc_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/base:mmio", | 
|  | "@lowrisc_opentitan//sw/device/silicon_creator/lib:manifest_def", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "i2s_tx_test", | 
|  | srcs = [ | 
|  | "simple_sec.c", | 
|  | "//sw/device/tests/smc:smc_i2s_tx_test_fpga_nexus_bin_c.h", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | defines = [ | 
|  | "I2S_TX_TEST", | 
|  | "HAS_SMC_BIN", | 
|  | ], | 
|  | per_device_deps = sec_fpga_device, | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//sw/device/lib/dif:i2s", | 
|  | "//sw/device/lib/dif:smc_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/base:mmio", | 
|  | "@lowrisc_opentitan//sw/device/silicon_creator/lib:manifest_def", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "cam_ctrl_test", | 
|  | srcs = [ | 
|  | "cam_ctrl_test.c", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//sw/device/lib/dif:cam_ctrl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "isp_wrapper_test", | 
|  | srcs = [ | 
|  | "isp_wrapper_test.c", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//sw/device/lib/dif:isp_wrapper", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "mem_test", | 
|  | srcs = [ | 
|  | "mem_test.c", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "ml_dmem_sc_test", | 
|  | srcs = [ | 
|  | "ml_dmem_sc_test.c", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//sw/device/lib/dif:smc_ctrl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "tlul_mailbox_test", | 
|  | srcs = [ | 
|  | "tlul_mailbox_test.c", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//sw/device/lib/dif:smc_ctrl", | 
|  | "//sw/device/lib/dif:tlul_mailbox", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "simple_sec", | 
|  | srcs = [ | 
|  | "simple_sec.c", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//sw/device/lib/dif:smc_ctrl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "supervisor_mode_test", | 
|  | srcs = [ | 
|  | "simple_sec.c", | 
|  | "//sw/device/tests/smc:smc_supervisor_mode_test_fpga_nexus_bin_c.h", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | defines = [ | 
|  | "SUPERVISOR_MODE_TEST", | 
|  | "HAS_SMC_BIN", | 
|  | ], | 
|  | per_device_deps = sec_fpga_device, | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//sw/device/lib/dif:smc_ctrl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "virtual_memory_test", | 
|  | srcs = [ | 
|  | "simple_sec.c", | 
|  | "//sw/device/tests/smc:smc_virtual_memory_test_fpga_nexus_bin_c.h", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | defines = [ | 
|  | "VIRTUAL_MEMORY_TEST", | 
|  | "HAS_SMC_BIN", | 
|  | ], | 
|  | per_device_deps = sec_fpga_device, | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//sw/device/lib/dif:smc_ctrl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "page_boundary_test", | 
|  | srcs = [ | 
|  | "simple_sec.c", | 
|  | "//sw/device/tests/smc:smc_page_boundary_test_fpga_nexus_bin_c.h", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | defines = [ | 
|  | "HAS_SMC_BIN", | 
|  | "PAGE_BOUNDARY_TEST", | 
|  | ], | 
|  | per_device_deps = sec_fpga_device, | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//sw/device/lib/dif:smc_ctrl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "lsu_page_boundary_test", | 
|  | srcs = [ | 
|  | "simple_sec.c", | 
|  | "//sw/device/tests/smc:smc_lsu_page_boundary_test_fpga_nexus_bin_c.h", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | defines = [ | 
|  | "HAS_SMC_BIN", | 
|  | "LSU_PAGE_BOUNDARY_TEST", | 
|  | ], | 
|  | per_device_deps = sec_fpga_device, | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//sw/device/lib/dif:smc_ctrl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "interrupt_boundary_test", | 
|  | srcs = [ | 
|  | "simple_sec.c", | 
|  | "//sw/device/tests/smc:smc_interrupt_boundary_test_fpga_nexus_bin_c.h", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | defines = [ | 
|  | "HAS_SMC_BIN", | 
|  | "INTERRUPT_BOUNDARY_TEST", | 
|  | ], | 
|  | per_device_deps = sec_fpga_device, | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//sw/device/lib/dif:smc_ctrl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "lsu_interrupt_boundary_test", | 
|  | srcs = [ | 
|  | "simple_sec.c", | 
|  | "//sw/device/tests/smc:smc_lsu_interrupt_boundary_test_fpga_nexus_bin_c.h", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | defines = [ | 
|  | "HAS_SMC_BIN", | 
|  | "LSU_INTERRUPT_BOUNDARY_TEST", | 
|  | ], | 
|  | per_device_deps = sec_fpga_device, | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//sw/device/lib/dif:smc_ctrl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "atomics_test", | 
|  | srcs = [ | 
|  | "simple_sec.c", | 
|  | "//sw/device/tests/smc:smc_atomics_test_fpga_nexus_bin_c.h", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | defines = [ | 
|  | "HAS_SMC_BIN", | 
|  | "ATOMICS_TEST", | 
|  | ], | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//sw/device/lib/dif:smc_ctrl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "rv_timer_test", | 
|  | srcs = [ | 
|  | "rv_timer_test.c", | 
|  | "//sw/device/tests/smc:smc_rv_timer_test_fpga_nexus_bin_c.h", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//sw/device/lib/dif:smc_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:rv_timer", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "cam_i2c_test", | 
|  | srcs = [ | 
|  | "simple_sec.c", | 
|  | "//sw/device/tests/smc:smc_cam_i2c_test_fpga_nexus_bin_c.h", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | defines = [ | 
|  | "CAM_I2C_TEST", | 
|  | "HAS_SMC_BIN", | 
|  | ], | 
|  | per_device_deps = sec_fpga_device, | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//sw/device/lib/dif:smc_ctrl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "isp_wrapper_irq_test", | 
|  | srcs = [ | 
|  | "simple_sec.c", | 
|  | "//sw/device/tests/smc:smc_isp_wrapper_irq_test_fpga_nexus_bin_c.h", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | defines = [ | 
|  | "ISP_IRQ_TEST", | 
|  | "HAS_SMC_BIN", | 
|  | ], | 
|  | per_device_deps = sec_fpga_device, | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//sw/device/lib/dif:smc_ctrl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "isp_wrapper_tpg_128_64_test", | 
|  | srcs = [ | 
|  | "simple_sec.c", | 
|  | "//sw/device/tests/smc:smc_isp_wrapper_tpg_128_64_test_fpga_nexus_bin_c.h", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | defines = [ | 
|  | "ISP_TPG_128_64_TEST", | 
|  | "HAS_SMC_BIN", | 
|  | ], | 
|  | per_device_deps = sec_fpga_device, | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//sw/device/lib/dif:smc_ctrl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "ml_top_irq_test", | 
|  | srcs = [ | 
|  | "simple_sec.c", | 
|  | "//sw/device/tests/smc:smc_ml_top_irq_test_fpga_nexus_bin_c.h", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | defines = [ | 
|  | "ML_TOP_IRQ_TEST", | 
|  | "HAS_SMC_BIN", | 
|  | ], | 
|  | per_device_deps = sec_fpga_device, | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//sw/device/lib/dif:smc_ctrl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | sec_flash_binary( | 
|  | name = "dma_main_test", | 
|  | srcs = [ | 
|  | "dma_main.c", | 
|  | ], | 
|  | copts = [ | 
|  | "-nostdlib", | 
|  | "-ffreestanding", | 
|  | ], | 
|  | deps = [ | 
|  | ":test_lib", | 
|  | "//hw/top_matcha/ip/dma/data:dma_regs", | 
|  | "//sw/device/lib/dif:dma", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | cc_library( | 
|  | name = "test_lib", | 
|  | target_compatible_with = [OPENTITAN_CPU], | 
|  | deps = [ | 
|  | ":test_lib_base", | 
|  | "//sw/device/lib/testing/test_framework:ottf_start", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:gpio", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:spi_device", | 
|  | "@lowrisc_opentitan//sw/device/silicon_creator/lib:manifest_def", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | cc_library( | 
|  | name = "test_lib_smc", | 
|  | target_compatible_with = [OPENTITAN_CPU], | 
|  | deps = [ | 
|  | ":test_lib_base", | 
|  | "//sw/device/lib/testing/test_framework:ottf_start_smc", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | cc_library( | 
|  | name = "test_lib_base", | 
|  | target_compatible_with = [OPENTITAN_CPU], | 
|  | deps = [ | 
|  | "//sw/device/lib/arch:device", | 
|  | "//sw/device/lib/dif:pinmux", | 
|  | "//sw/device/lib/testing:pinmux_testutils", | 
|  | "//sw/device/lib/testing/test_framework:test_util", | 
|  | "@lowrisc_opentitan//sw/device/lib/base:mmio", | 
|  | "@lowrisc_opentitan//sw/device/lib/crt", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:uart", | 
|  | "@lowrisc_opentitan//sw/device/lib/runtime:hart", | 
|  | "@lowrisc_opentitan//sw/device/lib/runtime:irq", | 
|  | "@lowrisc_opentitan//sw/device/lib/runtime:log", | 
|  | "@lowrisc_opentitan//sw/device/lib/runtime:print", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing/test_framework:check", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing/test_framework:ottf_test_config", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing/test_framework:status", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | cc_library( | 
|  | name = "test_dv_lib_base", | 
|  | target_compatible_with = [OPENTITAN_CPU], | 
|  | deps = [ | 
|  | "//sw/device/lib/testing/test_framework:ottf_main", | 
|  | "@lowrisc_opentitan//sw/device/lib/base:memory", | 
|  | "@lowrisc_opentitan//sw/device/lib/base:mmio", | 
|  | "@lowrisc_opentitan//sw/device/lib/runtime:hart", | 
|  | "@lowrisc_opentitan//sw/device/lib/runtime:ibex", | 
|  | "@lowrisc_opentitan//sw/device/lib/runtime:irq", | 
|  | "@lowrisc_opentitan//sw/device/lib/runtime:log", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing/test_framework:check", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing/test_framework:status", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | cc_library( | 
|  | name = "test_dv_lib", | 
|  | target_compatible_with = [OPENTITAN_CPU], | 
|  | deps = [ | 
|  | ":test_dv_lib_base", | 
|  | "//sw/device/lib/arch:device", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | # Common library to allow opentitan DV tests buildable with | 
|  | # matcha_dv_test. | 
|  | cc_library( | 
|  | name = "test_dv_lib_opentitan", | 
|  | target_compatible_with = [OPENTITAN_CPU], | 
|  | deps = [ | 
|  | ":test_dv_lib_base", | 
|  | "@lowrisc_opentitan//hw/top_earlgrey/sw/autogen:top_earlgrey", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "rstmgr_sw_rst_ctrl_test", | 
|  | srcs = ["rstmgr_sw_rst_ctrl_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib", | 
|  | "//sw/device/lib/dif:isp_wrapper", | 
|  | "//sw/device/lib/dif:ml_top", | 
|  | "//sw/device/lib/dif:rstmgr", | 
|  | "@lowrisc_opentitan//hw/ip/i2c/data:i2c_regs", | 
|  | "@lowrisc_opentitan//hw/ip/spi_device/data:spi_device_regs", | 
|  | "@lowrisc_opentitan//hw/ip/spi_host/data:spi_host_regs", | 
|  | "@lowrisc_opentitan//hw/ip/usbdev/data:usbdev_regs", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:i2c", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:spi_device", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:spi_host", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:usbdev", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | # To test the following targets: | 
|  | # bazel test --test_output=streamed --test_tag_filters=verilator,-broken //sw/device/tests/... | 
|  | matcha_verilator_test( | 
|  | name = "verilator_tlul_mailbox_test", | 
|  | timeout = "long", | 
|  | sec_flash_binary = ":tlul_mailbox_test", | 
|  | smc_flash_binary = "//sw/device/tests/smc:smc_tlul_mailbox_test", | 
|  | ) | 
|  |  | 
|  | matcha_verilator_test( | 
|  | name = "verilator_cam_irq_test", | 
|  | sec_flash_binary = ":simple_sec", | 
|  | smc_flash_binary = "//sw/device/tests/smc:smc_cam_irq_test", | 
|  | ) | 
|  |  | 
|  | matcha_verilator_test( | 
|  | name = "verilator_ml_top_irq_test", | 
|  | sec_flash_binary = ":simple_sec", | 
|  | smc_flash_binary = "//sw/device/tests/smc:smc_ml_top_irq_test", | 
|  | ) | 
|  |  | 
|  | matcha_verilator_test( | 
|  | name = "verilator_smc_ctrl_test", | 
|  | sec_flash_binary = ":smc_ctrl_test", | 
|  | ) | 
|  |  | 
|  | matcha_verilator_test( | 
|  | name = "verilator_cam_ctrl_test", | 
|  | sec_flash_binary = ":cam_ctrl_test", | 
|  | ) | 
|  |  | 
|  | matcha_verilator_test( | 
|  | name = "verilator_mem_test", | 
|  | sec_flash_binary = ":mem_test", | 
|  | ) | 
|  |  | 
|  | matcha_verilator_test( | 
|  | name = "verilator_crt_test", | 
|  | sec_flash_binary = ":crt_test", | 
|  | ) | 
|  |  | 
|  | matcha_verilator_test( | 
|  | name = "verilator_smc_env_test", | 
|  | sec_flash_binary = ":simple_sec", | 
|  | smc_flash_binary = "//sw/device/tests/smc:smc_env_test", | 
|  | ) | 
|  |  | 
|  | matcha_verilator_test( | 
|  | name = "verilator_supervisor_mode_test", | 
|  | timeout = "eternal", | 
|  | sec_flash_binary = ":simple_sec", | 
|  | smc_flash_binary = "//sw/device/tests/smc:smc_supervisor_mode_test", | 
|  | ) | 
|  |  | 
|  | matcha_verilator_test( | 
|  | name = "verilator_virtual_memory_test", | 
|  | timeout = "eternal", | 
|  | sec_flash_binary = ":simple_sec", | 
|  | smc_flash_binary = "//sw/device/tests/smc:smc_virtual_memory_test", | 
|  | ) | 
|  |  | 
|  | matcha_verilator_test( | 
|  | name = "verilator_interrupt_boundary_test", | 
|  | timeout = "eternal", | 
|  | sec_flash_binary = ":simple_sec", | 
|  | smc_flash_binary = "//sw/device/tests/smc:smc_interrupt_boundary_test", | 
|  | ) | 
|  |  | 
|  | matcha_verilator_test( | 
|  | name = "verilator_lsu_interrupt_boundary_test", | 
|  | timeout = "eternal", | 
|  | sec_flash_binary = ":simple_sec", | 
|  | smc_flash_binary = "//sw/device/tests/smc:smc_lsu_interrupt_boundary_test", | 
|  | ) | 
|  |  | 
|  | matcha_verilator_test( | 
|  | name = "verilator_page_boundary_test", | 
|  | timeout = "eternal", | 
|  | sec_flash_binary = ":simple_sec", | 
|  | smc_flash_binary = "//sw/device/tests/smc:smc_page_boundary_test", | 
|  | ) | 
|  |  | 
|  | matcha_verilator_test( | 
|  | name = "verilator_lsu_page_boundary_test", | 
|  | timeout = "eternal", | 
|  | sec_flash_binary = ":simple_sec", | 
|  | smc_flash_binary = "//sw/device/tests/smc:smc_lsu_page_boundary_test", | 
|  | ) | 
|  |  | 
|  | matcha_verilator_test( | 
|  | name = "verilator_atomics_test", | 
|  | timeout = "eternal", | 
|  | sec_flash_binary = ":simple_sec", | 
|  | smc_flash_binary = "//sw/device/tests/smc:smc_atomics_test", | 
|  | ) | 
|  |  | 
|  | matcha_verilator_test( | 
|  | name = "verilator_dma_main_test", | 
|  | sec_flash_binary = ":dma_main_test", | 
|  | ) | 
|  |  | 
|  | matcha_verilator_test( | 
|  | name = "verilator_ml_dmem_test", | 
|  | sec_flash_binary = ":ml_dmem_sc_test", | 
|  | smc_flash_binary = "//sw/device/tests/smc:smc_ml_dmem_test", | 
|  | ) | 
|  |  | 
|  | matcha_verilator_test( | 
|  | name = "verilator_rv_timer_test", | 
|  | timeout = "eternal", | 
|  | sec_flash_binary = ":rv_timer_test", | 
|  | smc_flash_binary = "//sw/device/tests/smc:smc_rv_timer_test", | 
|  | ) | 
|  |  | 
|  | matcha_verilator_test( | 
|  | name = "verilator_i2s_rx_test", | 
|  | timeout = "eternal", | 
|  | sec_flash_binary = ":simple_sec", | 
|  | smc_flash_binary = "//sw/device/tests/smc:smc_i2s_rx_test", | 
|  | ) | 
|  |  | 
|  | matcha_verilator_test( | 
|  | name = "verilator_i2s_tx_test", | 
|  | timeout = "eternal", | 
|  | sec_flash_binary = ":simple_sec", | 
|  | smc_flash_binary = "//sw/device/tests/smc:smc_i2s_tx_test", | 
|  | ) | 
|  |  | 
|  | # All the verilator tests should be added to this test suite | 
|  | # TODO(ykwang): The tests run in sequential. It is more ideal to | 
|  | # run tests in parallel and log each test seperately. | 
|  | test_suite( | 
|  | name = "verilator_test_suite", | 
|  | tags = [ | 
|  | "verilator", | 
|  | ], | 
|  | tests = [ | 
|  | "verilator_cam_ctrl_test", | 
|  | "verilator_cam_irq_test", | 
|  | "verilator_crt_test", | 
|  | "verilator_dma_main_test", | 
|  | "verilator_i2s_rx_test", | 
|  | "verilator_i2s_tx_test", | 
|  | "verilator_interrupt_boundary_test", | 
|  | "verilator_lsu_interrupt_boundary_test", | 
|  | "verilator_lsu_page_boundary_test", | 
|  | "verilator_mem_test", | 
|  | "verilator_ml_dmem_test", | 
|  | "verilator_page_boundary_test", | 
|  | "verilator_rv_timer_test", | 
|  | "verilator_smc_ctrl_test", | 
|  | "verilator_smc_env_test", | 
|  | "verilator_supervisor_mode_test", | 
|  | "verilator_tlul_mailbox_test", | 
|  | "verilator_virtual_memory_test", | 
|  | "//sw/device/examples/hello_world:verilator_hello_world_test", | 
|  | "//sw/device/tests/smc:verilator_kelvin_checksum_test", | 
|  | "//sw/device/tests/smc:verilator_kelvin_hello_test", | 
|  | "//sw/device/tests/smc:verilator_ml_top_irq_test", | 
|  | "//sw/device/tests/smc:verilator_smc_isp_wrapper_irq_test", | 
|  | "//sw/device/tests/smc:verilator_smc_isp_wrapper_test", | 
|  | "//sw/device/tests/smc:verilator_smc_isp_wrapper_tpg_128_64_test", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | ################################################################################ | 
|  | #  Place the Opentitan-sourced DV test below.                                  # | 
|  | #  Opentitan DV binary build flow does not support centOS7, so we pull the     # | 
|  | #  source code and build them here using `matcha_dv_test` rule.                # | 
|  | ################################################################################ | 
|  | matcha_dv_test( | 
|  | name = "example_test_from_flash", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:example_test_from_flash.c"], | 
|  | deps = [ | 
|  | "//sw/device/lib/testing/test_framework:ottf_main", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rand_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "example_test_from_rom", | 
|  | srcs = ["example_test_from_rom.c"], | 
|  | # This test is designed to run and complete entirely in the ROM boot stage. | 
|  | # Setting the `test_in_rom` flag makes the `matcha_dv_test` rule aware | 
|  | # of this, and instructs it to load the test image into ROM (rather than | 
|  | # loading the default test ROM, or any other ROM that may be specified via | 
|  | # DV params). | 
|  | test_in_rom = True, | 
|  | deps = [ | 
|  | ":test_lib_base", | 
|  | "//sw/device/lib/testing/test_rom:linker_script", | 
|  | "//sw/device/lib/testing/test_rom:test_rom_otp_lib", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "hmac_enc_test", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:hmac_enc_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:hmac", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:hmac_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:isr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rv_plic_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "hmac_enc_idle_test", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:hmac_enc_idle_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "//sw/device/lib/dif:clkmgr", | 
|  | "//sw/device/lib/testing:clkmgr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:hmac", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:hmac_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "kmac_idle_test", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:kmac_idle_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "//sw/device/lib/dif:clkmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:kmac", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "flash_ctrl_test", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:flash_ctrl_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "@lowrisc_opentitan//sw/device/lib/base:macros", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:flash_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:flash_ctrl_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "rstmgr_sw_req_test", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:rstmgr_sw_req_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "//sw/device/lib/dif:rstmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rstmgr_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "keymgr_key_derivation_test", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:keymgr_key_derivation_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "@lowrisc_opentitan//hw/ip/keymgr/data:keymgr_regs", | 
|  | "@lowrisc_opentitan//hw/ip/kmac/data:kmac_regs", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:keymgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:kmac", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:keymgr_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "lc_ctrl_otp_hw_cfg_test", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:lc_ctrl_otp_hw_cfg_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:lc_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:otp_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:otp_ctrl_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "alert_test", | 
|  | srcs = ["autogen/alert_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib", | 
|  | "//sw/device/lib/dif:alert_handler", | 
|  | "//sw/device/lib/dif:clkmgr", | 
|  | "//sw/device/lib/dif:pinmux", | 
|  | "//sw/device/lib/dif:rstmgr", | 
|  | "//sw/device/lib/dif:rv_plic_sec", | 
|  | "//sw/device/lib/testing:alert_handler_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:adc_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:aes", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:aon_timer", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:csrng", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:edn", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:entropy_src", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:flash_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:gpio", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:hmac", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:i2c", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:keymgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:kmac", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:lc_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:otbn", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:otp_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:pattgen", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:pwm", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:pwrmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:rom_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:rv_core_ibex", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:rv_timer", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:sensor_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:spi_device", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:spi_host", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:sram_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:sysrst_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:uart", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:usbdev", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | 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_h", | 
|  | "//sw/device/lib/dif:alert_handler", | 
|  | "//sw/device/lib/testing:alert_handler_testutils", | 
|  | "@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:isr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rv_plic_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "plic_all_irqs_test", | 
|  | srcs = ["autogen/plic_all_irqs_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib", | 
|  | "//sw/device/lib/dif:alert_handler", | 
|  | "//sw/device/lib/dif:rv_plic_sec", | 
|  | "//sw/device/lib/dif:tlul_mailbox", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:adc_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:aon_timer", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:csrng", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:edn", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:entropy_src", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:flash_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:gpio", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:hmac", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:i2c", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:keymgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:kmac", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:otbn", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:otp_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:pattgen", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:pwrmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:rv_timer", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:sensor_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:spi_device", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:spi_host", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:sysrst_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:uart", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:usbdev", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rv_plic_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "sensor_ctrl_alert_test", | 
|  | srcs = ["sensor_ctrl_alerts.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib", | 
|  | "//hw/top_matcha/ip/sensor_ctrl/data:sensor_ctrl_regs", | 
|  | "//sw/device/lib/dif:alert_handler", | 
|  | "//sw/device/lib/dif:rstmgr", | 
|  | "//sw/device/lib/dif:rv_plic_sec", | 
|  | "@lowrisc_opentitan//sw/device/lib/base:abs_mmio", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:sensor_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:flash_ctrl_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:pwrmgr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rand_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "sensor_ctrl_wakeup_test", | 
|  | srcs = ["sensor_ctrl_wakeup.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib", | 
|  | "//sw/device/lib/dif:rv_plic_sec", | 
|  | "//sw/device/lib/testing:isr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:pwrmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:sensor_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:pwrmgr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rv_plic_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "rv_core_ibex_rnd_test", | 
|  | srcs = [ | 
|  | "@lowrisc_opentitan//sw/device/tests:rv_core_ibex_rnd_test.S", | 
|  | "@lowrisc_opentitan//sw/device/tests:rv_core_ibex_rnd_test.c", | 
|  | ], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:edn", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:rv_core_ibex", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:entropy_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rv_core_ibex_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "rv_core_ibex_nmi_irq_test", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:rv_core_ibex_nmi_irq_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "//sw/device/lib/dif:alert_handler", | 
|  | "//sw/device/lib/testing:alert_handler_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:aon_timer", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:rv_core_ibex", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:aon_timer_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:isr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:pwrmgr_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "clkmgr_off_peri_test", | 
|  | srcs = ["clkmgr_off_peri_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib", | 
|  | "//sw/device/lib/dif:clkmgr", | 
|  | "//sw/device/lib/dif:dma", | 
|  | "//sw/device/lib/dif:ml_top", | 
|  | "//sw/device/lib/dif:rstmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/base:abs_mmio", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:aon_timer", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:base", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:flash_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:pwrmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:spi_host", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:uart", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:usbdev", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:aon_timer_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:flash_ctrl_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rstmgr_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | cc_library( | 
|  | name = "clkmgr_off_clk_impl", | 
|  | target_compatible_with = [OPENTITAN_CPU], | 
|  | deps = [ | 
|  | ":test_dv_lib", | 
|  | "//sw/device/lib/dif:clkmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/base:abs_mmio", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:aon_timer", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:base", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:aon_timer_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "clkmgr_off_smc_clk_test", | 
|  | srcs = ["clkmgr_off_smc_clk_test.c"], | 
|  | deps = [ | 
|  | ":clkmgr_off_clk_impl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "clkmgr_off_ml_clk_test", | 
|  | srcs = ["clkmgr_off_ml_clk_test.c"], | 
|  | deps = [ | 
|  | ":clkmgr_off_clk_impl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "clkmgr_off_video_clk_test", | 
|  | srcs = ["clkmgr_off_video_clk_test.c"], | 
|  | deps = [ | 
|  | ":clkmgr_off_clk_impl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "clkmgr_off_audio_clk_test", | 
|  | srcs = ["clkmgr_off_audio_clk_test.c"], | 
|  | deps = [ | 
|  | ":clkmgr_off_clk_impl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | cc_library( | 
|  | name = "clkmgr_external_clk_src_for_sw_impl", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:clkmgr_external_clk_src_for_sw_impl.c"], | 
|  | hdrs = ["@lowrisc_opentitan//sw/device/tests:clkmgr_external_clk_src_for_sw_impl.h"], | 
|  | target_compatible_with = [OPENTITAN_CPU], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "//sw/device/lib/dif:clkmgr", | 
|  | "//sw/device/lib/testing:clkmgr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:base", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:aon_timer_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "clkmgr_external_clk_src_for_sw_fast_test", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:clkmgr_external_clk_src_for_sw_fast_test.c"], | 
|  | deps = [ | 
|  | ":clkmgr_external_clk_src_for_sw_impl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "clkmgr_external_clk_src_for_sw_slow_test", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:clkmgr_external_clk_src_for_sw_slow_test.c"], | 
|  | deps = [ | 
|  | ":clkmgr_external_clk_src_for_sw_impl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "clkmgr_reset_frequency_test", | 
|  | srcs = [":clkmgr_reset_frequency_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib", | 
|  | "//sw/device/lib/testing:clkmgr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:sensor_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:aon_timer_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rstmgr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:sensor_ctrl_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "clkmgr_sleep_frequency_test", | 
|  | srcs = ["clkmgr_sleep_frequency_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib", | 
|  | "//sw/device/lib/dif:rv_plic_sec", | 
|  | "//sw/device/lib/testing:clkmgr_testutils", | 
|  | "//sw/device/lib/testing:isr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:sensor_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:aon_timer_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:pwrmgr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rv_plic_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:sensor_ctrl_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "sleep_pwm_pulses_test", | 
|  | srcs = ["sleep_pwm_pulses_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib", | 
|  | "//sw/device/lib/dif:pinmux", | 
|  | "//sw/device/lib/dif:rstmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:aon_timer", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:pwm", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:pwrmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:aon_timer_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:pwrmgr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rstmgr_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "rstmgr_alert_info_test", | 
|  | srcs = ["rstmgr_alert_info_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib", | 
|  | "//sw/device/lib/dif:alert_handler", | 
|  | "//sw/device/lib/dif:cam_ctrl", | 
|  | "//sw/device/lib/dif:rstmgr", | 
|  | "//sw/device/lib/dif:rv_plic_sec", | 
|  | "//sw/device/lib/dif:rv_plic_smc", | 
|  | "//sw/device/lib/testing:alert_handler_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:aon_timer", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:i2c", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:otp_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:pwrmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:rv_core_ibex", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:rv_timer", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:spi_host", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:uart", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:aon_timer_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:flash_ctrl_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rstmgr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rv_plic_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "rstmgr_cpu_info_test", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:rstmgr_cpu_info_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "//sw/device/lib/dif:rstmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/base:abs_mmio", | 
|  | "@lowrisc_opentitan//sw/device/lib/base:macros", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:pwrmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:rv_core_ibex", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:aon_timer_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rstmgr_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "aon_timer_irq_test", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:aon_timer_irq_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "//sw/device/lib/dif:rv_plic_sec", | 
|  | "@lowrisc_opentitan//sw/device/lib/base:math", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:aon_timer", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:rv_timer", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:aon_timer_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rand_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rv_plic_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "aon_timer_wdog_bite_reset_test", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:aon_timer_wdog_bite_reset_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "//sw/device/lib/dif:rstmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/base:math", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:aon_timer", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:pwrmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:aon_timer_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:pwrmgr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rstmgr_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "aon_timer_sleep_wdog_sleep_pause_test", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:aon_timer_sleep_wdog_sleep_pause_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "//sw/device/lib/dif:rstmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:aon_timer", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:pwrmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:aon_timer_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:pwrmgr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rstmgr_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "ast_clk_outs_test", | 
|  | srcs = ["ast_clk_outs_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib", | 
|  | "//sw/device/lib/testing:clkmgr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:sensor_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:aon_timer_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:pwrmgr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:sensor_ctrl_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "sram_ctrl_sleep_sram_ret_contents_test", | 
|  | srcs = ["sram_ctrl_sleep_sram_ret_contents_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib", | 
|  | "//sw/device/lib/dif:rstmgr", | 
|  | "//sw/device/lib/testing:isr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:aon_timer", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:flash_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:pwrmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:aon_timer_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:flash_ctrl_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:pwrmgr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rstmgr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rv_plic_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:sram_ctrl_testutils", | 
|  | "@lowrisc_opentitan//sw/device/silicon_creator/lib/drivers:retention_sram", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "pwrmgr_wdog_reset_reqs_test", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:pwrmgr_wdog_reset_reqs_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "//sw/device/lib/dif:rstmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/base:math", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:aon_timer", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:pwrmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:aon_timer_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:pwrmgr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rstmgr_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "pwrmgr_sleep_disabled_test", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:pwrmgr_sleep_disabled_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "//sw/device/lib/dif:rv_plic_sec", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:aon_timer", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:pwrmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:aon_timer_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:pwrmgr_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "flash_ctrl_ops_test", | 
|  | srcs = ["flash_ctrl_ops_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib", | 
|  | "//sw/device/lib/dif:rv_plic_sec", | 
|  | "//sw/device/lib/testing:isr_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:flash_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:flash_ctrl_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rv_plic_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "aes_idle_test", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:aes_idle_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "//sw/device/lib/dif:clkmgr", | 
|  | "//sw/device/lib/testing:clkmgr_testutils", | 
|  | "@lowrisc_opentitan//hw/ip/aes:model", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:aes", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:aes_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:entropy_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "aes_masking_off_test", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:aes_masking_off_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "@lowrisc_opentitan//hw/ip/aes:model", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:aes", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:aes_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "rv_core_ibex_address_translation_test", | 
|  | srcs = [ | 
|  | "@lowrisc_opentitan//sw/device/tests:rv_core_ibex_address_translation_test.S", | 
|  | "@lowrisc_opentitan//sw/device/tests:rv_core_ibex_address_translation_test.c", | 
|  | ], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "@lowrisc_opentitan//sw/device/lib/base:csr", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:rv_core_ibex", | 
|  | "@lowrisc_opentitan//sw/device/silicon_creator/lib:epmp_state", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "rv_core_ibex_icache_invalidate_test", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:rv_core_ibex_icache_invalidate_test.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | # Smoke tests | 
|  | matcha_dv_test( | 
|  | name = "aes_smoketest", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:aes_smoketest.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "@lowrisc_opentitan//hw/ip/aes:model", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:aes", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:aes_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "aon_timer_smoketest", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:aon_timer_smoketest.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:aon_timer", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:aon_timer_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "clkmgr_smoketest", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:clkmgr_smoketest.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:base", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:clkmgr", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "csrng_smoketest", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:csrng_smoketest.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "@lowrisc_opentitan//sw/device/lib/base:macros", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:csrng", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:csrng_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "entropy_src_smoketest", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:entropy_src_smoketest.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:base", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:entropy_src", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:entropy_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "hmac_smoketest", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:hmac_smoketest.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "@lowrisc_opentitan//sw/device/lib/arch:device", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:hmac", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:hmac_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "kmac_smoketest", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:kmac_smoketest.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "@lowrisc_opentitan//sw/device/lib/arch:device", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:kmac", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "otbn_smoketest", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:otbn_smoketest.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:otbn", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:entropy_testutils", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:otbn_testutils", | 
|  | "@lowrisc_opentitan//sw/otbn/code-snippets:barrett384", | 
|  | "@lowrisc_opentitan//sw/otbn/code-snippets:err_test", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "otp_ctrl_smoketest", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:otp_ctrl_smoketest.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "@lowrisc_opentitan//sw/device/lib/base:bitfield", | 
|  | "@lowrisc_opentitan//sw/device/lib/base:macros", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:otp_ctrl", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:otp_ctrl_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "rstmgr_smoketest", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:rstmgr_smoketest.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "//sw/device/lib/dif:rstmgr", | 
|  | "@lowrisc_opentitan//sw/device/lib/testing:rstmgr_testutils", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "rv_plic_smoketest", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:rv_plic_smoketest.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:rv_plic", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:uart", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "rv_timer_smoketest", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:rv_timer_smoketest.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:rv_timer", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "sram_ctrl_smoketest", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:sram_ctrl_smoketest.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "@lowrisc_opentitan//sw/device/lib/arch:device", | 
|  | "@lowrisc_opentitan//sw/device/lib/base:macros", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:sram_ctrl", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | matcha_dv_test( | 
|  | name = "uart_smoketest", | 
|  | srcs = ["@lowrisc_opentitan//sw/device/tests:uart_smoketest.c"], | 
|  | deps = [ | 
|  | ":test_dv_lib_opentitan", | 
|  | "@lowrisc_opentitan//sw/device/lib/arch:device", | 
|  | "@lowrisc_opentitan//sw/device/lib/dif:uart", | 
|  | ], | 
|  | ) |