Skip to content

Commit

Permalink
[dv,mem_bkdr_util] Separate out flash_bkdir_util
Browse files Browse the repository at this point in the history
Separate flash support into another package so that designs
such as Darjeeling can employ mem_bkdr_util without depending
upon the flash controller/package.

Signed-off-by: Adrian Lees <[email protected]>
  • Loading branch information
alees24 committed Jan 31, 2025
1 parent 6836969 commit 01b73d5
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 8 deletions.
9 changes: 9 additions & 0 deletions hw/dv/sv/flash_bkdr_util/README.md
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions hw/dv/sv/flash_bkdr_util/flash_bkdr_util.core
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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:cipher_pkg:0.1
- lowrisc:prim:secded:0.1
- lowrisc:ip_interfaces:flash_ctrl_pkg
- lowrisc:dv:digestpp_dpi
- 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
File renamed without changes.
22 changes: 22 additions & 0 deletions hw/dv/sv/flash_bkdr_util/flash_bkdr_util_pkg.sv
Original file line number Diff line number Diff line change
@@ -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
3 changes: 0 additions & 3 deletions hw/dv/sv/mem_bkdr_util/mem_bkdr_util.core
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
1 change: 0 additions & 1 deletion hw/dv/sv/mem_bkdr_util/mem_bkdr_util_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion hw/ip_templates/flash_ctrl/dv/env/flash_ctrl_env.core.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion hw/ip_templates/flash_ctrl/dv/flash_ctrl_sim.core.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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")}
Expand Down
2 changes: 1 addition & 1 deletion hw/top_earlgrey/dv/chip_sim.core
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion hw/top_earlgrey/dv/env/chip_env.core
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions hw/top_earlgrey/dv/env/chip_env_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down
1 change: 1 addition & 0 deletions hw/top_earlgrey/dv/tb/tb.sv
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 01b73d5

Please sign in to comment.