diff --git a/hw/dv/sv/flash_bkdr_util/README.md b/hw/dv/sv/flash_bkdr_util/README.md new file mode 100644 index 0000000000000..2921e590cd608 --- /dev/null +++ b/hw/dv/sv/flash_bkdr_util/README.md @@ -0,0 +1,9 @@ +# Flash Backdoor Utility Class + +The `flash_bkdr_util` class extends the functionality of the `mem_bkdr_util` class with the +scrambling of flash memory contents. + +Class instances are created in the testbench module and passed to the UVM environment via `uvm_config_db`. + +### Methods +* `flash_write_scrambled`: Write scrambled data into the flash memory at the given address diff --git a/hw/dv/sv/flash_bkdr_util/flash_bkdr_util.core b/hw/dv/sv/flash_bkdr_util/flash_bkdr_util.core new file mode 100644 index 0000000000000..0f96309878bc4 --- /dev/null +++ b/hw/dv/sv/flash_bkdr_util/flash_bkdr_util.core @@ -0,0 +1,26 @@ +CAPI=2: +# Copyright lowRISC contributors (OpenTitan project). +# Licensed under the Apache License, Version 2.0, see LICENSE for details. +# SPDX-License-Identifier: Apache-2.0 +name: "lowrisc:dv:flash_bkdr_util" +description: "Backdoor read/write flash memory for DV" + +filesets: + files_dv: + depend: + - lowrisc:opentitan:bus_params_pkg + - lowrisc:dv:dv_utils + - lowrisc:dv:crypto_dpi_prince:0.1 + - lowrisc:dv:crypto_dpi_present:0.1 + - lowrisc:prim:secded:0.1 + - lowrisc:ip_interfaces:flash_ctrl_pkg + - lowrisc:dv:mem_bkdr_util + files: + - flash_bkdr_util_pkg.sv + - flash_bkdr_util.sv: {is_include_file: true} + file_type: systemVerilogSource + +targets: + default: + filesets: + - files_dv diff --git a/hw/dv/sv/mem_bkdr_util/flash_bkdr_util.sv b/hw/dv/sv/flash_bkdr_util/flash_bkdr_util.sv similarity index 100% rename from hw/dv/sv/mem_bkdr_util/flash_bkdr_util.sv rename to hw/dv/sv/flash_bkdr_util/flash_bkdr_util.sv diff --git a/hw/dv/sv/flash_bkdr_util/flash_bkdr_util_pkg.sv b/hw/dv/sv/flash_bkdr_util/flash_bkdr_util_pkg.sv new file mode 100644 index 0000000000000..461e5e66590ac --- /dev/null +++ b/hw/dv/sv/flash_bkdr_util/flash_bkdr_util_pkg.sv @@ -0,0 +1,22 @@ +// Copyright lowRISC contributors (OpenTitan project). +// Licensed under the Apache License, Version 2.0, see LICENSE for details. +// SPDX-License-Identifier: Apache-2.0 + +package flash_bkdr_util_pkg; + // dep packages + import bus_params_pkg::BUS_AW; + import dv_utils_pkg::uint32_t, dv_utils_pkg::addr_range_t; + import lc_ctrl_state_pkg::*; + import mem_bkdr_util_pkg::*; + import prim_secded_pkg::*; + import sram_scrambler_pkg::*; + import uvm_pkg::*; + + // macro includes + `include "uvm_macros.svh" + `include "dv_macros.svh" + + // extended classes + `include "flash_bkdr_util.sv" + +endpackage diff --git a/hw/dv/sv/mem_bkdr_util/mem_bkdr_util.core b/hw/dv/sv/mem_bkdr_util/mem_bkdr_util.core index c6aa0c90bb495..5f326534c5a2a 100644 --- a/hw/dv/sv/mem_bkdr_util/mem_bkdr_util.core +++ b/hw/dv/sv/mem_bkdr_util/mem_bkdr_util.core @@ -14,14 +14,11 @@ filesets: - lowrisc:dv:crypto_dpi_present:0.1 - lowrisc:prim:cipher_pkg:0.1 - lowrisc:prim:secded:0.1 - - lowrisc:ip:otp_ctrl_pkg:1.0 - - lowrisc:ip_interfaces:flash_ctrl_pkg - lowrisc:dv:digestpp_dpi - lowrisc:ip:kmac_pkg files: - sram_scrambler_pkg.sv - mem_bkdr_util_pkg.sv - - flash_bkdr_util.sv: {is_include_file: true} - mem_bkdr_util.sv: {is_include_file: true} - rom_bkdr_util.sv: {is_include_file: true} - sram_bkdr_util.sv: {is_include_file: true} diff --git a/hw/dv/sv/mem_bkdr_util/mem_bkdr_util_pkg.sv b/hw/dv/sv/mem_bkdr_util/mem_bkdr_util_pkg.sv index 101645f0501b8..c6d679fded1f0 100644 --- a/hw/dv/sv/mem_bkdr_util/mem_bkdr_util_pkg.sv +++ b/hw/dv/sv/mem_bkdr_util/mem_bkdr_util_pkg.sv @@ -45,7 +45,6 @@ package mem_bkdr_util_pkg; // sources `include "mem_bkdr_util.sv" // extended classes - `include "flash_bkdr_util.sv" `include "rom_bkdr_util.sv" `include "sram_bkdr_util.sv" diff --git a/hw/ip_templates/flash_ctrl/dv/env/flash_ctrl_env.core.tpl b/hw/ip_templates/flash_ctrl/dv/env/flash_ctrl_env.core.tpl index 7414d25868b79..771e37f68ca55 100644 --- a/hw/ip_templates/flash_ctrl/dv/env/flash_ctrl_env.core.tpl +++ b/hw/ip_templates/flash_ctrl/dv/env/flash_ctrl_env.core.tpl @@ -11,7 +11,7 @@ filesets: - lowrisc:dv:dv_base_reg - lowrisc:dv:dv_lib - lowrisc:dv:cip_lib - - lowrisc:dv:mem_bkdr_util + - lowrisc:dv:flash_bkdr_util - lowrisc:dv:flash_phy_prim_agent - ${instance_vlnv("lowrisc:ip:flash_ctrl_pkg")} - ${top_pkg_vlnv} diff --git a/hw/ip_templates/flash_ctrl/dv/flash_ctrl_sim.core.tpl b/hw/ip_templates/flash_ctrl/dv/flash_ctrl_sim.core.tpl index e2563c38ee84c..b9f980cf848c9 100644 --- a/hw/ip_templates/flash_ctrl/dv/flash_ctrl_sim.core.tpl +++ b/hw/ip_templates/flash_ctrl/dv/flash_ctrl_sim.core.tpl @@ -14,7 +14,7 @@ filesets: files_dv: depend: - - lowrisc:dv:mem_bkdr_util + - lowrisc:dv:flash_bkdr_util - ${instance_vlnv("lowrisc:dv:flash_ctrl_test")} - ${instance_vlnv("lowrisc:dv:flash_ctrl_sva")} - ${instance_vlnv("lowrisc:dv:flash_ctrl_cov")} diff --git a/hw/top_earlgrey/dv/chip_sim.core b/hw/top_earlgrey/dv/chip_sim.core index 56cd717c04513..b06185c17cf79 100644 --- a/hw/top_earlgrey/dv/chip_sim.core +++ b/hw/top_earlgrey/dv/chip_sim.core @@ -34,7 +34,7 @@ filesets: - lowrisc:dv:sim_sram - lowrisc:dv:sw_test_status - lowrisc:dv:sw_logger_if - - lowrisc:dv:mem_bkdr_util + - lowrisc:dv:flash_bkdr_util - lowrisc:dv_dpi_c:gpiodpi - lowrisc:dv_dpi_sv:gpiodpi - lowrisc:dv_dpi_c:uartdpi diff --git a/hw/top_earlgrey/dv/env/chip_env.core b/hw/top_earlgrey/dv/env/chip_env.core index a31135286bc54..8d5a57f3884fe 100644 --- a/hw/top_earlgrey/dv/env/chip_env.core +++ b/hw/top_earlgrey/dv/env/chip_env.core @@ -23,7 +23,7 @@ filesets: - lowrisc:dv:jtag_riscv_agent - lowrisc:dv:jtag_dmi_agent - lowrisc:dv:lc_ctrl_dv_utils - - lowrisc:dv:mem_bkdr_util + - lowrisc:dv:flash_bkdr_util - lowrisc:opentitan:top_earlgrey_otp_ctrl_mem_bkdr_util - lowrisc:dv:ralgen - lowrisc:dv:spi_agent diff --git a/hw/top_earlgrey/dv/env/chip_env_pkg.sv b/hw/top_earlgrey/dv/env/chip_env_pkg.sv index ae33296fbc35c..a3a650240a255 100644 --- a/hw/top_earlgrey/dv/env/chip_env_pkg.sv +++ b/hw/top_earlgrey/dv/env/chip_env_pkg.sv @@ -20,6 +20,7 @@ package chip_env_pkg; import dv_lib_pkg::*; import dv_utils_pkg::*; import flash_ctrl_pkg::*; + import flash_bkdr_util_pkg::*; import jtag_pkg::*; import jtag_agent_pkg::*; import jtag_riscv_agent_pkg::*; diff --git a/hw/top_earlgrey/dv/tb/tb.sv b/hw/top_earlgrey/dv/tb/tb.sv index 3dd09b69166e5..d5b312ca7793e 100644 --- a/hw/top_earlgrey/dv/tb/tb.sv +++ b/hw/top_earlgrey/dv/tb/tb.sv @@ -13,6 +13,7 @@ module tb; import top_earlgrey_pkg::*; import chip_test_pkg::*; import xbar_test_pkg::*; + import flash_bkdr_util_pkg::*; import mem_bkdr_util_pkg::*; // macro includes diff --git a/hw/top_earlgrey/ip_autogen/flash_ctrl/dv/env/flash_ctrl_env.core b/hw/top_earlgrey/ip_autogen/flash_ctrl/dv/env/flash_ctrl_env.core index 171e804d71681..8d90719462744 100644 --- a/hw/top_earlgrey/ip_autogen/flash_ctrl/dv/env/flash_ctrl_env.core +++ b/hw/top_earlgrey/ip_autogen/flash_ctrl/dv/env/flash_ctrl_env.core @@ -11,7 +11,7 @@ filesets: - lowrisc:dv:dv_base_reg - lowrisc:dv:dv_lib - lowrisc:dv:cip_lib - - lowrisc:dv:mem_bkdr_util + - lowrisc:dv:flash_bkdr_util - lowrisc:dv:flash_phy_prim_agent - lowrisc:opentitan:top_earlgrey_flash_ctrl_pkg - lowrisc:constants:top_earlgrey_top_pkg diff --git a/hw/top_earlgrey/ip_autogen/flash_ctrl/dv/flash_ctrl_sim.core b/hw/top_earlgrey/ip_autogen/flash_ctrl/dv/flash_ctrl_sim.core index 9f57373a66b1b..9703d80f6fe44 100644 --- a/hw/top_earlgrey/ip_autogen/flash_ctrl/dv/flash_ctrl_sim.core +++ b/hw/top_earlgrey/ip_autogen/flash_ctrl/dv/flash_ctrl_sim.core @@ -14,7 +14,7 @@ filesets: files_dv: depend: - - lowrisc:dv:mem_bkdr_util + - lowrisc:dv:flash_bkdr_util - lowrisc:opentitan:top_earlgrey_flash_ctrl_test - lowrisc:opentitan:top_earlgrey_flash_ctrl_sva - lowrisc:opentitan:top_earlgrey_flash_ctrl_cov diff --git a/hw/top_englishbreakfast/ip_autogen/flash_ctrl/dv/env/flash_ctrl_env.core b/hw/top_englishbreakfast/ip_autogen/flash_ctrl/dv/env/flash_ctrl_env.core index fb421214dce0d..ea1570c96fa09 100644 --- a/hw/top_englishbreakfast/ip_autogen/flash_ctrl/dv/env/flash_ctrl_env.core +++ b/hw/top_englishbreakfast/ip_autogen/flash_ctrl/dv/env/flash_ctrl_env.core @@ -11,7 +11,7 @@ filesets: - lowrisc:dv:dv_base_reg - lowrisc:dv:dv_lib - lowrisc:dv:cip_lib - - lowrisc:dv:mem_bkdr_util + - lowrisc:dv:flash_bkdr_util - lowrisc:dv:flash_phy_prim_agent - lowrisc:opentitan:top_englishbreakfast_flash_ctrl_pkg - lowrisc:constants:top_englishbreakfast_top_pkg diff --git a/hw/top_englishbreakfast/ip_autogen/flash_ctrl/dv/flash_ctrl_sim.core b/hw/top_englishbreakfast/ip_autogen/flash_ctrl/dv/flash_ctrl_sim.core index 1705a53332848..0308c84d42785 100644 --- a/hw/top_englishbreakfast/ip_autogen/flash_ctrl/dv/flash_ctrl_sim.core +++ b/hw/top_englishbreakfast/ip_autogen/flash_ctrl/dv/flash_ctrl_sim.core @@ -14,7 +14,7 @@ filesets: files_dv: depend: - - lowrisc:dv:mem_bkdr_util + - lowrisc:dv:flash_bkdr_util - lowrisc:opentitan:top_englishbreakfast_flash_ctrl_test - lowrisc:opentitan:top_englishbreakfast_flash_ctrl_sva - lowrisc:opentitan:top_englishbreakfast_flash_ctrl_cov