Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dv,mem_bkdr_util] Separate out flash_bkdr_util #26081

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
26 changes: 26 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,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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these dependencies all needed or do the already get pulled in from the mem_bkdr_util? Or is it just a safeguard?

Copy link
Contributor Author

@alees24 alees24 Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've dropped a couple but I think the rest are all needed. I would observe that many of our core files appear not to be as minimal as they could be if they relied upon transitivity. I am a bit apprehensive about breaking an untested build, and I'm sure CI is far from complete w.r.t. that.

- 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
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
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
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
- lowrisc:opentitan:top_earlgrey_flash_ctrl_pkg
- lowrisc:constants:top_earlgrey_top_pkg
Expand Down
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
- lowrisc:opentitan:top_earlgrey_flash_ctrl_test
- lowrisc:opentitan:top_earlgrey_flash_ctrl_sva
- lowrisc:opentitan:top_earlgrey_flash_ctrl_cov
Expand Down
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
- lowrisc:opentitan:top_englishbreakfast_flash_ctrl_pkg
- lowrisc:constants:top_englishbreakfast_top_pkg
Expand Down
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
- lowrisc:opentitan:top_englishbreakfast_flash_ctrl_test
- lowrisc:opentitan:top_englishbreakfast_flash_ctrl_sva
- lowrisc:opentitan:top_englishbreakfast_flash_ctrl_cov
Expand Down
Loading