[lc_ctrl] Update design files to account for package changes Signed-off-by: Michael Schaffner <msf@opentitan.org>
diff --git a/hw/ip/lc_ctrl/lc_ctrl_state_pkg.core b/hw/ip/lc_ctrl/lc_ctrl_state_pkg.core index c0f942a..8d44fd0 100644 --- a/hw/ip/lc_ctrl/lc_ctrl_state_pkg.core +++ b/hw/ip/lc_ctrl/lc_ctrl_state_pkg.core
@@ -6,6 +6,8 @@ description: "LC Controller State Encoding Package" filesets: files_rtl: + depend: + - lowrisc:prim:util files: - rtl/lc_ctrl_state_pkg.sv file_type: systemVerilogSource
diff --git a/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv b/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv index e47ec28..a3d9342 100644 --- a/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv +++ b/hw/ip/lc_ctrl/rtl/lc_ctrl_pkg.sv
@@ -8,95 +8,6 @@ import prim_util_pkg::vbits; import lc_ctrl_state_pkg::*; - ///////////////////////////////// - // General Typedefs and Params // - ///////////////////////////////// - - parameter int LcValueWidth = 16; - parameter int NumLcStateValues = 12; - parameter int LcStateWidth = NumLcStateValues * LcValueWidth; - parameter int NumLcCountValues = 16; - parameter int LcCountWidth = NumLcCountValues * LcValueWidth; - parameter int NumLcStates = 13; - parameter int DecLcStateWidth = vbits(NumLcStates); - parameter int DecLcCountWidth = vbits(NumLcCountValues+1); - 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] { - // Halfword idx : 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 - LcStRaw = '0, - LcStTestUnlocked0 = {A11, A10, A9, A8, A7, A6, A5, A4, A3, A2, A1, B0}, - LcStTestLocked0 = {A11, A10, A9, A8, A7, A6, A5, A4, A3, A2, B1, B0}, - LcStTestUnlocked1 = {A11, A10, A9, A8, A7, A6, A5, A4, A3, B2, B1, B0}, - LcStTestLocked1 = {A11, A10, A9, A8, A7, A6, A5, A4, B3, B2, B1, B0}, - LcStTestUnlocked2 = {A11, A10, A9, A8, A7, A6, A5, B4, B3, B2, B1, B0}, - LcStTestLocked2 = {A11, A10, A9, A8, A7, A6, B5, B4, B3, B2, B1, B0}, - LcStTestUnlocked3 = {A11, A10, A9, A8, A7, B6, B5, B4, B3, B2, B1, B0}, - LcStDev = {A11, A10, A9, A8, B7, B6, B5, B4, B3, B2, B1, B0}, - LcStProd = {A11, A10, A9, B8, A7, B6, B5, B4, B3, B2, B1, B0}, - LcStProdEnd = {A11, A10, B9, A8, A7, B6, B5, B4, B3, B2, B1, B0}, - LcStRma = {B11, B10, A9, B8, B7, B6, B5, B4, B3, B2, B1, B0}, - LcStScrap = {B11, B10, B9, B8, B7, B6, B5, B4, B3, B2, B1, B0} - } lc_state_e; - - // Decoded life cycle state, used to interface with CSRs and TAP. - typedef enum logic [DecLcStateWidth-1:0] { - DecLcStRaw = 4'h0, - DecLcStTestUnlocked0 = 4'h1, - DecLcStTestLocked0 = 4'h2, - DecLcStTestUnlocked1 = 4'h3, - DecLcStTestLocked1 = 4'h4, - DecLcStTestUnlocked2 = 4'h5, - DecLcStTestLocked2 = 4'h6, - DecLcStTestUnlocked3 = 4'h7, - DecLcStDev = 4'h8, - DecLcStProd = 4'h9, - DecLcStProdEnd = 4'hA, - DecLcStRma = 4'hB, - DecLcStScrap = 4'hC, - DecLcStPostTrans = 4'hD, - DecLcStEscalate = 4'hE, - DecLcStInvalid = 4'hF - } dec_lc_state_e; - - typedef enum logic [LcIdStateWidth-1:0] { - LcIdBlank = E0, - LcIdPersonalized = F0 - } lc_id_state_e; - - typedef enum logic [DecLcIdStateWidth-1:0] { - DecLcIdBlank = 2'd0, - DecLcIdPersonalized = 2'd1, - DecLcIdInvalid = 2'd2 - } dec_lc_id_state_e; - - typedef enum logic [LcCountWidth-1:0] { - LcCntRaw = '0, - LcCnt1 = {C15, C14, C13, C12, C11, C10, C9, C8, C7, C6, C5, C4, C3, C2, C1, D0}, - LcCnt2 = {C15, C14, C13, C12, C11, C10, C9, C8, C7, C6, C5, C4, C3, C2, D1, D0}, - LcCnt3 = {C15, C14, C13, C12, C11, C10, C9, C8, C7, C6, C5, C4, C3, D2, D1, D0}, - LcCnt4 = {C15, C14, C13, C12, C11, C10, C9, C8, C7, C6, C5, C4, D3, D2, D1, D0}, - LcCnt5 = {C15, C14, C13, C12, C11, C10, C9, C8, C7, C6, C5, D4, D3, D2, D1, D0}, - LcCnt6 = {C15, C14, C13, C12, C11, C10, C9, C8, C7, C6, D5, D4, D3, D2, D1, D0}, - LcCnt7 = {C15, C14, C13, C12, C11, C10, C9, C8, C7, D6, D5, D4, D3, D2, D1, D0}, - LcCnt8 = {C15, C14, C13, C12, C11, C10, C9, C8, D7, D6, D5, D4, D3, D2, D1, D0}, - LcCnt9 = {C15, C14, C13, C12, C11, C10, C9, D8, D7, D6, D5, D4, D3, D2, D1, D0}, - LcCnt10 = {C15, C14, C13, C12, C11, C10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0}, - LcCnt11 = {C15, C14, C13, C12, C11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0}, - LcCnt12 = {C15, C14, C13, C12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0}, - LcCnt13 = {C15, C14, C13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0}, - LcCnt14 = {C15, C14, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0}, - LcCnt15 = {C15, D14, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0}, - LcCnt16 = {D15, D14, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0} - } lc_cnt_e; - - typedef logic [DecLcCountWidth-1:0] dec_lc_cnt_t; - - /////////////////////////////////////// // Netlist Constants (Hashed Tokens) // ///////////////////////////////////////
diff --git a/hw/ip/lc_ctrl/rtl/lc_ctrl_signal_decode.sv b/hw/ip/lc_ctrl/rtl/lc_ctrl_signal_decode.sv index fc036d7..6087d6d 100644 --- a/hw/ip/lc_ctrl/rtl/lc_ctrl_signal_decode.sv +++ b/hw/ip/lc_ctrl/rtl/lc_ctrl_signal_decode.sv
@@ -6,6 +6,7 @@ module lc_ctrl_signal_decode import lc_ctrl_pkg::*; + import lc_ctrl_state_pkg::*; #( // Random netlist constants // SCRAP, RAW, TEST_LOCKED*, INVALID
diff --git a/hw/ip/lc_ctrl/rtl/lc_ctrl_state_decode.sv b/hw/ip/lc_ctrl/rtl/lc_ctrl_state_decode.sv index 4a0c965..e6a3ae2 100644 --- a/hw/ip/lc_ctrl/rtl/lc_ctrl_state_decode.sv +++ b/hw/ip/lc_ctrl/rtl/lc_ctrl_state_decode.sv
@@ -6,6 +6,7 @@ module lc_ctrl_state_decode import lc_ctrl_pkg::*; + import lc_ctrl_state_pkg::*; ( // Life cycle state vector. input logic lc_state_valid_i,
diff --git a/hw/ip/lc_ctrl/rtl/lc_ctrl_state_transition.sv b/hw/ip/lc_ctrl/rtl/lc_ctrl_state_transition.sv index a293171..b31773f 100644 --- a/hw/ip/lc_ctrl/rtl/lc_ctrl_state_transition.sv +++ b/hw/ip/lc_ctrl/rtl/lc_ctrl_state_transition.sv
@@ -7,6 +7,7 @@ module lc_ctrl_state_transition import lc_ctrl_pkg::*; + import lc_ctrl_state_pkg::*; ( // Life cycle state vector. input lc_state_e lc_state_i,
diff --git a/hw/ip/otp_ctrl/rtl/otp_ctrl.sv b/hw/ip/otp_ctrl/rtl/otp_ctrl.sv index f8a3c4e..fd9823f 100644 --- a/hw/ip/otp_ctrl/rtl/otp_ctrl.sv +++ b/hw/ip/otp_ctrl/rtl/otp_ctrl.sv
@@ -1008,8 +1008,8 @@ end else if (PartInfo[k].variant == LifeCycle) begin : gen_lifecycle otp_ctrl_part_buf #( .Info(PartInfo[k]), - // By default all counter words are set and the life cycle state is scrapped. - .DataDefault({lc_ctrl_pkg::LcCnt16, lc_ctrl_pkg::LcStScrap}) + // TODO: set to a random netlist constant + .DataDefault('0) ) u_part_buf ( .clk_i, .rst_ni, @@ -1116,14 +1116,14 @@ // The device is personalized if the root key has been provisioned and locked assign otp_lc_data_o.id_state = (part_digest[Secret2Idx] != '0) ? - lc_ctrl_pkg::LcIdPersonalized : - lc_ctrl_pkg::LcIdBlank; + lc_ctrl_state_pkg::LcIdPersonalized : + lc_ctrl_state_pkg::LcIdBlank; // Lifecycle state - assign otp_lc_data_o.state = lc_ctrl_pkg::lc_state_e'(part_buf_data[LcStateOffset +: - LcStateSize]); - assign otp_lc_data_o.count = lc_ctrl_pkg::lc_cnt_e'(part_buf_data[LcTransitionCntOffset +: - LcTransitionCntSize]); + assign otp_lc_data_o.state = lc_ctrl_state_pkg::lc_state_e'(part_buf_data[LcStateOffset +: + LcStateSize]); + assign otp_lc_data_o.count = lc_ctrl_state_pkg::lc_cnt_e'(part_buf_data[LcTransitionCntOffset +: + LcTransitionCntSize]); // Assert life cycle state valid signal only when all partitions have initialized. assign otp_lc_data_o.valid = &part_init_done; @@ -1146,11 +1146,11 @@ `ASSERT_INIT(FlashAddrKeySeedSize_A, FlashKeySeedWidth == FlashAddrKeySeedSize * 8) `ASSERT_INIT(SramDataKeySeedSize_A, SramKeySeedWidth == SramDataKeySeedSize * 8) - `ASSERT_INIT(RmaTokenSize_A, lc_ctrl_pkg::LcTokenWidth == RmaTokenSize * 8) - `ASSERT_INIT(TestUnlockTokenSize_A, lc_ctrl_pkg::LcTokenWidth == TestUnlockTokenSize * 8) - `ASSERT_INIT(TestExitTokenSize_A, lc_ctrl_pkg::LcTokenWidth == TestExitTokenSize * 8) - `ASSERT_INIT(LcStateSize_A, lc_ctrl_pkg::LcStateWidth == LcStateSize * 8) - `ASSERT_INIT(LcTransitionCntSize_A, lc_ctrl_pkg::LcCountWidth == LcTransitionCntSize * 8) + `ASSERT_INIT(RmaTokenSize_A, lc_ctrl_state_pkg::LcTokenWidth == RmaTokenSize * 8) + `ASSERT_INIT(TestUnlockTokenSize_A, lc_ctrl_state_pkg::LcTokenWidth == TestUnlockTokenSize * 8) + `ASSERT_INIT(TestExitTokenSize_A, lc_ctrl_state_pkg::LcTokenWidth == TestExitTokenSize * 8) + `ASSERT_INIT(LcStateSize_A, lc_ctrl_state_pkg::LcStateWidth == LcStateSize * 8) + `ASSERT_INIT(LcTransitionCntSize_A, lc_ctrl_state_pkg::LcCountWidth == LcTransitionCntSize * 8) `ASSERT_KNOWN(OtpAstPwrSeqKnown_A, otp_ast_pwr_seq_o) `ASSERT_KNOWN(TlOutKnown_A, tl_o)
diff --git a/hw/ip/otp_ctrl/rtl/otp_ctrl_lci.sv b/hw/ip/otp_ctrl/rtl/otp_ctrl_lci.sv index b10794e..98a8177 100644 --- a/hw/ip/otp_ctrl/rtl/otp_ctrl_lci.sv +++ b/hw/ip/otp_ctrl/rtl/otp_ctrl_lci.sv
@@ -27,8 +27,8 @@ // Note that a transition request will fail if the request attempts to // clear already programmed bits within OTP. input lc_req_i, - input lc_ctrl_pkg::lc_state_e lc_state_i, - input lc_ctrl_pkg::lc_cnt_e lc_count_i, + input lc_ctrl_state_pkg::lc_state_e lc_state_i, + input lc_ctrl_state_pkg::lc_cnt_e lc_count_i, output logic lc_ack_o, output logic lc_err_o, // Output error state of partition, to be consumed by OTP error/alert logic. @@ -58,7 +58,7 @@ localparam int CntWidth = vbits(NumLcOtpWords); // This is required, since each native OTP word can only be programmed once. - `ASSERT_INIT(LcValueMustBeWiderThanNativeOtpWidth_A, lc_ctrl_pkg::LcValueWidth >= OtpWidth) + `ASSERT_INIT(LcValueMustBeWiderThanNativeOtpWidth_A, lc_ctrl_state_pkg::LcValueWidth >= OtpWidth) //////////////////// // Controller FSM //
diff --git a/hw/ip/otp_ctrl/rtl/otp_ctrl_pkg.sv b/hw/ip/otp_ctrl/rtl/otp_ctrl_pkg.sv index 5b5d4ed..3408c84 100644 --- a/hw/ip/otp_ctrl/rtl/otp_ctrl_pkg.sv +++ b/hw/ip/otp_ctrl/rtl/otp_ctrl_pkg.sv
@@ -90,33 +90,33 @@ /////////////////////////////// typedef struct packed { - logic valid; - logic error; - lc_ctrl_pkg::lc_state_e state; - lc_ctrl_pkg::lc_cnt_e count; + logic valid; + logic error; + lc_ctrl_state_pkg::lc_state_e state; + lc_ctrl_state_pkg::lc_cnt_e count; // These are all hash post-images - 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; - lc_ctrl_pkg::lc_id_state_e id_state; + lc_ctrl_state_pkg::lc_token_t test_unlock_token; + lc_ctrl_state_pkg::lc_token_t test_exit_token; + lc_ctrl_state_pkg::lc_token_t rma_token; + lc_ctrl_state_pkg::lc_id_state_e id_state; } otp_lc_data_t; // Default for dangling connection parameter otp_lc_data_t OTP_LC_DATA_DEFAULT = '{ valid: 1'b1, error: 1'b0, - state: lc_ctrl_pkg::LcStRaw, - count: lc_ctrl_pkg::LcCntRaw, + state: lc_ctrl_state_pkg::LcStRaw, + count: lc_ctrl_state_pkg::LcCntRaw, test_unlock_token: '0, test_exit_token: '0, rma_token: '0, - id_state: lc_ctrl_pkg::LcIdBlank + id_state: lc_ctrl_state_pkg::LcIdBlank }; typedef struct packed { logic req; - lc_ctrl_pkg::lc_state_e state; - lc_ctrl_pkg::lc_cnt_e count; + lc_ctrl_state_pkg::lc_state_e state; + lc_ctrl_state_pkg::lc_cnt_e count; } lc_otp_program_req_t; typedef struct packed { @@ -127,12 +127,12 @@ // RAW unlock token hashing request. typedef struct packed { logic req; - lc_ctrl_pkg::lc_token_t token_input; + lc_ctrl_state_pkg::lc_token_t token_input; } lc_otp_token_req_t; typedef struct packed { logic ack; - lc_ctrl_pkg::lc_token_t hashed_token; + lc_ctrl_state_pkg::lc_token_t hashed_token; } lc_otp_token_rsp_t; ////////////////////////////////