Skip to content
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
3 changes: 2 additions & 1 deletion doc/ref/arch.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ The Mocha top will need a few top-level inputs.<!-- i7mqt7_x -->
Some of these are listed here:<!-- 1cwb13_x -->
- Clock outputs from PLLs.<!-- p4bt5a_x -->
- Rollback counter backed by OTP.<!-- 7215fb_x -->
- Debug and design for test enable pins.<!-- 5fh61t_x -->
- Debug enable pin which should only be changed when holding Mocha in reset. <!-- 5fh61t_x -->
- Design for test pin.
- True random noise source to drive the entropy source.<!-- 8u3w8m_x -->
- AXI subordinate port to connect to the mailbox.<!-- fna4to_x -->

Expand Down
4 changes: 3 additions & 1 deletion hw/top_chip/dv/tb/tb.sv
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ module tb;
.dm_jtag_tms (1'b0 ),
.dm_jtag_tdi (1'b0 ),
.dm_jtag_tdo ( ),
.dm_jtag_trst_n (1'b0 )
.dm_jtag_trst_n (1'b0 ),
// Testing control.
.debug_en_i (1'b1 )
);

// Assignment to the GPIO pads. If dut_gpio_en_o[i] is disabled, then let the gpio_pad[i] float so
Expand Down
4 changes: 3 additions & 1 deletion hw/top_chip/dv/verilator/top_chip_verilator.sv
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ module top_chip_verilator (
.dm_jtag_tms (jtag_tms),
.dm_jtag_tdi (jtag_tdi),
.dm_jtag_tdo (jtag_tdo),
.dm_jtag_trst_n (jtag_trst_n)
.dm_jtag_trst_n (jtag_trst_n),

.debug_en_i (1'b1)
);

// No support for dual or quad SPI in loopback mode right now.
Expand Down
29 changes: 29 additions & 0 deletions hw/top_chip/formal/riscv_debug_module/riscv_debug_module_fpv.core
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
CAPI=2:
# Copyright lowRISC and contributors (COSMIC project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

name: "lowrisc:mocha:riscv_debug_module_fpv:0.1"
description: "Formal flow for the RISC-V debug module tie-off"

filesets:
files_formal:
depend:
- lowrisc:prim:all
- lowrisc:mocha:riscv_debug_module
files:
- tb/riscv_debug_module_tb.sv
file_type: systemVerilogSource

targets:
default: &default_target
default_tool: icarus
filesets:
- files_formal
toplevel: riscv_debug_module_tb

formal:
<<: *default_target

lint:
<<: *default_target
55 changes: 55 additions & 0 deletions hw/top_chip/formal/riscv_debug_module/tb/riscv_debug_module_tb.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Copyright lowRISC and contributors (COSMIC project).
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
//
// Formal verification testbench for riscv_debug_module.

module riscv_debug_module_tb (
input logic clk_i,
input logic rst_ni,
input logic debug_en_i,

input logic tms_i,
input logic td_i,
output logic td_o,
output logic td_en_o,
input logic trst_ni,

output top_pkg::axi_req_t axi_host_req_o,
input top_pkg::axi_resp_t axi_host_resp_i,
input top_pkg::axi_dev_req_t axi_device_req_i,
output top_pkg::axi_dev_resp_t axi_device_resp_o,

output logic ndmreset_req_o,
input logic ndmreset_ack_i,

output logic debug_req_o
);

localparam config_pkg::cva6_cfg_t CVA6Cfg =
build_config_pkg::build_config(cva6_config_pkg::cva6_cfg);

riscv_debug_module #(
.CVA6Cfg ( CVA6Cfg ),
.XLen ( CVA6Cfg.XLEN )
) dut (
.clk_i,
.rst_ni,
.debug_en_i,
// Clocking the JTAG side from clk_i avoids needing a second clock in the generic FPV setup.
.tck_i (clk_i),
.tms_i,
.td_i,
.td_o,
.td_en_o,
.trst_ni,
.axi_host_req_o,
.axi_host_resp_i,
.axi_device_req_i,
.axi_device_resp_o,
.ndmreset_req_o,
.ndmreset_ack_i,
.debug_req_o
);

endmodule : riscv_debug_module_tb
10 changes: 10 additions & 0 deletions hw/top_chip/formal/top_chip_fpv_ip_cfgs.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,15 @@
exp_fail_hjson: "{proj_root}/hw/top_chip/ip_autogen/rv_plic/fpv/rv_plic_expected_failure.hjson"
after_load: ["{proj_root}/hw/top_chip/ip_autogen/rv_plic/fpv/tb/coverage.tcl"]
}
{
name: riscv_debug_module_fpv
dut: riscv_debug_module_tb
fusesoc_core: lowrisc:mocha:riscv_debug_module_fpv
import_cfgs: ["{proj_root}/hw/vendor/lowrisc_ip/formal/tools/dvsim/common_fpv_cfg.hjson"]
rel_path: "hw/top_chip/formal/riscv_debug_module/{sub_flow}/{tool}"
// Only prove the debug-disable tie-off assertions.
task: "Disable_A"
cov: false
}
]
}
25 changes: 25 additions & 0 deletions hw/top_chip/riscv_debug_module.core
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
CAPI=2:
# Copyright lowRISC and contributors (COSMIC project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

name: "lowrisc:mocha:riscv_debug_module"
description: "RISC-V debug module and JTAG DTM for Mocha"

filesets:
files_rtl:
depend:
- lowrisc:prim:assert
- lowrisc:mocha_constants:top_pkg
- lowrisc:mocha_constants:jtag_id_pkg
- pulp-platform.org::axi
- pulp-platform.org::riscv_dbg
- cosmic::cva6cheri
files:
- rtl/riscv_debug_module.sv
file_type: systemVerilogSource

targets:
default:
filesets:
- files_rtl
5 changes: 4 additions & 1 deletion hw/top_chip/rtl/chip_mocha_genesys2.sv
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,10 @@ module chip_mocha_genesys2 #(
.dm_jtag_tms (jtag_tms),
.dm_jtag_tdi (jtag_tdi),
.dm_jtag_tdo (jtag_tdo),
.dm_jtag_trst_n (jtag_trst_n & rst_n_sync_assert_50m)
.dm_jtag_trst_n (jtag_trst_n & rst_n_sync_assert_50m),

// Testing control
.debug_en_i (1'b1)
);

// GPIO tri-state output drivers
Expand Down
Loading