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,entropy_src,rtl] Move RNG_BUS_WIDTH from entropy_src to top_pkg #25769

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 4 additions & 0 deletions hw/dv/sv/entropy_src_xht_agent/entropy_src_xht_agent_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ package entropy_src_xht_agent_pkg;
import dv_lib_pkg::*;
import entropy_src_pkg::*;

// TODO(#25760): Make the RNG BUS WIDTH parameter overwritable from the outside to allow
// testing other configs than the Earlgrey config
parameter uint RNG_BUS_WIDTH = 4;

// macro includes
`include "uvm_macros.svh"
`include "dv_macros.svh"
Expand Down
4 changes: 4 additions & 0 deletions hw/ip/entropy_src/dv/env/entropy_src_env_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ package entropy_src_env_pkg;
`include "uvm_macros.svh"
`include "dv_macros.svh"

// TODO(#25760): Make the RNG BUS WIDTH parameter overwritable from the outside to allow
// testing other configs than the Earlgrey config
parameter uint RNG_BUS_WIDTH = 4;

// parameters
parameter bit [TL_DW-1:0] INCR_ENTROPY_LO = 32'h76543210;
parameter bit [TL_DW-1:0] INCR_ENTROPY_HI = 32'hfedcba98;
Expand Down
2 changes: 2 additions & 0 deletions hw/ip/entropy_src/entropy_src_pkg.core
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ description: "entropy_src_pkg"

filesets:
files_rtl:
depend:
- lowrisc:constants:top_pkg
files:
- rtl/entropy_src_pkg.sv
file_type: systemVerilogSource
Expand Down
2 changes: 1 addition & 1 deletion hw/ip/entropy_src/rtl/entropy_src_core.sv
Original file line number Diff line number Diff line change
Expand Up @@ -3128,7 +3128,7 @@ module entropy_src_core import entropy_src_pkg::*; #(
logic [63:0] rng_valid_bit_cnt_d, rng_valid_bit_cnt_q;
assign rng_valid_bit_cnt_d = entropy_src_rng_i.rng_valid && es_enable_fo[5] &&
es_delayed_enable_q ?
rng_valid_bit_cnt_q + RNG_BUS_WIDTH :
rng_valid_bit_cnt_q + top_pkg::RNG_BUS_WIDTH :
rng_valid_bit_cnt_q;

// Count number of bits pushed into esrng FIFO (RngBusWidth wide).
Expand Down
5 changes: 2 additions & 3 deletions hw/ip/entropy_src/rtl/entropy_src_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ package entropy_src_pkg;
// Entropy Interface
//-------------------------

parameter int RNG_BUS_WIDTH = 4;
parameter int CSRNG_BUS_WIDTH = 384;
parameter int FIPS_BUS_WIDTH = 1;
parameter int FIPS_CSRNG_BUS_WIDTH = FIPS_BUS_WIDTH + CSRNG_BUS_WIDTH;
Expand Down Expand Up @@ -51,15 +50,15 @@ package entropy_src_pkg;

typedef struct packed {
logic rng_valid;
logic [RNG_BUS_WIDTH-1:0] rng_b;
logic [top_pkg::RNG_BUS_WIDTH-1:0] rng_b;
} entropy_src_rng_rsp_t;

parameter entropy_src_rng_req_t ENTROPY_SRC_RNG_REQ_DEFAULT = '{default: '0};
parameter entropy_src_rng_rsp_t ENTROPY_SRC_RNG_RSP_DEFAULT = '{default: '0};

// external health test i/f
typedef struct packed {
logic [RNG_BUS_WIDTH-1:0] entropy_bit;
logic [top_pkg::RNG_BUS_WIDTH-1:0] entropy_bit;
logic entropy_bit_valid;
logic rng_bit_en;
logic [1:0] rng_bit_sel;
Expand Down
4 changes: 4 additions & 0 deletions hw/top_darjeeling/rtl/top_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ localparam int TL_DUW=14; // d_user
localparam int TL_DBW=(TL_DW>>3);
localparam int TL_SZW=$clog2($clog2(TL_DBW)+1);

// Datapath width from the entropy source IP to the actual source of randomness.
// This parameter is top-specific and depends on the actully used source of randomness.
parameter int RNG_BUS_WIDTH = 16;

// NOTE THAT THIS IS A FEATURE FOR TEST CHIPS ONLY TO MITIGATE
// THE RISK OF A BROKEN OTP MACRO. THIS WILL BE DISABLED FOR
// PRODUCTION DEVICES.
Expand Down
4 changes: 4 additions & 0 deletions hw/top_earlgrey/rtl/top_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ localparam int TL_DUW=14; // d_user
localparam int TL_DBW=(TL_DW>>3);
localparam int TL_SZW=$clog2($clog2(TL_DBW)+1);

// Datapath width from the entropy source IP to the actual source of randomness.
// This parameter is top-specific and depends on the actully used source of randomness.
parameter int RNG_BUS_WIDTH = 4;

// NOTE THAT THIS IS A FEATURE FOR TEST CHIPS ONLY TO MITIGATE
// THE RISK OF A BROKEN OTP MACRO. THIS WILL BE DISABLED FOR
// PRODUCTION DEVICES.
Expand Down
Loading