Package: kmac_env_pkg

Description

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

Constants

Name Type Value Description
KMAC_NUM_SHARES int 2 parameters max number of shares in design
KMAC_NUM_KEYS_PER_SHARE int 16
KMAC_NUM_PREFIX_WORDS int 11
TL_AW bit [TL_AW-1:0] 32'h400 share1 of the 1600-bit KMAC state memory
TL_AW bit [TL_AW-1:0] 32'h4C7
TL_AW bit [TL_AW-1:0] 32'h500 share2 of the 1600-bit KMAC state memory
TL_AW bit [TL_AW-1:0] 32'h5C7
TL_AW bit [TL_AW-1:0] 32'h800 base and end addresses of the KAMC message FIFO.
TL_AW bit [TL_AW-1:0] 32'hFFC
KMAC_FIFO_DEPTH int kmac_pkg::MsgFifoDepth width and depth of the msgfifo
KMAC_FIFO_WIDTH int kmac_pkg::MsgWidth
KMAC_FIFO_WORDS_PER_ENTRY int KMAC_FIFO_WIDTH / TL_DW
KMAC_FIFO_BYTES_PER_ENTRY int KMAC_FIFO_WIDTH / 8
KMAC_FIFO_NUM_WORDS int KMAC_FIFO_DEPTH * KMAC_FIFO_WORDS_PER_ENTRY
KMAC_FIFO_NUM_BYTES int KMAC_FIFO_NUM_WORDS * 4
MAX_ENCODE_WIDTH int 2040 Represents the max bit-width of some value to be encoded with either right_encode() or left_encode().
uint uint 1 alerts
LIST_OF_ALERTS string {
"fatal_fault"}
W int sha3_pkg::StateW / 25 /////////////////////////// Timing Model Parameters // /////////////////////////// Will include information related to both the keccak datapath and the entropy system, as both directly relate to how many cycles a given hash operation will take Existing parameters:
sha3_pkg::MsgWidth = 64 -> width of internal datapath
sha3_pkg::StateW = 1600 -> represents width of Keccak state keccak datapath (lane) size
L int $clog2(W) log_2(W)
KECCAK_NUM_ROUNDS int 12 + 2 * L number of rounds performed by keccak logic
ENTROPY_STORAGE_WIDTH int 320
ENTROPY_LFSR_WIDTH int 64
CYCLES_TO_FILL_ENTROPY int ENTROPY_STORAGE_WIDTH / ENTROPY_LFSR_WIDTH After seeding lfsr, internal entropy_storage is filled up in 5 cycles, ENTROPY_LFSR_WIDTH bits per cycles
ENTROPY_FULL_EXPANSION_CYCLES int CYCLES_TO_FILL_ENTROPY + 2 7 cycles total: 5 cycles + 2 cycles (latch/consume entropy)
ENTROPY_FAST_PROCESSING_CYCLES int 3 3 cycles total: 1 cycle, entropy is reused + 2 cycles (latch/consume)

Types

Name Type Description
kmac_intr_e enum int {
KmacDone = 0,
KmacFifoEmpty = 1,
KmacErr = 2,
KmacNumIntrs = 3 }
interrupt types
kmac_cfg_e enum int {
KmacEn = 0,
KmacStrengthLSB = 1,
KmacStrengthMSB = 3,
KmacModeLSB = 4,
KmacModeMSB = 5,
KmacMsgEndian = 8,
KmacStateEndian = 9,
KmacSideload = 12,
KmacEntropyModeLSB = 16,
KmacEntropyModeMSB = 17,
KmacFastEntropy = 19,
KmacEntropyReady = 24,
KmacErrProcessed = 25 }
CFG csr bit positions
kmac_status_e enum int {
KmacStatusSha3Idle = 0,
KmacStatusSha3Absorb = 1,
KmacStatusSha3Squeeze = 2,
KmacStatusFifoDepthLSB = 8,
KmacStatusFifoDepthMSB = 12,
KmacStatusFifoEmpty = 14,
KmacStatusFifoFull = 15 }
STATUS csr bit positions
kmac_app_e enum int {
AppKeymgr,
AppLc,
AppRom }
kmac_app_st_e enum bit [9:0] {
StIdle = 10'b1011011010,
StAppCfg = 10'b0001010000,
StAppMsg = 10'b0001011111,
StAppOutLen = 10'b1011001111,
StAppProcess = 10'b1000100110,
StAppWait = 10'b0010010110,
StSw = 10'b0111111111,
StKeyMgrErrKeyNotValid = 10'b1001110100,
StError = 10'b1101011101 }
state values of the App FSM
kmac_err_st_e enum bit [2:0] {
ErrStIdle,
ErrStMsgFeed,
ErrStProcessing,
ErrStAbsorbed,
ErrStSqueezing }
states of the error FSM
idle_vif virtual pins_if#(1)
sideload_vif virtual kmac_sideload_if

Functions

Description
Helper functions that returns the KMAC key size in bytes/words/blocks