Skip to content

Commit

Permalink
scrubbing enums in generated reg pkg files
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Norris committed Apr 1, 2024
1 parent 2c4b61f commit 2182b3b
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/doe/rtl/doe_reg_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ package doe_reg_pkg;
doe_reg__intr_block_t__out_t intr_block_rf;
} doe_reg__out_t;

typedef enum {
typedef enum logic [31:0] {
doe_reg__DOE_CTRL__CMD__doe_cmd_e__DOE_IDLE = 'h0,
doe_reg__DOE_CTRL__CMD__doe_cmd_e__DOE_UDS = 'h1,
doe_reg__DOE_CTRL__CMD__doe_cmd_e__DOE_FE = 'h2,
Expand Down
2 changes: 1 addition & 1 deletion src/ecc/rtl/ecc_reg_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ package ecc_reg_pkg;
ecc_reg__intr_block_t__out_t intr_block_rf;
} ecc_reg__out_t;

typedef enum {
typedef enum logic [31:0] {
kv_status_reg__ERROR__kv_error_e__SUCCESS = 'h0,
kv_status_reg__ERROR__kv_error_e__KV_READ_FAIL = 'h1,
kv_status_reg__ERROR__kv_error_e__KV_WRITE_FAIL = 'h2
Expand Down
2 changes: 1 addition & 1 deletion src/hmac/rtl/hmac_reg_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ package hmac_reg_pkg;
hmac_reg__intr_block_t__out_t intr_block_rf;
} hmac_reg__out_t;

typedef enum {
typedef enum logic [31:0] {
kv_status_reg__ERROR__kv_error_e__SUCCESS = 'h0,
kv_status_reg__ERROR__kv_error_e__KV_READ_FAIL = 'h1,
kv_status_reg__ERROR__kv_error_e__KV_WRITE_FAIL = 'h2
Expand Down
2 changes: 1 addition & 1 deletion src/sha512/rtl/sha512_reg_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ package sha512_reg_pkg;
sha512_reg__intr_block_t__out_t intr_block_rf;
} sha512_reg__out_t;

typedef enum {
typedef enum logic [31:0] {
kv_status_reg__ERROR__kv_error_e__SUCCESS = 'h0,
kv_status_reg__ERROR__kv_error_e__KV_READ_FAIL = 'h1,
kv_status_reg__ERROR__kv_error_e__KV_WRITE_FAIL = 'h2
Expand Down
4 changes: 2 additions & 2 deletions src/soc_ifc/rtl/mbox_csr_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,14 @@ package mbox_csr_pkg;
mbox_csr__mbox_unlock__out_t mbox_unlock;
} mbox_csr__out_t;

typedef enum {
typedef enum logic [31:0] {
mbox_csr__mbox_status__status__mbox_status_e__CMD_BUSY = 'h0,
mbox_csr__mbox_status__status__mbox_status_e__DATA_READY = 'h1,
mbox_csr__mbox_status__status__mbox_status_e__CMD_COMPLETE = 'h2,
mbox_csr__mbox_status__status__mbox_status_e__CMD_FAILURE = 'h3
} mbox_csr__mbox_status__status__mbox_status_e_e;

typedef enum {
typedef enum logic [31:0] {
mbox_csr__mbox_status__mbox_fsm_ps__mbox_fsm_e__MBOX_IDLE = 'h0,
mbox_csr__mbox_status__mbox_fsm_ps__mbox_fsm_e__MBOX_RDY_FOR_CMD = 'h1,
mbox_csr__mbox_status__mbox_fsm_ps__mbox_fsm_e__MBOX_RDY_FOR_DLEN = 'h3,
Expand Down
2 changes: 1 addition & 1 deletion src/soc_ifc/rtl/sha512_acc_csr_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ package sha512_acc_csr_pkg;
sha512_acc_csr__intr_block_t__out_t intr_block_rf;
} sha512_acc_csr__out_t;

typedef enum {
typedef enum logic [31:0] {
sha512_acc_csr__MODE__MODE__sha_cmd_e__SHA_STREAM_384 = 'h0,
sha512_acc_csr__MODE__MODE__sha_cmd_e__SHA_STREAM_512 = 'h1,
sha512_acc_csr__MODE__MODE__sha_cmd_e__SHA_MBOX_384 = 'h2,
Expand Down
2 changes: 1 addition & 1 deletion src/soc_ifc/rtl/soc_ifc_reg_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ package soc_ifc_reg_pkg;
soc_ifc_reg__intr_block_t__out_t intr_block_rf;
} soc_ifc_reg__out_t;

typedef enum {
typedef enum logic [31:0] {
soc_ifc_reg__CPTRA_SECURITY_STATE__device_lifecycle_e__DEVICE_UNPROVISIONED = 'h0,
soc_ifc_reg__CPTRA_SECURITY_STATE__device_lifecycle_e__DEVICE_MANUFACTURING = 'h1,
soc_ifc_reg__CPTRA_SECURITY_STATE__device_lifecycle_e__DEVICE_PRODUCTION = 'h3
Expand Down
5 changes: 5 additions & 0 deletions tools/scripts/rdl_post_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def scrub_line_by_line(fname):
has_struct = re.search(r'\bstruct\b\s*(?:unpacked)?', line)
is_endmodule = re.search(r'\bendmodule\b', line)
has_reset = re.search(r'\bnegedge\b', line)
has_enum = re.search(r'\btypedef enum\b', line)
if (has_reset is not None and found_hard_reset is None):
substring = re.search(r"negedge (\w+.\w+)", line)
reset_name = substring.group(1)
Expand All @@ -49,6 +50,10 @@ def scrub_line_by_line(fname):
# only want to scrub signal definitions for unpacked arrays
if (has_assign is not None or has_reg_strb is not None):
mod_lines+=line
elif (has_enum is not None):
line = re.sub('enum', 'enum logic [31:0]', line)
mod_lines+=line
mod_cnt+=1
elif (has_struct is not None):
line = re.sub(r'(\bstruct\b)\s*(?:unpacked)?', r'\1 packed', line)
mod_lines+=line
Expand Down

0 comments on commit 2182b3b

Please sign in to comment.