[kmac] Add Entropy Control register
Adding configurable knobs for the entropy generation logic in KMAC. SW
can configure the refresh period. Also it manually reseeds through the
register interface.
Signed-off-by: Eunchan Kim <eunchan@opentitan.org>
diff --git a/hw/ip/kmac/data/kmac.hjson b/hw/ip/kmac/data/kmac.hjson
index e870d56..866a7c9 100644
--- a/hw/ip/kmac/data/kmac.hjson
+++ b/hw/ip/kmac/data/kmac.hjson
@@ -70,12 +70,12 @@
act: "rsp"
package: "keymgr_pkg"
}
- { struct: "csrng"
+ { struct: "edn"
type: "req_rsp"
name: "entropy"
act: "req"
width: "1"
- package: "csrng_pkg"
+ package: "edn_pkg"
}
{ name: "idle",
type: "uni",
@@ -315,6 +315,61 @@
}
]
} // R: STATUS
+ { name: "ENTROPY_PERIOD"
+ desc: '''Entropy Refresh Period.
+
+ This register determines the refresh period. The value is the number of
+ clock cycles. In every entropy period, the entropy generation logic in
+ KMAC requests new entropy to EDN and feed the value into LFSR seed.
+
+ If 0, the entropy generation logic does not refresh its seed. The
+ software manually updates the seed by writing into "ENTROPY_SEED"
+ registers.
+ '''
+ swaccess: "rw"
+ hwaccess: "hro"
+ regwen: "CFG_REGWEN"
+ fields: [
+ { bits: "31:0"
+ name: "period"
+ desc: "entropy period in clock cycles"
+ }
+ ]
+ } // R: ENTROPY_PERIOD
+ { name: "ENTROPY_SEED_LOWER"
+ desc: '''Entropy Seed [31:0].
+
+ Everytime when the software writes into this register, LFSR is reseeded
+ with the value of {ENTROPY_SEED_UPPER, ENTROPY_SEED_LOWER}.
+ '''
+ swaccess: "rw"
+ hwaccess: "hro"
+ hwqe: "true"
+ regwen: "CFG_REGWEN"
+ fields: [
+ { bits: "31:0"
+ name: "seed"
+ desc: "Seed [31:0]"
+ }
+ ]
+ } // R: ENTROPY_SEED_LOWER
+ { name: "ENTROPY_SEED_UPPER"
+ desc: '''Entropy Seed [63:32].
+
+ Everytime when the software writes into this register, LFSR is reseeded
+ with the value of {ENTROPY_SEED_UPPER, ENTROPY_SEED_LOWER}.
+ '''
+ swaccess: "rw"
+ hwaccess: "hro"
+ hwqe: "true"
+ regwen: "CFG_REGWEN"
+ fields: [
+ { bits: "31:0"
+ name: "seed"
+ desc: "Seed [63:32]"
+ }
+ ]
+ } // R: ENTROPY_SEED_UPPER
{ multireg: {
name: "KEY_SHARE0"
desc: '''KMAC Secret Key