[lc_ctrl/otp_ctrl] Restructure design accordingly
Signed-off-by: Michael Schaffner <msf@opentitan.org>
diff --git a/hw/ip/lc_ctrl/dv/env/lc_ctrl_if.sv b/hw/ip/lc_ctrl/dv/env/lc_ctrl_if.sv
index df4db66..770fd9c 100644
--- a/hw/ip/lc_ctrl/dv/env/lc_ctrl_if.sv
+++ b/hw/ip/lc_ctrl/dv/env/lc_ctrl_if.sv
@@ -43,8 +43,6 @@
otp_i.error = 0;
otp_i.state = lc_state;
otp_i.count = lc_cnt;
- otp_i.all_zero_token = 0;
- otp_i.raw_unlock_token = 0;
otp_i.test_unlock_token = 0;
otp_i.test_exit_token = 0;
otp_i.rma_token = 0;
diff --git a/hw/ip/lc_ctrl/rtl/lc_ctrl.sv b/hw/ip/lc_ctrl/rtl/lc_ctrl.sv
index c536219..3acec1f 100644
--- a/hw/ip/lc_ctrl/rtl/lc_ctrl.sv
+++ b/hw/ip/lc_ctrl/rtl/lc_ctrl.sv
@@ -10,6 +10,7 @@
module lc_ctrl
import lc_ctrl_pkg::*;
import lc_ctrl_reg_pkg::*;
+ import lc_ctrl_state_pkg::*;
#(
// Enable asynchronous transitions on alerts.
parameter logic [NumAlerts-1:0] AlertAsyncOn = {NumAlerts{1'b1}},
@@ -484,8 +485,6 @@
.lc_state_i ( otp_lc_data_i.state ),
.lc_id_state_i ( otp_lc_data_i.id_state ),
.lc_cnt_i ( otp_lc_data_i.count ),
- .all_zero_token_i ( otp_lc_data_i.all_zero_token ),
- .raw_unlock_token_i ( otp_lc_data_i.raw_unlock_token ),
.test_unlock_token_i ( otp_lc_data_i.test_unlock_token ),
.test_exit_token_i ( otp_lc_data_i.test_exit_token ),
.rma_token_i ( otp_lc_data_i.rma_token ),
diff --git a/hw/ip/lc_ctrl/rtl/lc_ctrl_fsm.sv b/hw/ip/lc_ctrl/rtl/lc_ctrl_fsm.sv
index eb464fe..11cb9fe 100644
--- a/hw/ip/lc_ctrl/rtl/lc_ctrl_fsm.sv
+++ b/hw/ip/lc_ctrl/rtl/lc_ctrl_fsm.sv
@@ -6,6 +6,7 @@
module lc_ctrl_fsm
import lc_ctrl_pkg::*;
+ import lc_ctrl_state_pkg::*;
#(// Random netlist constants
parameter lc_keymgr_div_t RndCnstLcKeymgrDivInvalid = LcKeymgrDivWidth'(0),
parameter lc_keymgr_div_t RndCnstLcKeymgrDivTestDevRma = LcKeymgrDivWidth'(1),
@@ -28,8 +29,6 @@
input lc_id_state_e lc_id_state_i,
input lc_cnt_e lc_cnt_i,
// Token input from OTP (these are all hash post-images).
- input lc_token_t all_zero_token_i,
- input lc_token_t raw_unlock_token_i,
input lc_token_t test_unlock_token_i,
input lc_token_t test_exit_token_i,
input lc_token_t rma_token_i,
@@ -111,7 +110,7 @@
`ASSERT_KNOWN(FsmStateKnown_A, fsm_state_q )
// Hashed token to compare against.
- logic [LcTokenWidth-1:0] hashed_token_mux;
+ lc_token_t hashed_token_mux;
always_comb begin : p_fsm
// FSM default state assignments.
@@ -383,12 +382,12 @@
// Note that we always perform a token comparison, even in case of
// unconditional transitions. In the case of unconditional tokens
// we just pass an all-zero constant through the hashing function.
- logic [2**TokenIdxWidth-1:0][LcTokenWidth-1:0] hashed_tokens;
+ lc_token_t [2**TokenIdxWidth-1:0] hashed_tokens;
logic [TokenIdxWidth-1:0] token_idx;
always_comb begin : p_token_assign
hashed_tokens = '0;
- hashed_tokens[ZeroTokenIdx] = all_zero_token_i;
- hashed_tokens[RawUnlockTokenIdx] = raw_unlock_token_i;
+ hashed_tokens[ZeroTokenIdx] = AllZeroTokenHashed;
+ hashed_tokens[RawUnlockTokenIdx] = RndCnstRawUnlockTokenHashed;
hashed_tokens[TestUnlockTokenIdx] = test_unlock_token_i;
hashed_tokens[TestExitTokenIdx] = test_exit_token_i;
hashed_tokens[RmaTokenIdx] = rma_token_i;
diff --git a/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv b/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv
index a9ca2ad..e47ec28 100644
--- a/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv
+++ b/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv
@@ -13,7 +13,6 @@
/////////////////////////////////
parameter int LcValueWidth = 16;
- parameter int LcTokenWidth = 128;
parameter int NumLcStateValues = 12;
parameter int LcStateWidth = NumLcStateValues * LcValueWidth;
parameter int NumLcCountValues = 16;
@@ -24,6 +23,7 @@
parameter int LcIdStateWidth = LcValueWidth;
parameter int DecLcIdStateWidth = 2;
+ parameter int LcTokenWidth = 128;
typedef logic [LcTokenWidth-1:0] lc_token_t;
typedef enum logic [LcStateWidth-1:0] {
diff --git a/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv b/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv
index b4003f5..d9628c9 100644
--- a/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv
+++ b/hw/ip/lc_ctrl/rtl/lc_ctrl_state_pkg.sv
@@ -10,6 +10,11 @@
//
package lc_ctrl_state_pkg;
+
+ /////////////////////////////////////////////
+ // Life cycle manufacturing state encoding //
+ /////////////////////////////////////////////
+
// These values have been generated such that they are incrementally writeable with respect
// to the ECC polynomial specified. The values are used to define the life cycle manufacturing
// state and transition counter encoding in lc_ctrl_pkg.sv.
@@ -145,4 +150,21 @@
parameter logic [15:0] F0 = 16'b1111011110111110; // ECC: 6'b101100
+ ///////////////////////////////////////////
+ // Hashed RAW unlock and all-zero tokens //
+ ///////////////////////////////////////////
+
+ parameter logic [127:0] AllZeroToken = {
+ 128'h0
+ };
+ parameter logic [127:0] RndCnstRawUnlockToken = {
+ 128'hF7968F592FD0C739C407F369AEBEB941
+ };
+ parameter logic [127:0] AllZeroTokenHashed = {
+ 128'h0
+ };
+ parameter logic [127:0] RndCnstRawUnlockTokenHashed = {
+ 128'hF7968F592FD0C739C407F369AEBEB941
+ };
+
endpackage : lc_ctrl_state_pkg
diff --git a/hw/ip/otp_ctrl/data/otp_ctrl.hjson b/hw/ip/otp_ctrl/data/otp_ctrl.hjson
index 886f88e..8098a93 100644
--- a/hw/ip/otp_ctrl/data/otp_ctrl.hjson
+++ b/hw/ip/otp_ctrl/data/otp_ctrl.hjson
@@ -59,30 +59,6 @@
randcount: "40",
randtype: "perm", // random permutation for randcount elements
}
- { name: "RndCnstKey",
- desc: "Compile-time random scrambling keys",
- type: "otp_ctrl_pkg::key_array_t"
- randcount: "384", // 3*128
- randtype: "data", // randomize randcount databits
- }
- { name: "RndCnstDigestConst",
- desc: "Compile-time random digest constant",
- type: "otp_ctrl_pkg::digest_const_array_t"
- randcount: "640", // 5*128
- randtype: "data", // randomize randcount databits
- }
- { name: "RndCnstDigestIV",
- desc: "Compile-time random digest IV",
- type: "otp_ctrl_pkg::digest_iv_array_t"
- randcount: "320", // 5*64
- randtype: "data", // randomize randcount databits
- }
- { name: "RndCnstRawUnlockToken",
- desc: "Compile-time random value for RAW unlock token.",
- type: "lc_ctrl_pkg::lc_token_t"
- randcount: "128",
- randtype: "data", // randomize randcount databits
- }
// Normal parameters
{ name: "NumSramKeyReqSlots",
desc: "Number of key slots",
diff --git a/hw/ip/otp_ctrl/dv/env/otp_ctrl_scoreboard.sv b/hw/ip/otp_ctrl/dv/env/otp_ctrl_scoreboard.sv
index dca33b6..65a262e 100644
--- a/hw/ip/otp_ctrl/dv/env/otp_ctrl_scoreboard.sv
+++ b/hw/ip/otp_ctrl/dv/env/otp_ctrl_scoreboard.sv
@@ -102,13 +102,13 @@
bit [SCRAMBLE_DATA_SIZE-1:0] exp_data_0, exp_data_1;
lc_token_fifo.get(rcv_item);
exp_data_0 = present_encode_with_final_const(
- .data(RndCnstDigestIVDefault[LcRawDigest]),
+ .data(RndCnstDigestIV[LcRawDigest]),
.key(rcv_item.h_data),
- .final_const(RndCnstDigestConstDefault[LcRawDigest]));
+ .final_const(RndCnstDigestConst[LcRawDigest]));
exp_data_1 = present_encode_with_final_const(
.data(exp_data_0),
.key(rcv_item.h_data),
- .final_const(RndCnstDigestConstDefault[LcRawDigest]));
+ .final_const(RndCnstDigestConst[LcRawDigest]));
`DV_CHECK_EQ(rcv_item.d_data, {exp_data_1, exp_data_0}, "lc_token_encode_mismatch")
end
endtask
@@ -152,16 +152,16 @@
// calculate key
sram_key = get_key_from_otp(part_locked, SramDataKeySeedOffset / 4);
exp_key_lower = present_encode_with_final_const(
- .data(RndCnstDigestIVDefault[SramDataKey]),
+ .data(RndCnstDigestIV[SramDataKey]),
.key(sram_key),
- .final_const(RndCnstDigestConstDefault[SramDataKey]),
+ .final_const(RndCnstDigestConst[SramDataKey]),
.second_key(edn_key1),
.num_round(2));
exp_key_higher = present_encode_with_final_const(
- .data(RndCnstDigestIVDefault[SramDataKey]),
+ .data(RndCnstDigestIV[SramDataKey]),
.key(sram_key),
- .final_const(RndCnstDigestConstDefault[SramDataKey]),
+ .final_const(RndCnstDigestConst[SramDataKey]),
.second_key(edn_key2),
.num_round(2));
exp_key = {exp_key_higher, exp_key_lower};
@@ -197,15 +197,15 @@
// calculate key
flash_key = get_key_from_otp(part_locked, flash_key_index);
exp_key_lower = present_encode_with_final_const(
- .data(RndCnstDigestIVDefault[sel_flash]),
+ .data(RndCnstDigestIV[sel_flash]),
.key(flash_key),
- .final_const(RndCnstDigestConstDefault[sel_flash]));
+ .final_const(RndCnstDigestConst[sel_flash]));
flash_key = get_key_from_otp(part_locked, flash_key_index + 4);
exp_key_higher = present_encode_with_final_const(
- .data(RndCnstDigestIVDefault[sel_flash]),
+ .data(RndCnstDigestIV[sel_flash]),
.key(flash_key),
- .final_const(RndCnstDigestConstDefault[sel_flash]));
+ .final_const(RndCnstDigestConst[sel_flash]));
exp_key = {exp_key_higher, exp_key_lower};
`DV_CHECK_EQ(key, exp_key, $sformatf("flash %s key mismatch", sel_flash.name()))
end
@@ -244,16 +244,16 @@
// calculate key
sram_key = get_key_from_otp(part_locked, SramDataKeySeedOffset / 4);
exp_key_lower = present_encode_with_final_const(
- .data(RndCnstDigestIVDefault[SramDataKey]),
+ .data(RndCnstDigestIV[SramDataKey]),
.key(sram_key),
- .final_const(RndCnstDigestConstDefault[SramDataKey]),
+ .final_const(RndCnstDigestConst[SramDataKey]),
.second_key(edn_key1),
.num_round(2));
exp_key_higher = present_encode_with_final_const(
- .data(RndCnstDigestIVDefault[SramDataKey]),
+ .data(RndCnstDigestIV[SramDataKey]),
.key(sram_key),
- .final_const(RndCnstDigestConstDefault[SramDataKey]),
+ .final_const(RndCnstDigestConst[SramDataKey]),
.second_key(edn_key2),
.num_round(2));
exp_key = {exp_key_higher, exp_key_lower};
@@ -502,7 +502,7 @@
// The last 64-round PRESENT calculation will use a global digest constant as key input
function void cal_digest_val(int part_idx);
bit [NUM_ROUND-1:0] [SCRAMBLE_DATA_SIZE-1:0] enc_array;
- bit [SCRAMBLE_DATA_SIZE-1:0] init_vec = RndCnstDigestIVDefault[0];
+ bit [SCRAMBLE_DATA_SIZE-1:0] init_vec = RndCnstDigestIV[0];
bit [TL_DW-1:0] mem_q[$];
int array_size;
real key_factor = SCRAMBLE_KEY_SIZE / TL_DW;
@@ -558,7 +558,7 @@
// Last 32 round of digest is calculated with a digest constant
crypto_dpi_present_pkg::sv_dpi_present_encrypt(digests[part_idx],
- RndCnstDigestConstDefault[0],
+ RndCnstDigestConst[0],
key_size_80,
enc_array);
// XOR the previous state into the digest result according to the Davies-Meyer scheme.
@@ -571,7 +571,7 @@
int secret_idx = part_idx - Secret0Idx;
bit [NUM_ROUND-1:0][SCRAMBLE_DATA_SIZE-1:0] output_data;
crypto_dpi_present_pkg::sv_dpi_present_encrypt(input_data,
- RndCnstKeyDefault[secret_idx],
+ RndCnstKey[secret_idx],
key_size_80,
output_data);
scramble_data = output_data[NUM_ROUND-1];
@@ -583,7 +583,7 @@
int secret_idx = part_idx - Secret0Idx;
bit [NUM_ROUND-1:0][SCRAMBLE_DATA_SIZE-1:0] output_data;
crypto_dpi_present_pkg::sv_dpi_present_decrypt(input_data,
- RndCnstKeyDefault[secret_idx],
+ RndCnstKey[secret_idx],
key_size_80,
output_data);
descramble_data = output_data[NUM_ROUND-1];
diff --git a/hw/ip/otp_ctrl/otp_ctrl.core b/hw/ip/otp_ctrl/otp_ctrl.core
index c16b6b9..ce3b97e 100644
--- a/hw/ip/otp_ctrl/otp_ctrl.core
+++ b/hw/ip/otp_ctrl/otp_ctrl.core
@@ -24,7 +24,6 @@
- rtl/otp_ctrl_reg_top.sv
- rtl/otp_ctrl_ecc_reg.sv
- rtl/otp_ctrl_scrmbl.sv
- - rtl/otp_ctrl_token_const.sv
- rtl/otp_ctrl_lfsr_timer.sv
- rtl/otp_ctrl_part_unbuf.sv
- rtl/otp_ctrl_part_buf.sv
diff --git a/hw/ip/otp_ctrl/rtl/otp_ctrl.sv b/hw/ip/otp_ctrl/rtl/otp_ctrl.sv
index 3bdb5bc..f8a3c4e 100644
--- a/hw/ip/otp_ctrl/rtl/otp_ctrl.sv
+++ b/hw/ip/otp_ctrl/rtl/otp_ctrl.sv
@@ -13,14 +13,10 @@
import otp_ctrl_part_pkg::*;
#(
// Enable asynchronous transitions on alerts.
- parameter logic [NumAlerts-1:0] AlertAsyncOn = {NumAlerts{1'b1}},
+ parameter logic [NumAlerts-1:0] AlertAsyncOn = {NumAlerts{1'b1}},
// Compile time random constants, to be overriden by topgen.
- parameter lfsr_seed_t RndCnstLfsrSeed = RndCnstLfsrSeedDefault,
- parameter lfsr_perm_t RndCnstLfsrPerm = RndCnstLfsrPermDefault,
- parameter key_array_t RndCnstKey = RndCnstKeyDefault,
- parameter digest_const_array_t RndCnstDigestConst = RndCnstDigestConstDefault,
- parameter digest_iv_array_t RndCnstDigestIV = RndCnstDigestIVDefault,
- parameter lc_ctrl_pkg::lc_token_t RndCnstRawUnlockToken = RndCnstRawUnlockTokenDefault,
+ parameter lfsr_seed_t RndCnstLfsrSeed = RndCnstLfsrSeedDefault,
+ parameter lfsr_perm_t RndCnstLfsrPerm = RndCnstLfsrPermDefault,
// Hexfile file to initialize the OTP macro.
// Note that the hexdump needs to account for ECC.
parameter MemInitFile = ""
@@ -720,11 +716,7 @@
logic scrmbl_arb_req_ready, scrmbl_arb_rsp_valid;
logic [NumAgents-1:0] part_scrmbl_req_ready, part_scrmbl_rsp_valid;
- otp_ctrl_scrmbl #(
- .RndCnstKey(RndCnstKey),
- .RndCnstDigestConst(RndCnstDigestConst),
- .RndCnstDigestIV(RndCnstDigestIV)
- ) u_scrmbl (
+ otp_ctrl_scrmbl u_scrmbl (
.clk_i,
.rst_ni,
.cmd_i ( scrmbl_req_bundle.cmd ),
@@ -747,19 +739,6 @@
part_scrmbl_rsp_valid[scrmbl_mtx_idx] = scrmbl_arb_rsp_valid;
end
- /////////////////////////////////////////////
- // Static fife cycle token precomputations //
- /////////////////////////////////////////////
-
- otp_ctrl_token_const #(
- .RndCnstDigestConst ( RndCnstDigestConst ),
- .RndCnstDigestIV ( RndCnstDigestIV ),
- .RndCnstRawUnlockToken ( RndCnstRawUnlockToken )
- ) u_otp_ctrl_token_const (
- .all_zero_token_hashed_o ( otp_lc_data_o.all_zero_token ),
- .raw_unlock_token_hashed_o ( otp_lc_data_o.raw_unlock_token )
- );
-
/////////////////////////////
// Direct Access Interface //
/////////////////////////////
diff --git a/hw/ip/otp_ctrl/rtl/otp_ctrl_kdi.sv b/hw/ip/otp_ctrl/rtl/otp_ctrl_kdi.sv
index 8a6d9a3..81b990a 100644
--- a/hw/ip/otp_ctrl/rtl/otp_ctrl_kdi.sv
+++ b/hw/ip/otp_ctrl/rtl/otp_ctrl_kdi.sv
@@ -10,6 +10,7 @@
module otp_ctrl_kdi
import otp_ctrl_pkg::*;
import otp_ctrl_reg_pkg::*;
+ import otp_ctrl_part_pkg::*;
(
input clk_i,
input rst_ni,
diff --git a/hw/ip/otp_ctrl/rtl/otp_ctrl_lci.sv b/hw/ip/otp_ctrl/rtl/otp_ctrl_lci.sv
index 0151807..b10794e 100644
--- a/hw/ip/otp_ctrl/rtl/otp_ctrl_lci.sv
+++ b/hw/ip/otp_ctrl/rtl/otp_ctrl_lci.sv
@@ -10,6 +10,7 @@
module otp_ctrl_lci
import otp_ctrl_pkg::*;
import otp_ctrl_reg_pkg::*;
+ import otp_ctrl_part_pkg::*;
#(
// Lifecycle partition information
parameter part_info_t Info = part_info_t'(0)
diff --git a/hw/ip/otp_ctrl/rtl/otp_ctrl_part_buf.sv b/hw/ip/otp_ctrl/rtl/otp_ctrl_part_buf.sv
index bf00a03..8e1f916 100644
--- a/hw/ip/otp_ctrl/rtl/otp_ctrl_part_buf.sv
+++ b/hw/ip/otp_ctrl/rtl/otp_ctrl_part_buf.sv
@@ -10,6 +10,7 @@
module otp_ctrl_part_buf
import otp_ctrl_pkg::*;
import otp_ctrl_reg_pkg::*;
+ import otp_ctrl_part_pkg::*;
#(
// Partition information.
parameter part_info_t Info = part_info_t'(0),
diff --git a/hw/ip/otp_ctrl/rtl/otp_ctrl_part_pkg.sv b/hw/ip/otp_ctrl/rtl/otp_ctrl_part_pkg.sv
index ed0a029..0ce3d47 100644
--- a/hw/ip/otp_ctrl/rtl/otp_ctrl_part_pkg.sv
+++ b/hw/ip/otp_ctrl/rtl/otp_ctrl_part_pkg.sv
@@ -11,9 +11,96 @@
package otp_ctrl_part_pkg;
+ import prim_util_pkg::vbits;
import otp_ctrl_reg_pkg::*;
import otp_ctrl_pkg::*;
+ ////////////////////////////////////
+ // Scrambling Constants and Types //
+ ////////////////////////////////////
+
+ parameter int NumScrmblKeys = 3;
+ parameter int NumDigestSets = 5;
+ parameter int ConstSelWidth = (NumScrmblKeys > NumDigestSets) ?
+ vbits(NumScrmblKeys) :
+ vbits(NumDigestSets);
+
+ typedef enum logic [ConstSelWidth-1:0] {
+ StandardMode,
+ ChainedMode
+ } digest_mode_e;
+
+ typedef logic [NumScrmblKeys-1:0][ScrmblKeyWidth-1:0] key_array_t;
+ typedef logic [NumDigestSets-1:0][ScrmblKeyWidth-1:0] digest_const_array_t;
+ typedef logic [NumDigestSets-1:0][ScrmblBlockWidth-1:0] digest_iv_array_t;
+
+ typedef enum logic [ConstSelWidth-1:0] {
+ Secret0Key,
+ Secret1Key,
+ Secret2Key
+ } key_sel_e;
+
+ typedef enum logic [ConstSelWidth-1:0] {
+ CnstyDigest,
+ LcRawDigest,
+ FlashDataKey,
+ FlashAddrKey,
+ SramDataKey
+ } digest_sel_e;
+
+ parameter key_array_t RndCnstKey = {
+ 128'h111726B87A8DA7734528FE65ACF2E91C,
+ 128'h299E94734DB9ADC6E4F933346ABB52C3,
+ 128'h4B75748FF0382D870340676BD2414F29
+ };
+
+ // Note: digest set 0 is used for computing the partition digests. Constants at
+ // higher indices are used to compute the scrambling keys.
+ parameter digest_const_array_t RndCnstDigestConst = {
+ 128'h8E0C348CA8E4395F0EFCA49A4E5EB112,
+ 128'hC7E4407BD9F59142D45FA53EB0D0F448,
+ 128'h33097F8516255FC2544E8ABF449BF43D,
+ 128'h250EA46FD91AB2A83D5E6030EE24C8F2,
+ 128'hAF9FA146B03363A90511ECF5677CAA8A
+ };
+
+ parameter digest_iv_array_t RndCnstDigestIV = {
+ 64'hD223F9F96B3AF018,
+ 64'hA856DBEA82CE4F60,
+ 64'h795369DD1E832668,
+ 64'hB6CAD24622EEB3FC,
+ 64'hD2367D979F3792E6
+ };
+
+
+ /////////////////////////////////////
+ // Typedefs for Partition Metadata //
+ /////////////////////////////////////
+
+ typedef enum logic [1:0] {
+ Unbuffered,
+ Buffered,
+ LifeCycle
+ } part_variant_e;
+
+ typedef struct packed {
+ part_variant_e variant;
+ // Offset and size within the OTP array, in Bytes.
+ logic [OtpByteAddrWidth-1:0] offset;
+ logic [OtpByteAddrWidth-1:0] size;
+ // Key index to use for scrambling.
+ key_sel_e key_sel;
+ // Attributes
+ logic secret; // Whether the partition is secret (and hence scrambled)
+ logic hw_digest; // Whether the partition has a hardware digest
+ logic write_lock; // Whether the partition is write lockable (via digest)
+ logic read_lock; // Whether the partition is read lockable (via digest)
+ } part_info_t;
+
+ ////////////////////////
+ // Partition Metadata //
+ ////////////////////////
+
localparam part_info_t PartInfo [NumPart] = '{
// CREATOR_SW_CFG
'{
@@ -132,35 +219,34 @@
192'h0
}),
960'({
- {256{1'b1}},
- 256'h9ED083876F9B45F8EA1D657FDC80B705FC8924E565C353A28E0C348CA8E4395F,
- 256'hEFCA49A4E5EB112D223F9F96B3AF018C7E4407BD9F59142D45FA53EB0D0F448,
- 128'hA856DBEA82CE4F6033097F8516255FC2
+ 64'h7A8F190A7B1D49A5,
+ 256'h802C7A6E3D1C112059AE8F16A03C02CF9D80A110C00FE4A62422357CD36F3FC9,
+ 256'h643B3F6AB70C8616D71DB2F32F19B944B7172CA9558B5AA504FF281CE77D9A44,
+ 128'hE9260D8600B44DB3FC18B776639287E9
}),
704'({
- {256{1'b1}},
- 128'h544E8ABF449BF43D795369DD1E832668,
- 256'h250EA46FD91AB2A83D5E6030EE24C8F2B6CAD24622EEB3FCAF9FA146B03363A9,
- 256'h511ECF5677CAA8AD2367D979F3792E6111726B87A8DA7734528FE65ACF2E91C
+ 64'h61758EC952F1A1D,
+ 128'hB40DCDFC699B861395454DACB648013D,
+ 256'hCCF53B7AFA27198CE7E98FC2D1C99DDD9278BCA26D2B916BB12C647D32C9A4EF,
+ 256'hBCC41D60D86650FD69951800D0E052B49C213B2BAEFBA438D579305E26ED25AF
}),
320'({
- {256{1'b1}},
- 128'h299E94734DB9ADC6E4F933346ABB52C3,
- 128'h4B75748FF0382D870340676BD2414F29
+ 64'h46CAA9DDBB9EBC86,
+ 128'h54C4BC30BA8D41DEE99396872E5F45DD,
+ 128'hFF60D27A6D4879A390B7F9A66D065A09
}),
1664'({
- {256{1'b1}},
+ 64'hC7409D6C7A2009AE,
1344'h0,
- {256{1'b1}}
+ 256'hE50D60613825E913269174353E22EACF80BAA225DDFD1DE49ED083876F9B45F8
}),
6144'({
- {256{1'b1}},
+ 64'hEA1D657FDC80B705,
6080'h0
}),
6144'({
- {256{1'b1}},
+ 64'hFC8924E565C353A2,
6080'h0
})});
-
endpackage : otp_ctrl_part_pkg
diff --git a/hw/ip/otp_ctrl/rtl/otp_ctrl_part_unbuf.sv b/hw/ip/otp_ctrl/rtl/otp_ctrl_part_unbuf.sv
index 29e9cb6..c8fb704 100644
--- a/hw/ip/otp_ctrl/rtl/otp_ctrl_part_unbuf.sv
+++ b/hw/ip/otp_ctrl/rtl/otp_ctrl_part_unbuf.sv
@@ -10,6 +10,7 @@
module otp_ctrl_part_unbuf
import otp_ctrl_pkg::*;
import otp_ctrl_reg_pkg::*;
+ import otp_ctrl_part_pkg::*;
#(
// Partition information.
parameter part_info_t Info = part_info_t'(0)
diff --git a/hw/ip/otp_ctrl/rtl/otp_ctrl_pkg.sv b/hw/ip/otp_ctrl/rtl/otp_ctrl_pkg.sv
index 4c1b57e..5b5d4ed 100644
--- a/hw/ip/otp_ctrl/rtl/otp_ctrl_pkg.sv
+++ b/hw/ip/otp_ctrl/rtl/otp_ctrl_pkg.sv
@@ -85,55 +85,6 @@
DigestFinalize
} otp_scrmbl_cmd_e;
- parameter int NumScrmblKeys = 3;
- parameter int NumDigestSets = 5;
- parameter int ConstSelWidth = (NumScrmblKeys > NumDigestSets) ?
- vbits(NumScrmblKeys) :
- vbits(NumDigestSets);
-
- typedef enum logic [ConstSelWidth-1:0] {
- Secret0Key,
- Secret1Key,
- Secret2Key
- } key_sel_e;
-
- typedef enum logic [ConstSelWidth-1:0] {
- CnstyDigest,
- LcRawDigest,
- FlashDataKey,
- FlashAddrKey,
- SramDataKey
- } digest_sel_e;
-
- typedef enum logic [ConstSelWidth-1:0] {
- StandardMode,
- ChainedMode
- } digest_mode_e;
-
- /////////////////////////////////////
- // Typedefs for Partition Metadata //
- /////////////////////////////////////
-
- typedef enum logic [1:0] {
- Unbuffered,
- Buffered,
- LifeCycle
- } part_variant_e;
-
- typedef struct packed {
- part_variant_e variant;
- // Offset and size within the OTP array, in Bytes.
- logic [OtpByteAddrWidth-1:0] offset;
- logic [OtpByteAddrWidth-1:0] size;
- // Key index to use for scrambling.
- key_sel_e key_sel;
- // Attributes
- logic secret; // Whether the partition is secret (and hence scrambled)
- logic hw_digest; // Whether the partition has a hardware digest
- logic write_lock; // Whether the partition is write lockable (via digest)
- logic read_lock; // Whether the partition is read lockable (via digest)
- } part_info_t;
-
///////////////////////////////
// Typedefs for LC Interface //
///////////////////////////////
@@ -144,8 +95,6 @@
lc_ctrl_pkg::lc_state_e state;
lc_ctrl_pkg::lc_cnt_e count;
// These are all hash post-images
- lc_ctrl_pkg::lc_token_t all_zero_token;
- lc_ctrl_pkg::lc_token_t raw_unlock_token;
lc_ctrl_pkg::lc_token_t test_unlock_token;
lc_ctrl_pkg::lc_token_t test_exit_token;
lc_ctrl_pkg::lc_token_t rma_token;
@@ -158,8 +107,6 @@
error: 1'b0,
state: lc_ctrl_pkg::LcStRaw,
count: lc_ctrl_pkg::LcCntRaw,
- all_zero_token: '0,
- raw_unlock_token: '0,
test_unlock_token: '0,
test_exit_token: '0,
rma_token: '0,
@@ -302,35 +249,4 @@
localparam lfsr_perm_t RndCnstLfsrPermDefault =
240'h4235171482c225f79289b32181a0163a760355d3447063d16661e44c12a5;
-
- typedef logic [NumScrmblKeys-1:0][ScrmblKeyWidth-1:0] key_array_t;
- parameter key_array_t RndCnstKeyDefault = {
- 128'h047288e1a65c839dae610bbbdf8c4525,
- 128'h38fe59a71a91a65636573a6513784e3b,
- 128'h4f48dcc45ace0770e9135bda73e56344
- };
-
- // Note: digest set 0 is used for computing the partition digests. Constants at
- // higher indices are used to compute the scrambling keys.
- typedef logic [NumDigestSets-1:0][ScrmblKeyWidth-1:0] digest_const_array_t;
- parameter digest_const_array_t RndCnstDigestConstDefault = {
- 128'h9d40106e2dc2346ec96d61f0cc5295c7,
- 128'hafed2aa5c3284c01d71103edab1d8953,
- 128'h8a14fe0c08f8a3a190dd32c05f208474,
- 128'h9e6fac4ba15a3bce29d05a3e9e2d0846,
- 128'h3a0c6051392e00ef24073627319555b8
- };
-
- typedef logic [NumDigestSets-1:0][ScrmblBlockWidth-1:0] digest_iv_array_t;
- parameter digest_iv_array_t RndCnstDigestIVDefault = {
- 64'ha5af72c1b813aec4,
- 64'h5d7aacd1db316407,
- 64'hd0ec83b7fe6ae2ae,
- 64'hc2993a0ea64e312d,
- 64'h899aac2ab7d91479
- };
-
- parameter lc_ctrl_pkg::lc_token_t RndCnstRawUnlockTokenDefault =
- 128'hcbbd013ff15eba2f3065461eeb88463e;
-
endpackage : otp_ctrl_pkg
diff --git a/hw/ip/otp_ctrl/rtl/otp_ctrl_scrmbl.sv b/hw/ip/otp_ctrl/rtl/otp_ctrl_scrmbl.sv
index 07337b4..10c6ec7 100644
--- a/hw/ip/otp_ctrl/rtl/otp_ctrl_scrmbl.sv
+++ b/hw/ip/otp_ctrl/rtl/otp_ctrl_scrmbl.sv
@@ -68,12 +68,10 @@
// - http://www.lightweightcrypto.org/present/present_ches2007.pdf
//
-module otp_ctrl_scrmbl import otp_ctrl_pkg::*; #(
- // Compile time random constants, to be overriden by topgen.
- parameter key_array_t RndCnstKey = RndCnstKeyDefault,
- parameter digest_const_array_t RndCnstDigestConst = RndCnstDigestConstDefault,
- parameter digest_iv_array_t RndCnstDigestIV = RndCnstDigestIVDefault
-) (
+module otp_ctrl_scrmbl
+ import otp_ctrl_pkg::*;
+ import otp_ctrl_part_pkg::*;
+(
input clk_i,
input rst_ni,
// input data and command