Package: otp_ctrl_pkg

Description

Copyright lowRISC contributors.
Licensed under the Apache License, Version 2.0, see LICENSE for details.
SPDX-License-Identifier: Apache-2.0

Signals

Name Type Description
otp_ctrl_pkg endpackage

Constants

Name Type Value Description
OtpTestCtrlWidth int 32 ////////////////////// General Parameters // ////////////////////// Number of vendor-specific test CSR bits coming from and going to the life cycle TAP registers.
OtpTestStatusWidth int 32
OtpTestVectWidth int 8
EdnDataWidth int 64 Width of entropy input
NumPartWidth int vbits(NumPart)
SwWindowAddrWidth int vbits(NumSwCfgWindowWords)
LfsrWidth int 40 Background check timer LFSR width.
LfsrUsageThreshold int 16 The LFSR will be reseeded once LfsrUsageThreshold values have been drawn from it.
DaiCmdWidth int 3
OtpEnWidth int 8 Width of HW CFG Enable Fields
DeviceIdWidth int 256
ManufStateWidth int 256
OtpWidth int 16 //////////////////////////////////// Typedefs for OTP Macro Interface // //////////////////////////////////// OTP-macro specific
OtpAddrWidth int OtpByteAddrWidth - $clog2(OtpWidth/8)
OtpDepth int 2**OtpAddrWidth
OtpSizeWidth int 2 Allows to transfer up to 4 native OTP words at once.
OtpErrWidth int 3
OtpPwrSeqWidth int 2
OtpIfWidth int 2*OtpSizeWidthOtpWidth
OtpAddrShift int OtpByteAddrWidth - OtpAddrWidth Number of Byte address bits to cut off in order to get the native OTP word address.
ScrmblKeyWidth int 128 /////////////////////////////// Typedefs for OTP Scrambling // ///////////////////////////////
ScrmblBlockWidth int 64
NumPresentRounds int 31
ScrmblBlockHalfWords int ScrmblBlockWidth / OtpWidth
otp_lc_data_t otp_lc_data_t undefined Default for dangling connection. Note that we put the life cycle into TEST_UNLOCKED0 by default such that top levels without the OTP controller can still function.
FlashKeySeedWidth int 256 ////////////////////////////// Typedefs for Key Broadcast // //////////////////////////////
SramKeySeedWidth int 128
KeyMgrKeyWidth int 256
FlashKeyWidth int 128
SramKeyWidth int 128
SramNonceWidth int 128
OtbnKeyWidth int 128
OtbnNonceWidth int 64
otp_keymgr_key_t otp_keymgr_key_t undefined
flash_otp_key_rsp_t flash_otp_key_rsp_t undefined Default for dangling connection
sram_otp_key_rsp_t sram_otp_key_rsp_t undefined Default for dangling connection
RndCnstLfsrSeedDefault lfsr_seed_t 40'h453d28ea98
RndCnstLfsrPermDefault lfsr_perm_t 240'h4235171482c225f79289b32181a0163a760355d3447063d16661e44c12a5

Types

Name Type Description
access_e enum logic [7:0] {
Unlocked = 8'h5A,
Locked = 8'hA5 }
Redundantly encoded and complementary values are used to for signalling to the partition controller FSMs and the DAI whether a partition is locked or not. Any other value than "Unlocked" is interpreted as "Locked" in those FSMs.
part_access_t struct packed {
access_e read_lock;
access_e write_lock;
}
Partition access type
dai_cmd_e enum logic [DaiCmdWidth-1:0] {
DaiRead = 3'b001,
DaiWrite = 3'b010,
DaiDigest = 3'b100 }
otp_en_t logic [OtpEnWidth-1:0]
enable_e enum logic [7:0] {
Disabled = 8'h5A,
Enabled = 8'hA5 }
otp_device_id_t logic [DeviceIdWidth-1:0]
otp_manuf_state_t logic [ManufStateWidth-1:0]
otp_err_e enum logic [OtpErrWidth-1:0] {
NoError = 3'h0,
MacroError = 3'h1,
MacroEccCorrError = 3'h2,
MacroEccUncorrError = 3'h3,
MacroWriteBlankError = 3'h4,
AccessError = 3'h5,
CheckFailError = 3'h6,
FsmStateError = 3'h7 }
otp_scrmbl_cmd_e enum logic [2:0] {
Decrypt,
Encrypt,
LoadShadow,
Digest,
DigestInit,
DigestFinalize }
otp_lc_data_t struct packed {
logic valid;
logic error;
lc_ctrl_state_pkg::lc_state_e state;
lc_ctrl_state_pkg::lc_cnt_e count;
lc_ctrl_pkg::lc_tx_t secrets_valid;
lc_ctrl_pkg::lc_tx_t test_tokens_valid;
lc_ctrl_state_pkg::lc_token_t test_unlock_token;
lc_ctrl_state_pkg::lc_token_t test_exit_token;
lc_ctrl_pkg::lc_tx_t rma_token_valid;
lc_ctrl_state_pkg::lc_token_t rma_token;
}
///////////////////////////// Typedefs for LC Interface // ///////////////////////////// The tokens below are all hash post-images
lc_otp_program_req_t struct packed {
logic req;
lc_ctrl_state_pkg::lc_state_e state;
lc_ctrl_state_pkg::lc_cnt_e count;
}
lc_otp_program_rsp_t struct packed {
logic err;
logic ack;
}
lc_otp_token_req_t struct packed {
logic req;
lc_ctrl_state_pkg::lc_token_t token_input;
}
RAW unlock token hashing request.
lc_otp_token_rsp_t struct packed {
logic ack;
lc_ctrl_state_pkg::lc_token_t hashed_token;
}
lc_otp_vendor_test_req_t struct packed {
logic [OtpTestCtrlWidth-1:0] ctrl;
}
lc_otp_vendor_test_rsp_t struct packed {
logic [OtpTestStatusWidth-1:0] status;
}
sram_key_t logic [SramKeyWidth-1:0]
sram_nonce_t logic [SramNonceWidth-1:0]
otbn_key_t logic [OtbnKeyWidth-1:0]
otbn_nonce_t logic [OtbnNonceWidth-1:0]
otp_keymgr_key_t struct packed {
logic valid;
logic [KeyMgrKeyWidth-1:0] key_share0;
logic [KeyMgrKeyWidth-1:0] key_share1;
}
flash_otp_key_req_t struct packed {
logic data_req;
logic addr_req;
}
sram_otp_key_req_t struct packed {
logic req;
}
otbn_otp_key_req_t struct packed {
logic req;
}
flash_otp_key_rsp_t struct packed {
logic data_ack;
logic addr_ack;
logic [FlashKeyWidth-1:0] key;
logic [FlashKeyWidth-1:0] rand_key;
logic seed_valid;
}
sram_otp_key_rsp_t struct packed {
logic ack;
sram_key_t key;
sram_nonce_t nonce;
logic seed_valid;
}
otbn_otp_key_rsp_t struct packed {
logic ack;
otbn_key_t key;
otbn_nonce_t nonce;
logic seed_valid;
}
pwr_otp_init_req_t struct packed {
logic init;
}
////////////////////////////// Power/Reset Ctrl Interface // //////////////////////////////
pwr_otp_init_rsp_t struct packed {
logic done;
}
otp_pwr_state_t struct packed {
logic idle;
}
otp_ast_req_t struct packed {
logic [OtpPwrSeqWidth-1:0] pwr_seq;
}
///////////////// AST Interface // /////////////////
otp_ast_rsp_t struct packed {
logic [OtpPwrSeqWidth-1:0] pwr_seq_h;
}
lfsr_seed_t logic [LfsrWidth-1:0] ///////////////////////////////////////// Defaults for random netlist constants // ///////////////////////////////////////// These LFSR parameters have been generated with $ util/design/gen-lfsr-seed.py --width 40 --seed 4247488366
lfsr_perm_t logic [LfsrWidth-1:0][$clog2(LfsrWidth)-1:0]