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

[hw,otp_ctrl,rtl] Provide a DFT config and response port #25897

Merged
merged 1 commit into from
Jan 17, 2025
Merged
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
1 change: 1 addition & 0 deletions hw/ip/prim_generic/prim_generic_otp.core
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ filesets:
- "fileset_partner ? (partner:systems:ast_pkg)"
- "!fileset_partner ? (lowrisc:systems:ast_pkg)"
- lowrisc:prim:otp_pkg
- lowrisc:prim_generic:otp_cfg_pkg
- lowrisc:ip:otp_ctrl_prim_reg_top
files:
- rtl/prim_generic_otp.sv
Expand Down
20 changes: 20 additions & 0 deletions hw/ip/prim_generic/prim_generic_otp_cfg_pkg.core
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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:prim_generic:otp_cfg_pkg"
description: "OTP Cfg package"
virtual:
- "lowrisc:prim:otp_cfg_pkg"

filesets:
files_rtl:
files:
- rtl/prim_otp_cfg_pkg.sv
file_type: systemVerilogSource

targets:
default:
filesets:
- files_rtl
59 changes: 33 additions & 26 deletions hw/ip/prim_generic/rtl/prim_generic_otp.sv
Original file line number Diff line number Diff line change
Expand Up @@ -26,42 +26,45 @@ module prim_generic_otp
parameter int VendorTestOffset = 0,
parameter int VendorTestSize = 0
) (
input clk_i,
input rst_ni,
input clk_i,
input rst_ni,
// Observability
input ast_pkg::ast_obs_ctrl_t obs_ctrl_i,
output logic [7:0] otp_obs_o,
input ast_pkg::ast_obs_ctrl_t obs_ctrl_i,
output logic [7:0] otp_obs_o,
// Macro-specific power sequencing signals to/from AST
output logic [PwrSeqWidth-1:0] pwr_seq_o,
input [PwrSeqWidth-1:0] pwr_seq_h_i,
output logic [PwrSeqWidth-1:0] pwr_seq_o,
input [PwrSeqWidth-1:0] pwr_seq_h_i,
// External programming voltage
inout wire ext_voltage_io,
inout wire ext_voltage_io,
// Test interfaces
input [TestCtrlWidth-1:0] test_ctrl_i,
output logic [TestStatusWidth-1:0] test_status_o,
output logic [TestVectWidth-1:0] test_vect_o,
input tlul_pkg::tl_h2d_t test_tl_i,
output tlul_pkg::tl_d2h_t test_tl_o,
input [TestCtrlWidth-1:0] test_ctrl_i,
output logic [TestStatusWidth-1:0] test_status_o,
output logic [TestVectWidth-1:0] test_vect_o,
input tlul_pkg::tl_h2d_t test_tl_i,
output tlul_pkg::tl_d2h_t test_tl_o,
// Other DFT signals
input prim_mubi_pkg::mubi4_t scanmode_i, // Scan Mode input
input scan_en_i, // Scan Shift
input scan_rst_ni, // Scan Reset
input prim_mubi_pkg::mubi4_t scanmode_i, // Scan Mode input
input scan_en_i, // Scan Shift
input scan_rst_ni, // Scan Reset
// Alert indication (to be connected to alert sender in the instantiating IP)
output logic fatal_alert_o,
output logic recov_alert_o,
output logic fatal_alert_o,
output logic recov_alert_o,
// Ready valid handshake for read/write command
output logic ready_o,
input valid_i,
output logic ready_o,
input valid_i,
// #(Native words)-1, e.g. size == 0 for 1 native word.
input [SizeWidth-1:0] size_i,
input [SizeWidth-1:0] size_i,
// See prim_otp_pkg for the command encoding.
input cmd_e cmd_i,
input [AddrWidth-1:0] addr_i,
input [IfWidth-1:0] wdata_i,
input cmd_e cmd_i,
input [AddrWidth-1:0] addr_i,
input [IfWidth-1:0] wdata_i,
// Response channel
output logic valid_o,
output logic [IfWidth-1:0] rdata_o,
output err_e err_o
output logic valid_o,
output logic [IfWidth-1:0] rdata_o,
output err_e err_o,
// DFT config and response port
input prim_otp_cfg_pkg::otp_cfg_t cfg_i,
output prim_otp_cfg_pkg::otp_cfg_rsp_t cfg_rsp_o
);

import prim_mubi_pkg::MuBi4False;
Expand Down Expand Up @@ -95,6 +98,10 @@ module prim_generic_otp
assign test_vect_o = '0;
assign test_status_o = '0;

logic unused_cfg;
assign unused_cfg = ^cfg_i;
assign cfg_rsp_o = '0;

////////////////////////////////////
// TL-UL Test Interface Emulation //
////////////////////////////////////
Expand Down
18 changes: 18 additions & 0 deletions hw/ip/prim_generic/rtl/prim_otp_cfg_pkg.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright lowRISC contributors (OpenTitan project).
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
//

package prim_otp_cfg_pkg;

typedef struct packed {
logic test;
} otp_cfg_t;

typedef struct packed {
logic done;
} otp_cfg_rsp_t;

parameter otp_cfg_rsp_t OTP_CFG_DEFAULT = '0;

endpackage // prim_otp_cfg_pkg
15 changes: 15 additions & 0 deletions hw/ip_templates/otp_ctrl/data/otp_ctrl.hjson.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,21 @@ otp_size_as_uint32 = otp_size_as_bytes // 4
package: ""
desc: "AST observability bus."
}
// DFT CFG and RSP signals
{ struct: "otp_cfg"
type: "uni"
name: "cfg"
act: "rcv"
default: "'0"
package: "prim_otp_cfg_pkg"
},
{ struct: "otp_cfg_rsp"
type: "uni"
name: "cfg_rsp"
act: "req"
default: "'0"
package: "prim_otp_cfg_pkg"
},
] // inter_signal_list

/////////////////////
Expand Down
9 changes: 7 additions & 2 deletions hw/ip_templates/otp_ctrl/rtl/otp_ctrl.sv
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ module otp_ctrl
input prim_mubi_pkg::mubi4_t scanmode_i,
// Test-related GPIO output
output logic [OtpTestVectWidth-1:0] cio_test_o,
output logic [OtpTestVectWidth-1:0] cio_test_en_o
output logic [OtpTestVectWidth-1:0] cio_test_en_o,
// DFT config and response port
input prim_otp_cfg_pkg::otp_cfg_t cfg_i,
output prim_otp_cfg_pkg::otp_cfg_rsp_t cfg_rsp_o
);

import prim_mubi_pkg::*;
Expand Down Expand Up @@ -846,7 +849,9 @@ end
// Read data out
.valid_o ( otp_rvalid ),
.rdata_o ( part_otp_rdata ),
.err_o ( part_otp_err )
.err_o ( part_otp_err ),
.cfg_i,
.cfg_rsp_o
);

logic otp_fifo_valid;
Expand Down
82 changes: 82 additions & 0 deletions hw/top_darjeeling/data/autogen/top_darjeeling.gen.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,34 @@
conn_type: false
index: -1
}
{
name: cfg
struct: otp_cfg
package: prim_otp_cfg_pkg
type: uni
act: rcv
width: 1
default: "'0"
inst_name: otp_ctrl
external: true
top_signame: otp_cfg
conn_type: false
index: -1
}
{
name: cfg_rsp
struct: otp_cfg_rsp
package: prim_otp_cfg_pkg
type: uni
act: req
width: 1
default: "'0"
inst_name: otp_ctrl
external: true
top_signame: otp_cfg_rsp
conn_type: false
index: -1
}
{
name: core_tl
struct: tl
Expand Down Expand Up @@ -10395,6 +10423,8 @@
otp_ctrl.otp_ast_pwr_seq_h: ""
otp_ctrl.otp_ext_voltage_h: otp_ext_voltage_h
otp_ctrl.otp_obs: otp_obs
otp_ctrl.cfg: otp_cfg
otp_ctrl.cfg_rsp: otp_cfg_rsp
rstmgr_aon.por_n: por_n
rv_core_ibex.fpga_info: fpga_info
sensor_ctrl.ast_alert: sensor_ctrl_ast_alert
Expand Down Expand Up @@ -19059,6 +19089,34 @@
conn_type: false
index: -1
}
{
name: cfg
struct: otp_cfg
package: prim_otp_cfg_pkg
type: uni
act: rcv
width: 1
default: "'0"
inst_name: otp_ctrl
external: true
top_signame: otp_cfg
conn_type: false
index: -1
}
{
name: cfg_rsp
struct: otp_cfg_rsp
package: prim_otp_cfg_pkg
type: uni
act: req
width: 1
default: "'0"
inst_name: otp_ctrl
external: true
top_signame: otp_cfg_rsp
conn_type: false
index: -1
}
{
name: core_tl
struct: tl
Expand Down Expand Up @@ -26010,6 +26068,30 @@
index: -1
netname: otp_obs
}
{
package: prim_otp_cfg_pkg
struct: otp_cfg
signame: otp_cfg_i
width: 1
type: uni
default: "'0"
direction: in
conn_type: false
index: -1
netname: otp_cfg
}
{
package: prim_otp_cfg_pkg
struct: otp_cfg_rsp
signame: otp_cfg_rsp_o
width: 1
type: uni
default: "'0"
direction: out
conn_type: false
index: -1
netname: otp_cfg_rsp
}
{
package: ""
struct: logic
Expand Down
2 changes: 2 additions & 0 deletions hw/top_darjeeling/data/top_darjeeling.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,8 @@
'otp_ctrl.otp_ast_pwr_seq_h' : '',
'otp_ctrl.otp_ext_voltage_h' : 'otp_ext_voltage_h',
'otp_ctrl.otp_obs' : 'otp_obs',
'otp_ctrl.cfg' : 'otp_cfg',
'otp_ctrl.cfg_rsp' : 'otp_cfg_rsp',
'rstmgr_aon.por_n' : 'por_n'
'rv_core_ibex.fpga_info' : 'fpga_info'
'sensor_ctrl.ast_alert' : 'sensor_ctrl_ast_alert',
Expand Down
15 changes: 15 additions & 0 deletions hw/top_darjeeling/ip_autogen/otp_ctrl/data/otp_ctrl.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -2028,6 +2028,21 @@
package: ""
desc: "AST observability bus."
}
// DFT CFG and RSP signals
{ struct: "otp_cfg"
type: "uni"
name: "cfg"
act: "rcv"
default: "'0"
package: "prim_otp_cfg_pkg"
},
{ struct: "otp_cfg_rsp"
type: "uni"
name: "cfg_rsp"
act: "req"
default: "'0"
package: "prim_otp_cfg_pkg"
},
] // inter_signal_list

/////////////////////
Expand Down
2 changes: 2 additions & 0 deletions hw/top_darjeeling/ip_autogen/otp_ctrl/doc/interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ Referring to the [Comportable guideline for peripheral device functionality](htt
| otp_broadcast | otp_ctrl_part_pkg::otp_broadcast | uni | req | 1 | Output of the HW partitions with breakout data types. |
| obs_ctrl | ast_pkg::ast_obs_ctrl | uni | rcv | 1 | AST observability control signals. |
| otp_obs | logic | uni | req | 8 | AST observability bus. |
| cfg | prim_otp_cfg_pkg::otp_cfg | uni | rcv | 1 | |
| cfg_rsp | prim_otp_cfg_pkg::otp_cfg_rsp | uni | req | 1 | |
| core_tl | tlul_pkg::tl | req_rsp | rsp | 1 | |
| prim_tl | tlul_pkg::tl | req_rsp | rsp | 1 | |

Expand Down
9 changes: 7 additions & 2 deletions hw/top_darjeeling/ip_autogen/otp_ctrl/rtl/otp_ctrl.sv
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ module otp_ctrl
input prim_mubi_pkg::mubi4_t scanmode_i,
// Test-related GPIO output
output logic [OtpTestVectWidth-1:0] cio_test_o,
output logic [OtpTestVectWidth-1:0] cio_test_en_o
output logic [OtpTestVectWidth-1:0] cio_test_en_o,
// DFT config and response port
input prim_otp_cfg_pkg::otp_cfg_t cfg_i,
output prim_otp_cfg_pkg::otp_cfg_rsp_t cfg_rsp_o
);

import prim_mubi_pkg::*;
Expand Down Expand Up @@ -846,7 +849,9 @@ end
// Read data out
.valid_o ( otp_rvalid ),
.rdata_o ( part_otp_rdata ),
.err_o ( part_otp_err )
.err_o ( part_otp_err ),
.cfg_i,
.cfg_rsp_o
);

logic otp_fifo_valid;
Expand Down
4 changes: 4 additions & 0 deletions hw/top_darjeeling/rtl/autogen/top_darjeeling.sv
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ module top_darjeeling #(
input otp_ctrl_pkg::otp_ast_rsp_t otp_ctrl_otp_ast_pwr_seq_h_i,
inout otp_ext_voltage_h_io,
output logic [7:0] otp_obs_o,
input prim_otp_cfg_pkg::otp_cfg_t otp_cfg_i,
output prim_otp_cfg_pkg::otp_cfg_rsp_t otp_cfg_rsp_o,
input logic [1:0] por_n_i,
input logic [31:0] fpga_info_i,
input ast_pkg::ast_alert_req_t sensor_ctrl_ast_alert_req_i,
Expand Down Expand Up @@ -1199,6 +1201,8 @@ module top_darjeeling #(
.otp_broadcast_o(otp_ctrl_otp_broadcast),
.obs_ctrl_i(ast_obs_ctrl),
.otp_obs_o(otp_obs_o),
.cfg_i(otp_cfg_i),
.cfg_rsp_o(otp_cfg_rsp_o),
.core_tl_i(otp_ctrl_core_tl_req),
.core_tl_o(otp_ctrl_core_tl_rsp),
.prim_tl_i(otp_ctrl_prim_tl_req),
Expand Down
Loading
Loading