[reggen] Define classes to represent parameters in a block

This is supposed to represent the thing at obj['params_list']. The
Params class is essentially just a list of the parameters. These
parameters are now split into 3 classes, inheriting from BaseParam.

LocalParam and Parameter are for "normal" parameters and localparams.
RandParameter is used for random netlist constants.

This change has a small impact on topgen.py: the code that pulls
parameters up to the top-level actually gets a bit cleaner, but it now
needs to convert back to dict explicitly. That shuffling, in turn,
slightly changes the ordering of fields in (the checked-in)
top_earlgrey.gen.hjson.

Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
diff --git a/hw/top_earlgrey/data/autogen/top_earlgrey.gen.hjson b/hw/top_earlgrey/data/autogen/top_earlgrey.gen.hjson
index 184eb20..723005d 100644
--- a/hw/top_earlgrey/data/autogen/top_earlgrey.gen.hjson
+++ b/hw/top_earlgrey/data/autogen/top_earlgrey.gen.hjson
@@ -2875,33 +2875,26 @@
           type: ""
           default: '''""'''
           expose: "true"
-          local: "false"
-          randcount: "0"
-          randtype: none
           name_top: OtpCtrlMemInitFile
         }
         {
           name: RndCnstLfsrSeed
           desc: Compile-time random bits for initial LFSR seed
           type: otp_ctrl_pkg::lfsr_seed_t
-          randcount: "40"
+          randcount: 40
           randtype: data
-          local: "false"
-          default: 0xf45def7861
-          expose: "false"
           name_top: RndCnstOtpCtrlLfsrSeed
+          default: 0xf45def7861
           randwidth: 40
         }
         {
           name: RndCnstLfsrPerm
           desc: Compile-time random permutation for LFSR output
           type: otp_ctrl_pkg::lfsr_perm_t
-          randcount: "40"
+          randcount: 40
           randtype: perm
-          local: "false"
-          default: 0x5d294061e29a7c404f4593035a19097666e37072064153623855022d39e0
-          expose: "false"
           name_top: RndCnstOtpCtrlLfsrPerm
+          default: 0x5d294061e29a7c404f4593035a19097666e37072064153623855022d39e0
           randwidth: 240
         }
       ]
@@ -3224,36 +3217,30 @@
           name: RndCnstLcKeymgrDivInvalid
           desc: Compile-time random bits for lc state group diversification value
           type: lc_ctrl_pkg::lc_keymgr_div_t
-          randcount: "64"
+          randcount: 64
           randtype: data
-          local: "false"
-          default: 0xf4c3471c5def7861
-          expose: "false"
           name_top: RndCnstLcCtrlLcKeymgrDivInvalid
+          default: 0xf4c3471c5def7861
           randwidth: 64
         }
         {
           name: RndCnstLcKeymgrDivTestDevRma
           desc: Compile-time random bits for lc state group diversification value
           type: lc_ctrl_pkg::lc_keymgr_div_t
-          randcount: "64"
+          randcount: 64
           randtype: data
-          local: "false"
-          default: 0x83d0550b80e84eb1
-          expose: "false"
           name_top: RndCnstLcCtrlLcKeymgrDivTestDevRma
+          default: 0x83d0550b80e84eb1
           randwidth: 64
         }
         {
           name: RndCnstLcKeymgrDivProduction
           desc: Compile-time random bits for lc state group diversification value
           type: lc_ctrl_pkg::lc_keymgr_div_t
-          randcount: "64"
+          randcount: 64
           randtype: data
-          local: "false"
-          default: 0x2d73930d4cac3785
-          expose: "false"
           name_top: RndCnstLcCtrlLcKeymgrDivProduction
+          default: 0x2d73930d4cac3785
           randwidth: 64
         }
       ]
@@ -3715,24 +3702,20 @@
           name: RndCnstLfsrSeed
           desc: Compile-time random bits for initial LFSR seed
           type: alert_pkg::lfsr_seed_t
-          randcount: "32"
+          randcount: 32
           randtype: data
-          local: "false"
-          default: 0x5def7861
-          expose: "false"
           name_top: RndCnstAlertHandlerLfsrSeed
+          default: 0x5def7861
           randwidth: 32
         }
         {
           name: RndCnstLfsrPerm
           desc: Compile-time random permutation for LFSR output
           type: alert_pkg::lfsr_perm_t
-          randcount: "32"
+          randcount: 32
           randtype: perm
-          local: "false"
-          default: 0x5f00c4cafd73fc4ac479a61068375f38956d84b3
-          expose: "false"
           name_top: RndCnstAlertHandlerLfsrPerm
+          default: 0x5f00c4cafd73fc4ac479a61068375f38956d84b3
           randwidth: 160
         }
       ]
@@ -5040,35 +5023,28 @@
           name: RndCnstSramKey
           desc: Compile-time random reset value for SRAM scrambling key.
           type: otp_ctrl_pkg::sram_key_t
-          randcount: "128"
+          randcount: 128
           randtype: data
-          local: "false"
-          default: 0x83d0550b80e84eb1f4c3471c5def7861
-          expose: "false"
           name_top: RndCnstSramCtrlRetAonSramKey
+          default: 0x83d0550b80e84eb1f4c3471c5def7861
           randwidth: 128
         }
         {
           name: RndCnstSramNonce
           desc: Compile-time random reset value for SRAM scrambling nonce.
           type: otp_ctrl_pkg::sram_nonce_t
-          randcount: "64"
+          randcount: 64
           randtype: data
-          local: "false"
-          default: 0x2d73930d4cac3785
-          expose: "false"
           name_top: RndCnstSramCtrlRetAonSramNonce
+          default: 0x2d73930d4cac3785
           randwidth: 64
         }
         {
           name: InstrExec
           desc: Support execution from SRAM
           type: bit
-          local: "false"
-          expose: "true"
           default: "1"
-          randcount: "0"
-          randtype: none
+          expose: "true"
           name_top: SramCtrlRetAonInstrExec
         }
       ]
@@ -5268,48 +5244,40 @@
           name: RndCnstAddrKey
           desc: Compile-time random bits for default address key
           type: flash_ctrl_pkg::flash_key_t
-          randcount: "128"
+          randcount: 128
           randtype: data
-          local: "false"
-          default: 0x83d0550b80e84eb1f4c3471c5def7861
-          expose: "false"
           name_top: RndCnstFlashCtrlAddrKey
+          default: 0x83d0550b80e84eb1f4c3471c5def7861
           randwidth: 128
         }
         {
           name: RndCnstDataKey
           desc: Compile-time random bits for default data key
           type: flash_ctrl_pkg::flash_key_t
-          randcount: "128"
+          randcount: 128
           randtype: data
-          local: "false"
-          default: 0xfabd19450b238d4c2d73930d4cac3785
-          expose: "false"
           name_top: RndCnstFlashCtrlDataKey
+          default: 0xfabd19450b238d4c2d73930d4cac3785
           randwidth: 128
         }
         {
           name: RndCnstLfsrSeed
           desc: Compile-time random bits for initial LFSR seed
           type: flash_ctrl_pkg::lfsr_seed_t
-          randcount: "32"
+          randcount: 32
           randtype: data
-          local: "false"
-          default: 0xd89f9dfc
-          expose: "false"
           name_top: RndCnstFlashCtrlLfsrSeed
+          default: 0xd89f9dfc
           randwidth: 32
         }
         {
           name: RndCnstLfsrPerm
           desc: Compile-time random permutation for LFSR output
           type: flash_ctrl_pkg::lfsr_perm_t
-          randcount: "32"
+          randcount: 32
           randtype: perm
-          local: "false"
-          default: 0x26ff203d990d87c5e8a98bafec7506855aa99c54
-          expose: "false"
           name_top: RndCnstFlashCtrlLfsrPerm
+          default: 0x26ff203d990d87c5e8a98bafec7506855aa99c54
           randwidth: 160
         }
       ]
@@ -5673,145 +5641,116 @@
       [
         {
           name: AES192Enable
+          desc: Disable (0) or enable (1) support for 192-bit key lengths (AES-192).
           type: bit
           default: 1'b1
-          desc: Disable (0) or enable (1) support for 192-bit key lengths (AES-192).
-          local: "false"
           expose: "false"
-          randcount: "0"
-          randtype: none
           name_top: AesAES192Enable
         }
         {
           name: Masking
-          type: bit
-          default: 1'b1
           desc:
             '''
             Disable (0) or enable (1) first-order masking of the AES cipher core.
             Masking requires the use of a masked S-Box, see SBoxImpl parameter.
             '''
-          local: "false"
+          type: bit
+          default: 1'b1
           expose: "true"
-          randcount: "0"
-          randtype: none
           name_top: AesMasking
         }
         {
           name: SBoxImpl
+          desc: Selection of the S-Box implementation. See aes_pkg.sv.
           type: aes_pkg::sbox_impl_e
           default: aes_pkg::SBoxImplDom
-          desc: Selection of the S-Box implementation. See aes_pkg.sv.
-          local: "false"
           expose: "true"
-          randcount: "0"
-          randtype: none
           name_top: AesSBoxImpl
         }
         {
           name: SecStartTriggerDelay
-          type: int unsigned
-          default: "0"
           desc:
             '''
             Manual start trigger delay, useful for SCA measurements.
             A value of e.g. 40 allows the processor to go into sleep before AES starts operation.
             '''
-          local: "false"
+          type: int unsigned
+          default: "0"
           expose: "true"
-          randcount: "0"
-          randtype: none
           name_top: SecAesStartTriggerDelay
         }
         {
           name: SecAllowForcingMasks
-          type: bit
-          default: 1'b0
           desc:
             '''
             Forbid (0) or allow (1) forcing the mask to zero via FORCE_ZERO_MASK bit in the Control Register.
             Useful for SCA measurements.
             Meaningful only if masking is enabled.
             '''
-          local: "false"
+          type: bit
+          default: 1'b0
           expose: "true"
-          randcount: "0"
-          randtype: none
           name_top: SecAesAllowForcingMasks
         }
         {
           name: SecSkipPRNGReseeding
-          type: bit
-          default: 1'b0
           desc:
             '''
             Perform (0) or skip (1) PRNG reseeding requests, useful for SCA measurements only.
             The current SCA setup doesn't provide sufficient resources to implement the infrastructure required for PRNG reseeding (CSRNG, EDN).
             To enable SCA resistance evaluations, we need to skip reseeding requests on the SCA platform.
             '''
-          local: "false"
+          type: bit
+          default: 1'b0
           expose: "true"
-          randcount: "0"
-          randtype: none
           name_top: SecAesSkipPRNGReseeding
         }
         {
           name: AlertAsyncOn
+          desc: One bit per alert specifying whether the corresponding sender in the AES module and the receiver in the alert handler are in the same clock domain (0) or whether there is an asynchronous boundary in between (1).
           type: logic [aes_reg_pkg::NumAlerts-1:0]
           default: "{aes_reg_pkg::NumAlerts{1'b1}}"
-          desc: One bit per alert specifying whether the corresponding sender in the AES module and the receiver in the alert handler are in the same clock domain (0) or whether there is an asynchronous boundary in between (1).
-          local: "false"
           expose: "false"
-          randcount: "0"
-          randtype: none
           name_top: AesAlertAsyncOn
         }
         {
           name: RndCnstClearingLfsrSeed
-          type: aes_pkg::clearing_lfsr_seed_t
           desc: Default seed of the PRNG used for register clearing.
-          randcount: "64"
+          type: aes_pkg::clearing_lfsr_seed_t
+          randcount: 64
           randtype: data
-          local: "false"
-          default: 0xf4c3471c5def7861
-          expose: "false"
           name_top: RndCnstAesClearingLfsrSeed
+          default: 0xf4c3471c5def7861
           randwidth: 64
         }
         {
           name: RndCnstClearingLfsrPerm
-          type: aes_pkg::clearing_lfsr_perm_t
           desc: Permutation applied to the LFSR of the PRNG used for clearing.
-          randcount: "64"
+          type: aes_pkg::clearing_lfsr_perm_t
+          randcount: 64
           randtype: perm
-          local: "false"
-          default: 0x26ac29e186c1f4dc6f959d6ed08dc044a0f3f1519e8dca131275df1e48bbf964ac772e613d0320adaebf38552dd822e6
-          expose: "false"
           name_top: RndCnstAesClearingLfsrPerm
+          default: 0x26ac29e186c1f4dc6f959d6ed08dc044a0f3f1519e8dca131275df1e48bbf964ac772e613d0320adaebf38552dd822e6
           randwidth: 384
         }
         {
           name: RndCnstMaskingLfsrSeed
-          type: aes_pkg::masking_lfsr_seed_t
           desc: Default seed of the PRNG used for masking.
-          randcount: "160"
+          type: aes_pkg::masking_lfsr_seed_t
+          randcount: 160
           randtype: data
-          local: "false"
-          default: 0x19e5a91389b9fe0d3b818e46ce7d846469a3b8e3
-          expose: "false"
           name_top: RndCnstAesMaskingLfsrSeed
+          default: 0x19e5a91389b9fe0d3b818e46ce7d846469a3b8e3
           randwidth: 160
         }
         {
           name: RndCnstMskgChunkLfsrPerm
-          type: aes_pkg::mskg_chunk_lfsr_perm_t
           desc: Permutation applied to the LFSR chunks of the PRNG used for masking.
-          randcount: "32"
+          type: aes_pkg::mskg_chunk_lfsr_perm_t
+          randcount: 32
           randtype: perm
-          local: "false"
-          default: 0x23f6ba7ea92aa0e8e3b900f826cee835bc1648fa
-          expose: "false"
           name_top: RndCnstAesMskgChunkLfsrPerm
+          default: 0x23f6ba7ea92aa0e8e3b900f826cee835bc1648fa
           randwidth: 160
         }
       ]
@@ -6031,24 +5970,19 @@
       [
         {
           name: EnMasking
-          type: bit
-          default: "0"
           desc:
             '''
             Disable(0) or enable(1) first-order masking of Keccak round.
 
             If masking is enabled, ReuseShare parameter will impact the design.
             '''
-          local: "false"
+          type: bit
+          default: "0"
           expose: "true"
-          randcount: "0"
-          randtype: none
           name_top: KmacEnMasking
         }
         {
           name: ReuseShare
-          type: int
-          default: "0"
           desc:
             '''
             If enabled (1), the internal Keccak round logic will re-use the
@@ -6058,10 +5992,9 @@
 
             This feature is not implemented yet.
             '''
-          local: "false"
+          type: int
+          default: "0"
           expose: "true"
-          randcount: "0"
-          randtype: none
           name_top: KmacReuseShare
         }
       ]
@@ -6207,156 +6140,130 @@
           name: RndCnstLfsrSeed
           desc: Compile-time random bits for initial LFSR seed
           type: keymgr_pkg::lfsr_seed_t
-          randcount: "64"
+          randcount: 64
           randtype: data
-          local: "false"
-          default: 0xf4c3471c5def7861
-          expose: "false"
           name_top: RndCnstKeymgrLfsrSeed
+          default: 0xf4c3471c5def7861
           randwidth: 64
         }
         {
           name: RndCnstLfsrPerm
           desc: Compile-time random permutation for LFSR output
           type: keymgr_pkg::lfsr_perm_t
-          randcount: "64"
+          randcount: 64
           randtype: perm
-          local: "false"
-          default: 0x26ac29e186c1f4dc6f959d6ed08dc044a0f3f1519e8dca131275df1e48bbf964ac772e613d0320adaebf38552dd822e6
-          expose: "false"
           name_top: RndCnstKeymgrLfsrPerm
+          default: 0x26ac29e186c1f4dc6f959d6ed08dc044a0f3f1519e8dca131275df1e48bbf964ac772e613d0320adaebf38552dd822e6
           randwidth: 384
         }
         {
           name: RndCnstRandPerm
           desc: Compile-time random permutation for entropy used in share overriding
           type: keymgr_pkg::rand_perm_t
-          randcount: "32"
+          randcount: 32
           randtype: perm
-          local: "false"
-          default: 0x86cb85d79423d404d9d717e683782c975a389f3a
-          expose: "false"
           name_top: RndCnstKeymgrRandPerm
+          default: 0x86cb85d79423d404d9d717e683782c975a389f3a
           randwidth: 160
         }
         {
           name: RndCnstRevisionSeed
           desc: Compile-time random bits for revision seed
           type: keymgr_pkg::seed_t
-          randcount: "256"
+          randcount: 256
           randtype: data
-          local: "false"
-          default: 0xa917f063c414964e46ce0fe8ddb271067884ebcc4f232c841702ef7147e71b5c
-          expose: "false"
           name_top: RndCnstKeymgrRevisionSeed
+          default: 0xa917f063c414964e46ce0fe8ddb271067884ebcc4f232c841702ef7147e71b5c
           randwidth: 256
         }
         {
           name: RndCnstCreatorIdentitySeed
           desc: Compile-time random bits for creator identity seed
           type: keymgr_pkg::seed_t
-          randcount: "256"
+          randcount: 256
           randtype: data
-          local: "false"
-          default: 0x84b1a5a63af5fa0aaf8c6a6b90f868a3f2590e4a1004f9cf620d8c56137d9287
-          expose: "false"
           name_top: RndCnstKeymgrCreatorIdentitySeed
+          default: 0x84b1a5a63af5fa0aaf8c6a6b90f868a3f2590e4a1004f9cf620d8c56137d9287
           randwidth: 256
         }
         {
           name: RndCnstOwnerIntIdentitySeed
           desc: Compile-time random bits for owner intermediate identity seed
           type: keymgr_pkg::seed_t
-          randcount: "256"
+          randcount: 256
           randtype: data
-          local: "false"
-          default: 0x32949cc3635d1f47c8f05affc85f7d889ecd94b67eb674bbdf38d62d3622493
-          expose: "false"
           name_top: RndCnstKeymgrOwnerIntIdentitySeed
+          default: 0x32949cc3635d1f47c8f05affc85f7d889ecd94b67eb674bbdf38d62d3622493
           randwidth: 256
         }
         {
           name: RndCnstOwnerIdentitySeed
           desc: Compile-time random bits for owner identity seed
           type: keymgr_pkg::seed_t
-          randcount: "256"
+          randcount: 256
           randtype: data
-          local: "false"
-          default: 0xeec5e43d4b16446726a27b8f0b30ad5048bae844c87b69111a24d5e4442bcfb7
-          expose: "false"
           name_top: RndCnstKeymgrOwnerIdentitySeed
+          default: 0xeec5e43d4b16446726a27b8f0b30ad5048bae844c87b69111a24d5e4442bcfb7
           randwidth: 256
         }
         {
           name: RndCnstSoftOutputSeed
           desc: Compile-time random bits for software generation seed
           type: keymgr_pkg::seed_t
-          randcount: "256"
+          randcount: 256
           randtype: data
-          local: "false"
-          default: 0xab174a27f3e9a7da096f534d1a07eb42a37dbfb7be9bb6e69a7d3c5f369ae283
-          expose: "false"
           name_top: RndCnstKeymgrSoftOutputSeed
+          default: 0xab174a27f3e9a7da096f534d1a07eb42a37dbfb7be9bb6e69a7d3c5f369ae283
           randwidth: 256
         }
         {
           name: RndCnstHardOutputSeed
           desc: Compile-time random bits for hardware generation seed
           type: keymgr_pkg::seed_t
-          randcount: "256"
+          randcount: 256
           randtype: data
-          local: "false"
-          default: 0x8fefbc18548dfcb2fd145395d417df2f55255e182efed724cf8370466a266421
-          expose: "false"
           name_top: RndCnstKeymgrHardOutputSeed
+          default: 0x8fefbc18548dfcb2fd145395d417df2f55255e182efed724cf8370466a266421
           randwidth: 256
         }
         {
           name: RndCnstAesSeed
           desc: Compile-time random bits for generation seed when aes destination selected
           type: keymgr_pkg::seed_t
-          randcount: "256"
+          randcount: 256
           randtype: data
-          local: "false"
-          default: 0xe390fce7275f3bce5145a3b8edb5f33fd64e96a5b7a45278102f4c28f70a5b08
-          expose: "false"
           name_top: RndCnstKeymgrAesSeed
+          default: 0xe390fce7275f3bce5145a3b8edb5f33fd64e96a5b7a45278102f4c28f70a5b08
           randwidth: 256
         }
         {
           name: RndCnstHmacSeed
           desc: Compile-time random bits for generation seed when hmac destination selected
           type: keymgr_pkg::seed_t
-          randcount: "256"
+          randcount: 256
           randtype: data
-          local: "false"
-          default: 0x5f0e50f0c4cdf307b6cf85bd7669c05b0e5dbc9627c050e4936e54cc761467e
-          expose: "false"
           name_top: RndCnstKeymgrHmacSeed
+          default: 0x5f0e50f0c4cdf307b6cf85bd7669c05b0e5dbc9627c050e4936e54cc761467e
           randwidth: 256
         }
         {
           name: RndCnstKmacSeed
           desc: Compile-time random bits for generation seed when kmac destination selected
           type: keymgr_pkg::seed_t
-          randcount: "256"
+          randcount: 256
           randtype: data
-          local: "false"
-          default: 0xc19175299f2746ea860d6c0dd7a42245f8e1d251d66cef31bce5f18f586239c4
-          expose: "false"
           name_top: RndCnstKeymgrKmacSeed
+          default: 0xc19175299f2746ea860d6c0dd7a42245f8e1d251d66cef31bce5f18f586239c4
           randwidth: 256
         }
         {
           name: RndCnstNoneSeed
           desc: Compile-time random bits for generation seed when no destination selected
           type: keymgr_pkg::seed_t
-          randcount: "256"
+          randcount: 256
           randtype: data
-          local: "false"
-          default: 0x350bb6b68440934dcb834f93689fe9e88ebd53404a1d7296f0cbdb8b82989aa7
-          expose: "false"
           name_top: RndCnstKeymgrNoneSeed
+          default: 0x350bb6b68440934dcb834f93689fe9e88ebd53404a1d7296f0cbdb8b82989aa7
           randwidth: 256
         }
       ]
@@ -6570,13 +6477,10 @@
       [
         {
           name: SBoxImpl
+          desc: Selection of the S-Box implementation. See aes_pkg.sv.
           type: aes_pkg::sbox_impl_e
           default: aes_pkg::SBoxImplCanright
-          desc: Selection of the S-Box implementation. See aes_pkg.sv.
-          local: "false"
           expose: "true"
-          randcount: "0"
-          randtype: none
           name_top: CsrngSBoxImpl
         }
       ]
@@ -7162,35 +7066,28 @@
           name: RndCnstSramKey
           desc: Compile-time random reset value for SRAM scrambling key.
           type: otp_ctrl_pkg::sram_key_t
-          randcount: "128"
+          randcount: 128
           randtype: data
-          local: "false"
-          default: 0xb6d4b556d89f9dfcfabd19450b238d4c
-          expose: "false"
           name_top: RndCnstSramCtrlMainSramKey
+          default: 0xb6d4b556d89f9dfcfabd19450b238d4c
           randwidth: 128
         }
         {
           name: RndCnstSramNonce
           desc: Compile-time random reset value for SRAM scrambling nonce.
           type: otp_ctrl_pkg::sram_nonce_t
-          randcount: "64"
+          randcount: 64
           randtype: data
-          local: "false"
-          default: 0x160733e752cad615
-          expose: "false"
           name_top: RndCnstSramCtrlMainSramNonce
+          default: 0x160733e752cad615
           randwidth: 64
         }
         {
           name: InstrExec
           desc: Support execution from SRAM
           type: bit
-          local: "false"
-          expose: "true"
           default: "1"
-          randcount: "0"
-          randtype: none
+          expose: "true"
           name_top: SramCtrlMainInstrExec
         }
       ]
@@ -7363,13 +7260,10 @@
       [
         {
           name: RegFile
+          desc: Selection of the register file implementation. See otbn_pkg.sv.
           type: otbn_pkg::regfile_e
           default: otbn_pkg::RegFileFF
-          desc: Selection of the register file implementation. See otbn_pkg.sv.
-          local: "false"
           expose: "true"
-          randcount: "0"
-          randtype: none
           name_top: OtbnRegFile
         }
       ]
diff --git a/hw/top_earlgrey/data/top_earlgrey.sv.tpl b/hw/top_earlgrey/data/top_earlgrey.sv.tpl
index b507b29..de9342e 100644
--- a/hw/top_earlgrey/data/top_earlgrey.sv.tpl
+++ b/hw/top_earlgrey/data/top_earlgrey.sv.tpl
@@ -40,7 +40,7 @@
   % if not lib.is_inst(m):
 <% continue %>
   % endif
-  % for p_exp in filter(lambda p: p["expose"] == "true", m["param_list"]):
+  % for p_exp in filter(lambda p: p.get("expose") == "true", m["param_list"]):
   parameter ${p_exp["type"]} ${p_exp["name_top"]} = ${p_exp["default"]},
   % endfor
 % endfor
@@ -592,7 +592,7 @@
   % if m["param_list"]:
   ${m["type"]} #(
     % for i in m["param_list"]:
-    .${i["name"]}(${i["name_top" if i["expose"] == "true" or i["randtype"] != "none" else "default"]})${"," if not loop.last else ""}
+    .${i["name"]}(${i["name_top" if i.get("expose") == "true" or i.get("randtype", "none") != "none" else "default"]})${"," if not loop.last else ""}
     % endfor
   ) u_${m["name"]} (
   % else:
diff --git a/hw/top_earlgrey/data/top_earlgrey_rnd_cnst_pkg.sv.tpl b/hw/top_earlgrey/data/top_earlgrey_rnd_cnst_pkg.sv.tpl
index 6165266..9700c3d 100644
--- a/hw/top_earlgrey/data/top_earlgrey_rnd_cnst_pkg.sv.tpl
+++ b/hw/top_earlgrey/data/top_earlgrey_rnd_cnst_pkg.sv.tpl
@@ -26,7 +26,7 @@
 package top_${top["name"]}_rnd_cnst_pkg;
 
 % for m in top["module"]:
-  % for p in filter(lambda p: p["randtype"] in ["data", "perm"], m["param_list"]):
+  % for p in filter(lambda p: p.get("randtype") in ["data", "perm"], m["param_list"]):
     % if loop.first:
   ////////////////////////////////////////////
   // ${m['name']}