| // Copyright lowRISC contributors. |
| // Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| // SPDX-License-Identifier: Apache-2.0 |
| // |
| // Register Top module auto-generated by `reggen` |
| |
| `include "prim_assert.sv" |
| |
| module aes_reg_top ( |
| input clk_i, |
| input rst_ni, |
| input rst_shadowed_ni, |
| input tlul_pkg::tl_h2d_t tl_i, |
| output tlul_pkg::tl_d2h_t tl_o, |
| // To HW |
| output aes_reg_pkg::aes_reg2hw_t reg2hw, // Write |
| input aes_reg_pkg::aes_hw2reg_t hw2reg, // Read |
| |
| output logic shadowed_storage_err_o, |
| output logic shadowed_update_err_o, |
| |
| // Integrity check errors |
| output logic intg_err_o, |
| |
| // Config |
| input devmode_i // If 1, explicit error return for unmapped register access |
| ); |
| |
| import aes_reg_pkg::* ; |
| |
| localparam int AW = 8; |
| localparam int DW = 32; |
| localparam int DBW = DW/8; // Byte Width |
| |
| // register signals |
| logic reg_we; |
| logic reg_re; |
| logic [AW-1:0] reg_addr; |
| logic [DW-1:0] reg_wdata; |
| logic [DBW-1:0] reg_be; |
| logic [DW-1:0] reg_rdata; |
| logic reg_error; |
| |
| logic addrmiss, wr_err; |
| |
| logic [DW-1:0] reg_rdata_next; |
| logic reg_busy; |
| |
| tlul_pkg::tl_h2d_t tl_reg_h2d; |
| tlul_pkg::tl_d2h_t tl_reg_d2h; |
| |
| |
| // incoming payload check |
| logic intg_err; |
| tlul_cmd_intg_chk u_chk ( |
| .tl_i(tl_i), |
| .err_o(intg_err) |
| ); |
| |
| // also check for spurious write enables |
| logic reg_we_err; |
| logic [33:0] reg_we_check; |
| prim_reg_we_check #( |
| .OneHotWidth(34) |
| ) u_prim_reg_we_check ( |
| .clk_i(clk_i), |
| .rst_ni(rst_ni), |
| .oh_i (reg_we_check), |
| .en_i (reg_we && !addrmiss), |
| .err_o (reg_we_err) |
| ); |
| |
| logic err_q; |
| always_ff @(posedge clk_i or negedge rst_ni) begin |
| if (!rst_ni) begin |
| err_q <= '0; |
| end else if (intg_err || reg_we_err) begin |
| err_q <= 1'b1; |
| end |
| end |
| |
| // integrity error output is permanent and should be used for alert generation |
| // register errors are transactional |
| assign intg_err_o = err_q | intg_err | reg_we_err; |
| |
| // outgoing integrity generation |
| tlul_pkg::tl_d2h_t tl_o_pre; |
| tlul_rsp_intg_gen #( |
| .EnableRspIntgGen(1), |
| .EnableDataIntgGen(1) |
| ) u_rsp_intg_gen ( |
| .tl_i(tl_o_pre), |
| .tl_o(tl_o) |
| ); |
| |
| assign tl_reg_h2d = tl_i; |
| assign tl_o_pre = tl_reg_d2h; |
| |
| tlul_adapter_reg #( |
| .RegAw(AW), |
| .RegDw(DW), |
| .EnableDataIntgGen(0) |
| ) u_reg_if ( |
| .clk_i (clk_i), |
| .rst_ni (rst_ni), |
| |
| .tl_i (tl_reg_h2d), |
| .tl_o (tl_reg_d2h), |
| |
| .en_ifetch_i(prim_mubi_pkg::MuBi4False), |
| .intg_error_o(), |
| |
| .we_o (reg_we), |
| .re_o (reg_re), |
| .addr_o (reg_addr), |
| .wdata_o (reg_wdata), |
| .be_o (reg_be), |
| .busy_i (reg_busy), |
| .rdata_i (reg_rdata), |
| .error_i (reg_error) |
| ); |
| |
| // cdc oversampling signals |
| |
| assign reg_rdata = reg_rdata_next ; |
| assign reg_error = (devmode_i & addrmiss) | wr_err | intg_err; |
| |
| // Define SW related signals |
| // Format: <reg>_<field>_{wd|we|qs} |
| // or <reg>_{wd|we|qs} if field == 1 or 0 |
| logic alert_test_we; |
| logic alert_test_recov_ctrl_update_err_wd; |
| logic alert_test_fatal_fault_wd; |
| logic key_share0_0_we; |
| logic [31:0] key_share0_0_wd; |
| logic key_share0_1_we; |
| logic [31:0] key_share0_1_wd; |
| logic key_share0_2_we; |
| logic [31:0] key_share0_2_wd; |
| logic key_share0_3_we; |
| logic [31:0] key_share0_3_wd; |
| logic key_share0_4_we; |
| logic [31:0] key_share0_4_wd; |
| logic key_share0_5_we; |
| logic [31:0] key_share0_5_wd; |
| logic key_share0_6_we; |
| logic [31:0] key_share0_6_wd; |
| logic key_share0_7_we; |
| logic [31:0] key_share0_7_wd; |
| logic key_share1_0_we; |
| logic [31:0] key_share1_0_wd; |
| logic key_share1_1_we; |
| logic [31:0] key_share1_1_wd; |
| logic key_share1_2_we; |
| logic [31:0] key_share1_2_wd; |
| logic key_share1_3_we; |
| logic [31:0] key_share1_3_wd; |
| logic key_share1_4_we; |
| logic [31:0] key_share1_4_wd; |
| logic key_share1_5_we; |
| logic [31:0] key_share1_5_wd; |
| logic key_share1_6_we; |
| logic [31:0] key_share1_6_wd; |
| logic key_share1_7_we; |
| logic [31:0] key_share1_7_wd; |
| logic iv_0_re; |
| logic iv_0_we; |
| logic [31:0] iv_0_qs; |
| logic [31:0] iv_0_wd; |
| logic iv_1_re; |
| logic iv_1_we; |
| logic [31:0] iv_1_qs; |
| logic [31:0] iv_1_wd; |
| logic iv_2_re; |
| logic iv_2_we; |
| logic [31:0] iv_2_qs; |
| logic [31:0] iv_2_wd; |
| logic iv_3_re; |
| logic iv_3_we; |
| logic [31:0] iv_3_qs; |
| logic [31:0] iv_3_wd; |
| logic data_in_0_we; |
| logic [31:0] data_in_0_wd; |
| logic data_in_1_we; |
| logic [31:0] data_in_1_wd; |
| logic data_in_2_we; |
| logic [31:0] data_in_2_wd; |
| logic data_in_3_we; |
| logic [31:0] data_in_3_wd; |
| logic data_out_0_re; |
| logic [31:0] data_out_0_qs; |
| logic data_out_1_re; |
| logic [31:0] data_out_1_qs; |
| logic data_out_2_re; |
| logic [31:0] data_out_2_qs; |
| logic data_out_3_re; |
| logic [31:0] data_out_3_qs; |
| logic ctrl_shadowed_re; |
| logic ctrl_shadowed_we; |
| logic [1:0] ctrl_shadowed_operation_qs; |
| logic [1:0] ctrl_shadowed_operation_wd; |
| logic [5:0] ctrl_shadowed_mode_qs; |
| logic [5:0] ctrl_shadowed_mode_wd; |
| logic [2:0] ctrl_shadowed_key_len_qs; |
| logic [2:0] ctrl_shadowed_key_len_wd; |
| logic ctrl_shadowed_sideload_qs; |
| logic ctrl_shadowed_sideload_wd; |
| logic [2:0] ctrl_shadowed_prng_reseed_rate_qs; |
| logic [2:0] ctrl_shadowed_prng_reseed_rate_wd; |
| logic ctrl_shadowed_manual_operation_qs; |
| logic ctrl_shadowed_manual_operation_wd; |
| logic ctrl_aux_shadowed_re; |
| logic ctrl_aux_shadowed_we; |
| logic ctrl_aux_shadowed_key_touch_forces_reseed_qs; |
| logic ctrl_aux_shadowed_key_touch_forces_reseed_wd; |
| logic ctrl_aux_shadowed_key_touch_forces_reseed_storage_err; |
| logic ctrl_aux_shadowed_key_touch_forces_reseed_update_err; |
| logic ctrl_aux_shadowed_force_masks_qs; |
| logic ctrl_aux_shadowed_force_masks_wd; |
| logic ctrl_aux_shadowed_force_masks_storage_err; |
| logic ctrl_aux_shadowed_force_masks_update_err; |
| logic ctrl_aux_regwen_we; |
| logic ctrl_aux_regwen_qs; |
| logic ctrl_aux_regwen_wd; |
| logic trigger_we; |
| logic trigger_start_wd; |
| logic trigger_key_iv_data_in_clear_wd; |
| logic trigger_data_out_clear_wd; |
| logic trigger_prng_reseed_wd; |
| logic status_idle_qs; |
| logic status_stall_qs; |
| logic status_output_lost_qs; |
| logic status_output_valid_qs; |
| logic status_input_ready_qs; |
| logic status_alert_recov_ctrl_update_err_qs; |
| logic status_alert_fatal_fault_qs; |
| |
| // Register instances |
| // R[alert_test]: V(True) |
| logic alert_test_qe; |
| logic [1:0] alert_test_flds_we; |
| assign alert_test_qe = &alert_test_flds_we; |
| // F[recov_ctrl_update_err]: 0:0 |
| prim_subreg_ext #( |
| .DW (1) |
| ) u_alert_test_recov_ctrl_update_err ( |
| .re (1'b0), |
| .we (alert_test_we), |
| .wd (alert_test_recov_ctrl_update_err_wd), |
| .d ('0), |
| .qre (), |
| .qe (alert_test_flds_we[0]), |
| .q (reg2hw.alert_test.recov_ctrl_update_err.q), |
| .ds (), |
| .qs () |
| ); |
| assign reg2hw.alert_test.recov_ctrl_update_err.qe = alert_test_qe; |
| |
| // F[fatal_fault]: 1:1 |
| prim_subreg_ext #( |
| .DW (1) |
| ) u_alert_test_fatal_fault ( |
| .re (1'b0), |
| .we (alert_test_we), |
| .wd (alert_test_fatal_fault_wd), |
| .d ('0), |
| .qre (), |
| .qe (alert_test_flds_we[1]), |
| .q (reg2hw.alert_test.fatal_fault.q), |
| .ds (), |
| .qs () |
| ); |
| assign reg2hw.alert_test.fatal_fault.qe = alert_test_qe; |
| |
| |
| // Subregister 0 of Multireg key_share0 |
| // R[key_share0_0]: V(True) |
| logic key_share0_0_qe; |
| logic [0:0] key_share0_0_flds_we; |
| assign key_share0_0_qe = &key_share0_0_flds_we; |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_key_share0_0 ( |
| .re (1'b0), |
| .we (key_share0_0_we), |
| .wd (key_share0_0_wd), |
| .d (hw2reg.key_share0[0].d), |
| .qre (), |
| .qe (key_share0_0_flds_we[0]), |
| .q (reg2hw.key_share0[0].q), |
| .ds (), |
| .qs () |
| ); |
| assign reg2hw.key_share0[0].qe = key_share0_0_qe; |
| |
| |
| // Subregister 1 of Multireg key_share0 |
| // R[key_share0_1]: V(True) |
| logic key_share0_1_qe; |
| logic [0:0] key_share0_1_flds_we; |
| assign key_share0_1_qe = &key_share0_1_flds_we; |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_key_share0_1 ( |
| .re (1'b0), |
| .we (key_share0_1_we), |
| .wd (key_share0_1_wd), |
| .d (hw2reg.key_share0[1].d), |
| .qre (), |
| .qe (key_share0_1_flds_we[0]), |
| .q (reg2hw.key_share0[1].q), |
| .ds (), |
| .qs () |
| ); |
| assign reg2hw.key_share0[1].qe = key_share0_1_qe; |
| |
| |
| // Subregister 2 of Multireg key_share0 |
| // R[key_share0_2]: V(True) |
| logic key_share0_2_qe; |
| logic [0:0] key_share0_2_flds_we; |
| assign key_share0_2_qe = &key_share0_2_flds_we; |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_key_share0_2 ( |
| .re (1'b0), |
| .we (key_share0_2_we), |
| .wd (key_share0_2_wd), |
| .d (hw2reg.key_share0[2].d), |
| .qre (), |
| .qe (key_share0_2_flds_we[0]), |
| .q (reg2hw.key_share0[2].q), |
| .ds (), |
| .qs () |
| ); |
| assign reg2hw.key_share0[2].qe = key_share0_2_qe; |
| |
| |
| // Subregister 3 of Multireg key_share0 |
| // R[key_share0_3]: V(True) |
| logic key_share0_3_qe; |
| logic [0:0] key_share0_3_flds_we; |
| assign key_share0_3_qe = &key_share0_3_flds_we; |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_key_share0_3 ( |
| .re (1'b0), |
| .we (key_share0_3_we), |
| .wd (key_share0_3_wd), |
| .d (hw2reg.key_share0[3].d), |
| .qre (), |
| .qe (key_share0_3_flds_we[0]), |
| .q (reg2hw.key_share0[3].q), |
| .ds (), |
| .qs () |
| ); |
| assign reg2hw.key_share0[3].qe = key_share0_3_qe; |
| |
| |
| // Subregister 4 of Multireg key_share0 |
| // R[key_share0_4]: V(True) |
| logic key_share0_4_qe; |
| logic [0:0] key_share0_4_flds_we; |
| assign key_share0_4_qe = &key_share0_4_flds_we; |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_key_share0_4 ( |
| .re (1'b0), |
| .we (key_share0_4_we), |
| .wd (key_share0_4_wd), |
| .d (hw2reg.key_share0[4].d), |
| .qre (), |
| .qe (key_share0_4_flds_we[0]), |
| .q (reg2hw.key_share0[4].q), |
| .ds (), |
| .qs () |
| ); |
| assign reg2hw.key_share0[4].qe = key_share0_4_qe; |
| |
| |
| // Subregister 5 of Multireg key_share0 |
| // R[key_share0_5]: V(True) |
| logic key_share0_5_qe; |
| logic [0:0] key_share0_5_flds_we; |
| assign key_share0_5_qe = &key_share0_5_flds_we; |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_key_share0_5 ( |
| .re (1'b0), |
| .we (key_share0_5_we), |
| .wd (key_share0_5_wd), |
| .d (hw2reg.key_share0[5].d), |
| .qre (), |
| .qe (key_share0_5_flds_we[0]), |
| .q (reg2hw.key_share0[5].q), |
| .ds (), |
| .qs () |
| ); |
| assign reg2hw.key_share0[5].qe = key_share0_5_qe; |
| |
| |
| // Subregister 6 of Multireg key_share0 |
| // R[key_share0_6]: V(True) |
| logic key_share0_6_qe; |
| logic [0:0] key_share0_6_flds_we; |
| assign key_share0_6_qe = &key_share0_6_flds_we; |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_key_share0_6 ( |
| .re (1'b0), |
| .we (key_share0_6_we), |
| .wd (key_share0_6_wd), |
| .d (hw2reg.key_share0[6].d), |
| .qre (), |
| .qe (key_share0_6_flds_we[0]), |
| .q (reg2hw.key_share0[6].q), |
| .ds (), |
| .qs () |
| ); |
| assign reg2hw.key_share0[6].qe = key_share0_6_qe; |
| |
| |
| // Subregister 7 of Multireg key_share0 |
| // R[key_share0_7]: V(True) |
| logic key_share0_7_qe; |
| logic [0:0] key_share0_7_flds_we; |
| assign key_share0_7_qe = &key_share0_7_flds_we; |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_key_share0_7 ( |
| .re (1'b0), |
| .we (key_share0_7_we), |
| .wd (key_share0_7_wd), |
| .d (hw2reg.key_share0[7].d), |
| .qre (), |
| .qe (key_share0_7_flds_we[0]), |
| .q (reg2hw.key_share0[7].q), |
| .ds (), |
| .qs () |
| ); |
| assign reg2hw.key_share0[7].qe = key_share0_7_qe; |
| |
| |
| // Subregister 0 of Multireg key_share1 |
| // R[key_share1_0]: V(True) |
| logic key_share1_0_qe; |
| logic [0:0] key_share1_0_flds_we; |
| assign key_share1_0_qe = &key_share1_0_flds_we; |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_key_share1_0 ( |
| .re (1'b0), |
| .we (key_share1_0_we), |
| .wd (key_share1_0_wd), |
| .d (hw2reg.key_share1[0].d), |
| .qre (), |
| .qe (key_share1_0_flds_we[0]), |
| .q (reg2hw.key_share1[0].q), |
| .ds (), |
| .qs () |
| ); |
| assign reg2hw.key_share1[0].qe = key_share1_0_qe; |
| |
| |
| // Subregister 1 of Multireg key_share1 |
| // R[key_share1_1]: V(True) |
| logic key_share1_1_qe; |
| logic [0:0] key_share1_1_flds_we; |
| assign key_share1_1_qe = &key_share1_1_flds_we; |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_key_share1_1 ( |
| .re (1'b0), |
| .we (key_share1_1_we), |
| .wd (key_share1_1_wd), |
| .d (hw2reg.key_share1[1].d), |
| .qre (), |
| .qe (key_share1_1_flds_we[0]), |
| .q (reg2hw.key_share1[1].q), |
| .ds (), |
| .qs () |
| ); |
| assign reg2hw.key_share1[1].qe = key_share1_1_qe; |
| |
| |
| // Subregister 2 of Multireg key_share1 |
| // R[key_share1_2]: V(True) |
| logic key_share1_2_qe; |
| logic [0:0] key_share1_2_flds_we; |
| assign key_share1_2_qe = &key_share1_2_flds_we; |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_key_share1_2 ( |
| .re (1'b0), |
| .we (key_share1_2_we), |
| .wd (key_share1_2_wd), |
| .d (hw2reg.key_share1[2].d), |
| .qre (), |
| .qe (key_share1_2_flds_we[0]), |
| .q (reg2hw.key_share1[2].q), |
| .ds (), |
| .qs () |
| ); |
| assign reg2hw.key_share1[2].qe = key_share1_2_qe; |
| |
| |
| // Subregister 3 of Multireg key_share1 |
| // R[key_share1_3]: V(True) |
| logic key_share1_3_qe; |
| logic [0:0] key_share1_3_flds_we; |
| assign key_share1_3_qe = &key_share1_3_flds_we; |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_key_share1_3 ( |
| .re (1'b0), |
| .we (key_share1_3_we), |
| .wd (key_share1_3_wd), |
| .d (hw2reg.key_share1[3].d), |
| .qre (), |
| .qe (key_share1_3_flds_we[0]), |
| .q (reg2hw.key_share1[3].q), |
| .ds (), |
| .qs () |
| ); |
| assign reg2hw.key_share1[3].qe = key_share1_3_qe; |
| |
| |
| // Subregister 4 of Multireg key_share1 |
| // R[key_share1_4]: V(True) |
| logic key_share1_4_qe; |
| logic [0:0] key_share1_4_flds_we; |
| assign key_share1_4_qe = &key_share1_4_flds_we; |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_key_share1_4 ( |
| .re (1'b0), |
| .we (key_share1_4_we), |
| .wd (key_share1_4_wd), |
| .d (hw2reg.key_share1[4].d), |
| .qre (), |
| .qe (key_share1_4_flds_we[0]), |
| .q (reg2hw.key_share1[4].q), |
| .ds (), |
| .qs () |
| ); |
| assign reg2hw.key_share1[4].qe = key_share1_4_qe; |
| |
| |
| // Subregister 5 of Multireg key_share1 |
| // R[key_share1_5]: V(True) |
| logic key_share1_5_qe; |
| logic [0:0] key_share1_5_flds_we; |
| assign key_share1_5_qe = &key_share1_5_flds_we; |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_key_share1_5 ( |
| .re (1'b0), |
| .we (key_share1_5_we), |
| .wd (key_share1_5_wd), |
| .d (hw2reg.key_share1[5].d), |
| .qre (), |
| .qe (key_share1_5_flds_we[0]), |
| .q (reg2hw.key_share1[5].q), |
| .ds (), |
| .qs () |
| ); |
| assign reg2hw.key_share1[5].qe = key_share1_5_qe; |
| |
| |
| // Subregister 6 of Multireg key_share1 |
| // R[key_share1_6]: V(True) |
| logic key_share1_6_qe; |
| logic [0:0] key_share1_6_flds_we; |
| assign key_share1_6_qe = &key_share1_6_flds_we; |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_key_share1_6 ( |
| .re (1'b0), |
| .we (key_share1_6_we), |
| .wd (key_share1_6_wd), |
| .d (hw2reg.key_share1[6].d), |
| .qre (), |
| .qe (key_share1_6_flds_we[0]), |
| .q (reg2hw.key_share1[6].q), |
| .ds (), |
| .qs () |
| ); |
| assign reg2hw.key_share1[6].qe = key_share1_6_qe; |
| |
| |
| // Subregister 7 of Multireg key_share1 |
| // R[key_share1_7]: V(True) |
| logic key_share1_7_qe; |
| logic [0:0] key_share1_7_flds_we; |
| assign key_share1_7_qe = &key_share1_7_flds_we; |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_key_share1_7 ( |
| .re (1'b0), |
| .we (key_share1_7_we), |
| .wd (key_share1_7_wd), |
| .d (hw2reg.key_share1[7].d), |
| .qre (), |
| .qe (key_share1_7_flds_we[0]), |
| .q (reg2hw.key_share1[7].q), |
| .ds (), |
| .qs () |
| ); |
| assign reg2hw.key_share1[7].qe = key_share1_7_qe; |
| |
| |
| // Subregister 0 of Multireg iv |
| // R[iv_0]: V(True) |
| logic iv_0_qe; |
| logic [0:0] iv_0_flds_we; |
| assign iv_0_qe = &iv_0_flds_we; |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_iv_0 ( |
| .re (iv_0_re), |
| .we (iv_0_we), |
| .wd (iv_0_wd), |
| .d (hw2reg.iv[0].d), |
| .qre (), |
| .qe (iv_0_flds_we[0]), |
| .q (reg2hw.iv[0].q), |
| .ds (), |
| .qs (iv_0_qs) |
| ); |
| assign reg2hw.iv[0].qe = iv_0_qe; |
| |
| |
| // Subregister 1 of Multireg iv |
| // R[iv_1]: V(True) |
| logic iv_1_qe; |
| logic [0:0] iv_1_flds_we; |
| assign iv_1_qe = &iv_1_flds_we; |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_iv_1 ( |
| .re (iv_1_re), |
| .we (iv_1_we), |
| .wd (iv_1_wd), |
| .d (hw2reg.iv[1].d), |
| .qre (), |
| .qe (iv_1_flds_we[0]), |
| .q (reg2hw.iv[1].q), |
| .ds (), |
| .qs (iv_1_qs) |
| ); |
| assign reg2hw.iv[1].qe = iv_1_qe; |
| |
| |
| // Subregister 2 of Multireg iv |
| // R[iv_2]: V(True) |
| logic iv_2_qe; |
| logic [0:0] iv_2_flds_we; |
| assign iv_2_qe = &iv_2_flds_we; |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_iv_2 ( |
| .re (iv_2_re), |
| .we (iv_2_we), |
| .wd (iv_2_wd), |
| .d (hw2reg.iv[2].d), |
| .qre (), |
| .qe (iv_2_flds_we[0]), |
| .q (reg2hw.iv[2].q), |
| .ds (), |
| .qs (iv_2_qs) |
| ); |
| assign reg2hw.iv[2].qe = iv_2_qe; |
| |
| |
| // Subregister 3 of Multireg iv |
| // R[iv_3]: V(True) |
| logic iv_3_qe; |
| logic [0:0] iv_3_flds_we; |
| assign iv_3_qe = &iv_3_flds_we; |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_iv_3 ( |
| .re (iv_3_re), |
| .we (iv_3_we), |
| .wd (iv_3_wd), |
| .d (hw2reg.iv[3].d), |
| .qre (), |
| .qe (iv_3_flds_we[0]), |
| .q (reg2hw.iv[3].q), |
| .ds (), |
| .qs (iv_3_qs) |
| ); |
| assign reg2hw.iv[3].qe = iv_3_qe; |
| |
| |
| // Subregister 0 of Multireg data_in |
| // R[data_in_0]: V(False) |
| logic data_in_0_qe; |
| logic [0:0] data_in_0_flds_we; |
| prim_flop #( |
| .Width(1), |
| .ResetValue(0) |
| ) u_data_in0_qe ( |
| .clk_i(clk_i), |
| .rst_ni(rst_ni), |
| .d_i(&data_in_0_flds_we), |
| .q_o(data_in_0_qe) |
| ); |
| prim_subreg #( |
| .DW (32), |
| .SwAccess(prim_subreg_pkg::SwAccessWO), |
| .RESVAL (32'h0) |
| ) u_data_in_0 ( |
| .clk_i (clk_i), |
| .rst_ni (rst_ni), |
| |
| // from register interface |
| .we (data_in_0_we), |
| .wd (data_in_0_wd), |
| |
| // from internal hardware |
| .de (hw2reg.data_in[0].de), |
| .d (hw2reg.data_in[0].d), |
| |
| // to internal hardware |
| .qe (data_in_0_flds_we[0]), |
| .q (reg2hw.data_in[0].q), |
| .ds (), |
| |
| // to register interface (read) |
| .qs () |
| ); |
| assign reg2hw.data_in[0].qe = data_in_0_qe; |
| |
| |
| // Subregister 1 of Multireg data_in |
| // R[data_in_1]: V(False) |
| logic data_in_1_qe; |
| logic [0:0] data_in_1_flds_we; |
| prim_flop #( |
| .Width(1), |
| .ResetValue(0) |
| ) u_data_in1_qe ( |
| .clk_i(clk_i), |
| .rst_ni(rst_ni), |
| .d_i(&data_in_1_flds_we), |
| .q_o(data_in_1_qe) |
| ); |
| prim_subreg #( |
| .DW (32), |
| .SwAccess(prim_subreg_pkg::SwAccessWO), |
| .RESVAL (32'h0) |
| ) u_data_in_1 ( |
| .clk_i (clk_i), |
| .rst_ni (rst_ni), |
| |
| // from register interface |
| .we (data_in_1_we), |
| .wd (data_in_1_wd), |
| |
| // from internal hardware |
| .de (hw2reg.data_in[1].de), |
| .d (hw2reg.data_in[1].d), |
| |
| // to internal hardware |
| .qe (data_in_1_flds_we[0]), |
| .q (reg2hw.data_in[1].q), |
| .ds (), |
| |
| // to register interface (read) |
| .qs () |
| ); |
| assign reg2hw.data_in[1].qe = data_in_1_qe; |
| |
| |
| // Subregister 2 of Multireg data_in |
| // R[data_in_2]: V(False) |
| logic data_in_2_qe; |
| logic [0:0] data_in_2_flds_we; |
| prim_flop #( |
| .Width(1), |
| .ResetValue(0) |
| ) u_data_in2_qe ( |
| .clk_i(clk_i), |
| .rst_ni(rst_ni), |
| .d_i(&data_in_2_flds_we), |
| .q_o(data_in_2_qe) |
| ); |
| prim_subreg #( |
| .DW (32), |
| .SwAccess(prim_subreg_pkg::SwAccessWO), |
| .RESVAL (32'h0) |
| ) u_data_in_2 ( |
| .clk_i (clk_i), |
| .rst_ni (rst_ni), |
| |
| // from register interface |
| .we (data_in_2_we), |
| .wd (data_in_2_wd), |
| |
| // from internal hardware |
| .de (hw2reg.data_in[2].de), |
| .d (hw2reg.data_in[2].d), |
| |
| // to internal hardware |
| .qe (data_in_2_flds_we[0]), |
| .q (reg2hw.data_in[2].q), |
| .ds (), |
| |
| // to register interface (read) |
| .qs () |
| ); |
| assign reg2hw.data_in[2].qe = data_in_2_qe; |
| |
| |
| // Subregister 3 of Multireg data_in |
| // R[data_in_3]: V(False) |
| logic data_in_3_qe; |
| logic [0:0] data_in_3_flds_we; |
| prim_flop #( |
| .Width(1), |
| .ResetValue(0) |
| ) u_data_in3_qe ( |
| .clk_i(clk_i), |
| .rst_ni(rst_ni), |
| .d_i(&data_in_3_flds_we), |
| .q_o(data_in_3_qe) |
| ); |
| prim_subreg #( |
| .DW (32), |
| .SwAccess(prim_subreg_pkg::SwAccessWO), |
| .RESVAL (32'h0) |
| ) u_data_in_3 ( |
| .clk_i (clk_i), |
| .rst_ni (rst_ni), |
| |
| // from register interface |
| .we (data_in_3_we), |
| .wd (data_in_3_wd), |
| |
| // from internal hardware |
| .de (hw2reg.data_in[3].de), |
| .d (hw2reg.data_in[3].d), |
| |
| // to internal hardware |
| .qe (data_in_3_flds_we[0]), |
| .q (reg2hw.data_in[3].q), |
| .ds (), |
| |
| // to register interface (read) |
| .qs () |
| ); |
| assign reg2hw.data_in[3].qe = data_in_3_qe; |
| |
| |
| // Subregister 0 of Multireg data_out |
| // R[data_out_0]: V(True) |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_data_out_0 ( |
| .re (data_out_0_re), |
| .we (1'b0), |
| .wd ('0), |
| .d (hw2reg.data_out[0].d), |
| .qre (reg2hw.data_out[0].re), |
| .qe (), |
| .q (reg2hw.data_out[0].q), |
| .ds (), |
| .qs (data_out_0_qs) |
| ); |
| |
| |
| // Subregister 1 of Multireg data_out |
| // R[data_out_1]: V(True) |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_data_out_1 ( |
| .re (data_out_1_re), |
| .we (1'b0), |
| .wd ('0), |
| .d (hw2reg.data_out[1].d), |
| .qre (reg2hw.data_out[1].re), |
| .qe (), |
| .q (reg2hw.data_out[1].q), |
| .ds (), |
| .qs (data_out_1_qs) |
| ); |
| |
| |
| // Subregister 2 of Multireg data_out |
| // R[data_out_2]: V(True) |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_data_out_2 ( |
| .re (data_out_2_re), |
| .we (1'b0), |
| .wd ('0), |
| .d (hw2reg.data_out[2].d), |
| .qre (reg2hw.data_out[2].re), |
| .qe (), |
| .q (reg2hw.data_out[2].q), |
| .ds (), |
| .qs (data_out_2_qs) |
| ); |
| |
| |
| // Subregister 3 of Multireg data_out |
| // R[data_out_3]: V(True) |
| prim_subreg_ext #( |
| .DW (32) |
| ) u_data_out_3 ( |
| .re (data_out_3_re), |
| .we (1'b0), |
| .wd ('0), |
| .d (hw2reg.data_out[3].d), |
| .qre (reg2hw.data_out[3].re), |
| .qe (), |
| .q (reg2hw.data_out[3].q), |
| .ds (), |
| .qs (data_out_3_qs) |
| ); |
| |
| |
| // R[ctrl_shadowed]: V(True) |
| logic ctrl_shadowed_qe; |
| logic [5:0] ctrl_shadowed_flds_we; |
| assign ctrl_shadowed_qe = &ctrl_shadowed_flds_we; |
| // F[operation]: 1:0 |
| prim_subreg_ext #( |
| .DW (2) |
| ) u_ctrl_shadowed_operation ( |
| .re (ctrl_shadowed_re), |
| .we (ctrl_shadowed_we), |
| .wd (ctrl_shadowed_operation_wd), |
| .d (hw2reg.ctrl_shadowed.operation.d), |
| .qre (reg2hw.ctrl_shadowed.operation.re), |
| .qe (ctrl_shadowed_flds_we[0]), |
| .q (reg2hw.ctrl_shadowed.operation.q), |
| .ds (), |
| .qs (ctrl_shadowed_operation_qs) |
| ); |
| assign reg2hw.ctrl_shadowed.operation.qe = ctrl_shadowed_qe; |
| |
| // F[mode]: 7:2 |
| prim_subreg_ext #( |
| .DW (6) |
| ) u_ctrl_shadowed_mode ( |
| .re (ctrl_shadowed_re), |
| .we (ctrl_shadowed_we), |
| .wd (ctrl_shadowed_mode_wd), |
| .d (hw2reg.ctrl_shadowed.mode.d), |
| .qre (reg2hw.ctrl_shadowed.mode.re), |
| .qe (ctrl_shadowed_flds_we[1]), |
| .q (reg2hw.ctrl_shadowed.mode.q), |
| .ds (), |
| .qs (ctrl_shadowed_mode_qs) |
| ); |
| assign reg2hw.ctrl_shadowed.mode.qe = ctrl_shadowed_qe; |
| |
| // F[key_len]: 10:8 |
| prim_subreg_ext #( |
| .DW (3) |
| ) u_ctrl_shadowed_key_len ( |
| .re (ctrl_shadowed_re), |
| .we (ctrl_shadowed_we), |
| .wd (ctrl_shadowed_key_len_wd), |
| .d (hw2reg.ctrl_shadowed.key_len.d), |
| .qre (reg2hw.ctrl_shadowed.key_len.re), |
| .qe (ctrl_shadowed_flds_we[2]), |
| .q (reg2hw.ctrl_shadowed.key_len.q), |
| .ds (), |
| .qs (ctrl_shadowed_key_len_qs) |
| ); |
| assign reg2hw.ctrl_shadowed.key_len.qe = ctrl_shadowed_qe; |
| |
| // F[sideload]: 11:11 |
| prim_subreg_ext #( |
| .DW (1) |
| ) u_ctrl_shadowed_sideload ( |
| .re (ctrl_shadowed_re), |
| .we (ctrl_shadowed_we), |
| .wd (ctrl_shadowed_sideload_wd), |
| .d (hw2reg.ctrl_shadowed.sideload.d), |
| .qre (reg2hw.ctrl_shadowed.sideload.re), |
| .qe (ctrl_shadowed_flds_we[3]), |
| .q (reg2hw.ctrl_shadowed.sideload.q), |
| .ds (), |
| .qs (ctrl_shadowed_sideload_qs) |
| ); |
| assign reg2hw.ctrl_shadowed.sideload.qe = ctrl_shadowed_qe; |
| |
| // F[prng_reseed_rate]: 14:12 |
| prim_subreg_ext #( |
| .DW (3) |
| ) u_ctrl_shadowed_prng_reseed_rate ( |
| .re (ctrl_shadowed_re), |
| .we (ctrl_shadowed_we), |
| .wd (ctrl_shadowed_prng_reseed_rate_wd), |
| .d (hw2reg.ctrl_shadowed.prng_reseed_rate.d), |
| .qre (reg2hw.ctrl_shadowed.prng_reseed_rate.re), |
| .qe (ctrl_shadowed_flds_we[4]), |
| .q (reg2hw.ctrl_shadowed.prng_reseed_rate.q), |
| .ds (), |
| .qs (ctrl_shadowed_prng_reseed_rate_qs) |
| ); |
| assign reg2hw.ctrl_shadowed.prng_reseed_rate.qe = ctrl_shadowed_qe; |
| |
| // F[manual_operation]: 15:15 |
| prim_subreg_ext #( |
| .DW (1) |
| ) u_ctrl_shadowed_manual_operation ( |
| .re (ctrl_shadowed_re), |
| .we (ctrl_shadowed_we), |
| .wd (ctrl_shadowed_manual_operation_wd), |
| .d (hw2reg.ctrl_shadowed.manual_operation.d), |
| .qre (reg2hw.ctrl_shadowed.manual_operation.re), |
| .qe (ctrl_shadowed_flds_we[5]), |
| .q (reg2hw.ctrl_shadowed.manual_operation.q), |
| .ds (), |
| .qs (ctrl_shadowed_manual_operation_qs) |
| ); |
| assign reg2hw.ctrl_shadowed.manual_operation.qe = ctrl_shadowed_qe; |
| |
| |
| // R[ctrl_aux_shadowed]: V(False) |
| // Create REGWEN-gated WE signal |
| logic ctrl_aux_shadowed_gated_we; |
| assign ctrl_aux_shadowed_gated_we = ctrl_aux_shadowed_we & ctrl_aux_regwen_qs; |
| // F[key_touch_forces_reseed]: 0:0 |
| prim_subreg_shadow #( |
| .DW (1), |
| .SwAccess(prim_subreg_pkg::SwAccessRW), |
| .RESVAL (1'h1) |
| ) u_ctrl_aux_shadowed_key_touch_forces_reseed ( |
| .clk_i (clk_i), |
| .rst_ni (rst_ni), |
| .rst_shadowed_ni (rst_shadowed_ni), |
| |
| // from register interface |
| .re (ctrl_aux_shadowed_re), |
| .we (ctrl_aux_shadowed_gated_we), |
| .wd (ctrl_aux_shadowed_key_touch_forces_reseed_wd), |
| |
| // from internal hardware |
| .de (1'b0), |
| .d ('0), |
| |
| // to internal hardware |
| .qe (), |
| .q (reg2hw.ctrl_aux_shadowed.key_touch_forces_reseed.q), |
| .ds (), |
| |
| // to register interface (read) |
| .qs (ctrl_aux_shadowed_key_touch_forces_reseed_qs), |
| |
| // Shadow register phase. Relevant for hwext only. |
| .phase (), |
| |
| // Shadow register error conditions |
| .err_update (ctrl_aux_shadowed_key_touch_forces_reseed_update_err), |
| .err_storage (ctrl_aux_shadowed_key_touch_forces_reseed_storage_err) |
| ); |
| |
| // F[force_masks]: 1:1 |
| prim_subreg_shadow #( |
| .DW (1), |
| .SwAccess(prim_subreg_pkg::SwAccessRW), |
| .RESVAL (1'h0) |
| ) u_ctrl_aux_shadowed_force_masks ( |
| .clk_i (clk_i), |
| .rst_ni (rst_ni), |
| .rst_shadowed_ni (rst_shadowed_ni), |
| |
| // from register interface |
| .re (ctrl_aux_shadowed_re), |
| .we (ctrl_aux_shadowed_gated_we), |
| .wd (ctrl_aux_shadowed_force_masks_wd), |
| |
| // from internal hardware |
| .de (1'b0), |
| .d ('0), |
| |
| // to internal hardware |
| .qe (), |
| .q (reg2hw.ctrl_aux_shadowed.force_masks.q), |
| .ds (), |
| |
| // to register interface (read) |
| .qs (ctrl_aux_shadowed_force_masks_qs), |
| |
| // Shadow register phase. Relevant for hwext only. |
| .phase (), |
| |
| // Shadow register error conditions |
| .err_update (ctrl_aux_shadowed_force_masks_update_err), |
| .err_storage (ctrl_aux_shadowed_force_masks_storage_err) |
| ); |
| |
| |
| // R[ctrl_aux_regwen]: V(False) |
| prim_subreg #( |
| .DW (1), |
| .SwAccess(prim_subreg_pkg::SwAccessW0C), |
| .RESVAL (1'h1) |
| ) u_ctrl_aux_regwen ( |
| .clk_i (clk_i), |
| .rst_ni (rst_ni), |
| |
| // from register interface |
| .we (ctrl_aux_regwen_we), |
| .wd (ctrl_aux_regwen_wd), |
| |
| // from internal hardware |
| .de (1'b0), |
| .d ('0), |
| |
| // to internal hardware |
| .qe (), |
| .q (), |
| .ds (), |
| |
| // to register interface (read) |
| .qs (ctrl_aux_regwen_qs) |
| ); |
| |
| |
| // R[trigger]: V(False) |
| // F[start]: 0:0 |
| prim_subreg #( |
| .DW (1), |
| .SwAccess(prim_subreg_pkg::SwAccessWO), |
| .RESVAL (1'h0) |
| ) u_trigger_start ( |
| .clk_i (clk_i), |
| .rst_ni (rst_ni), |
| |
| // from register interface |
| .we (trigger_we), |
| .wd (trigger_start_wd), |
| |
| // from internal hardware |
| .de (hw2reg.trigger.start.de), |
| .d (hw2reg.trigger.start.d), |
| |
| // to internal hardware |
| .qe (), |
| .q (reg2hw.trigger.start.q), |
| .ds (), |
| |
| // to register interface (read) |
| .qs () |
| ); |
| |
| // F[key_iv_data_in_clear]: 1:1 |
| prim_subreg #( |
| .DW (1), |
| .SwAccess(prim_subreg_pkg::SwAccessWO), |
| .RESVAL (1'h1) |
| ) u_trigger_key_iv_data_in_clear ( |
| .clk_i (clk_i), |
| .rst_ni (rst_ni), |
| |
| // from register interface |
| .we (trigger_we), |
| .wd (trigger_key_iv_data_in_clear_wd), |
| |
| // from internal hardware |
| .de (hw2reg.trigger.key_iv_data_in_clear.de), |
| .d (hw2reg.trigger.key_iv_data_in_clear.d), |
| |
| // to internal hardware |
| .qe (), |
| .q (reg2hw.trigger.key_iv_data_in_clear.q), |
| .ds (), |
| |
| // to register interface (read) |
| .qs () |
| ); |
| |
| // F[data_out_clear]: 2:2 |
| prim_subreg #( |
| .DW (1), |
| .SwAccess(prim_subreg_pkg::SwAccessWO), |
| .RESVAL (1'h1) |
| ) u_trigger_data_out_clear ( |
| .clk_i (clk_i), |
| .rst_ni (rst_ni), |
| |
| // from register interface |
| .we (trigger_we), |
| .wd (trigger_data_out_clear_wd), |
| |
| // from internal hardware |
| .de (hw2reg.trigger.data_out_clear.de), |
| .d (hw2reg.trigger.data_out_clear.d), |
| |
| // to internal hardware |
| .qe (), |
| .q (reg2hw.trigger.data_out_clear.q), |
| .ds (), |
| |
| // to register interface (read) |
| .qs () |
| ); |
| |
| // F[prng_reseed]: 3:3 |
| prim_subreg #( |
| .DW (1), |
| .SwAccess(prim_subreg_pkg::SwAccessWO), |
| .RESVAL (1'h1) |
| ) u_trigger_prng_reseed ( |
| .clk_i (clk_i), |
| .rst_ni (rst_ni), |
| |
| // from register interface |
| .we (trigger_we), |
| .wd (trigger_prng_reseed_wd), |
| |
| // from internal hardware |
| .de (hw2reg.trigger.prng_reseed.de), |
| .d (hw2reg.trigger.prng_reseed.d), |
| |
| // to internal hardware |
| .qe (), |
| .q (reg2hw.trigger.prng_reseed.q), |
| .ds (), |
| |
| // to register interface (read) |
| .qs () |
| ); |
| |
| |
| // R[status]: V(False) |
| // F[idle]: 0:0 |
| prim_subreg #( |
| .DW (1), |
| .SwAccess(prim_subreg_pkg::SwAccessRO), |
| .RESVAL (1'h0) |
| ) u_status_idle ( |
| .clk_i (clk_i), |
| .rst_ni (rst_ni), |
| |
| // from register interface |
| .we (1'b0), |
| .wd ('0), |
| |
| // from internal hardware |
| .de (hw2reg.status.idle.de), |
| .d (hw2reg.status.idle.d), |
| |
| // to internal hardware |
| .qe (), |
| .q (reg2hw.status.idle.q), |
| .ds (), |
| |
| // to register interface (read) |
| .qs (status_idle_qs) |
| ); |
| |
| // F[stall]: 1:1 |
| prim_subreg #( |
| .DW (1), |
| .SwAccess(prim_subreg_pkg::SwAccessRO), |
| .RESVAL (1'h0) |
| ) u_status_stall ( |
| .clk_i (clk_i), |
| .rst_ni (rst_ni), |
| |
| // from register interface |
| .we (1'b0), |
| .wd ('0), |
| |
| // from internal hardware |
| .de (hw2reg.status.stall.de), |
| .d (hw2reg.status.stall.d), |
| |
| // to internal hardware |
| .qe (), |
| .q (), |
| .ds (), |
| |
| // to register interface (read) |
| .qs (status_stall_qs) |
| ); |
| |
| // F[output_lost]: 2:2 |
| prim_subreg #( |
| .DW (1), |
| .SwAccess(prim_subreg_pkg::SwAccessRO), |
| .RESVAL (1'h0) |
| ) u_status_output_lost ( |
| .clk_i (clk_i), |
| .rst_ni (rst_ni), |
| |
| // from register interface |
| .we (1'b0), |
| .wd ('0), |
| |
| // from internal hardware |
| .de (hw2reg.status.output_lost.de), |
| .d (hw2reg.status.output_lost.d), |
| |
| // to internal hardware |
| .qe (), |
| .q (reg2hw.status.output_lost.q), |
| .ds (), |
| |
| // to register interface (read) |
| .qs (status_output_lost_qs) |
| ); |
| |
| // F[output_valid]: 3:3 |
| prim_subreg #( |
| .DW (1), |
| .SwAccess(prim_subreg_pkg::SwAccessRO), |
| .RESVAL (1'h0) |
| ) u_status_output_valid ( |
| .clk_i (clk_i), |
| .rst_ni (rst_ni), |
| |
| // from register interface |
| .we (1'b0), |
| .wd ('0), |
| |
| // from internal hardware |
| .de (hw2reg.status.output_valid.de), |
| .d (hw2reg.status.output_valid.d), |
| |
| // to internal hardware |
| .qe (), |
| .q (), |
| .ds (), |
| |
| // to register interface (read) |
| .qs (status_output_valid_qs) |
| ); |
| |
| // F[input_ready]: 4:4 |
| prim_subreg #( |
| .DW (1), |
| .SwAccess(prim_subreg_pkg::SwAccessRO), |
| .RESVAL (1'h0) |
| ) u_status_input_ready ( |
| .clk_i (clk_i), |
| .rst_ni (rst_ni), |
| |
| // from register interface |
| .we (1'b0), |
| .wd ('0), |
| |
| // from internal hardware |
| .de (hw2reg.status.input_ready.de), |
| .d (hw2reg.status.input_ready.d), |
| |
| // to internal hardware |
| .qe (), |
| .q (), |
| .ds (), |
| |
| // to register interface (read) |
| .qs (status_input_ready_qs) |
| ); |
| |
| // F[alert_recov_ctrl_update_err]: 5:5 |
| prim_subreg #( |
| .DW (1), |
| .SwAccess(prim_subreg_pkg::SwAccessRO), |
| .RESVAL (1'h0) |
| ) u_status_alert_recov_ctrl_update_err ( |
| .clk_i (clk_i), |
| .rst_ni (rst_ni), |
| |
| // from register interface |
| .we (1'b0), |
| .wd ('0), |
| |
| // from internal hardware |
| .de (hw2reg.status.alert_recov_ctrl_update_err.de), |
| .d (hw2reg.status.alert_recov_ctrl_update_err.d), |
| |
| // to internal hardware |
| .qe (), |
| .q (), |
| .ds (), |
| |
| // to register interface (read) |
| .qs (status_alert_recov_ctrl_update_err_qs) |
| ); |
| |
| // F[alert_fatal_fault]: 6:6 |
| prim_subreg #( |
| .DW (1), |
| .SwAccess(prim_subreg_pkg::SwAccessRO), |
| .RESVAL (1'h0) |
| ) u_status_alert_fatal_fault ( |
| .clk_i (clk_i), |
| .rst_ni (rst_ni), |
| |
| // from register interface |
| .we (1'b0), |
| .wd ('0), |
| |
| // from internal hardware |
| .de (hw2reg.status.alert_fatal_fault.de), |
| .d (hw2reg.status.alert_fatal_fault.d), |
| |
| // to internal hardware |
| .qe (), |
| .q (), |
| .ds (), |
| |
| // to register interface (read) |
| .qs (status_alert_fatal_fault_qs) |
| ); |
| |
| |
| |
| logic [33:0] addr_hit; |
| always_comb begin |
| addr_hit = '0; |
| addr_hit[ 0] = (reg_addr == AES_ALERT_TEST_OFFSET); |
| addr_hit[ 1] = (reg_addr == AES_KEY_SHARE0_0_OFFSET); |
| addr_hit[ 2] = (reg_addr == AES_KEY_SHARE0_1_OFFSET); |
| addr_hit[ 3] = (reg_addr == AES_KEY_SHARE0_2_OFFSET); |
| addr_hit[ 4] = (reg_addr == AES_KEY_SHARE0_3_OFFSET); |
| addr_hit[ 5] = (reg_addr == AES_KEY_SHARE0_4_OFFSET); |
| addr_hit[ 6] = (reg_addr == AES_KEY_SHARE0_5_OFFSET); |
| addr_hit[ 7] = (reg_addr == AES_KEY_SHARE0_6_OFFSET); |
| addr_hit[ 8] = (reg_addr == AES_KEY_SHARE0_7_OFFSET); |
| addr_hit[ 9] = (reg_addr == AES_KEY_SHARE1_0_OFFSET); |
| addr_hit[10] = (reg_addr == AES_KEY_SHARE1_1_OFFSET); |
| addr_hit[11] = (reg_addr == AES_KEY_SHARE1_2_OFFSET); |
| addr_hit[12] = (reg_addr == AES_KEY_SHARE1_3_OFFSET); |
| addr_hit[13] = (reg_addr == AES_KEY_SHARE1_4_OFFSET); |
| addr_hit[14] = (reg_addr == AES_KEY_SHARE1_5_OFFSET); |
| addr_hit[15] = (reg_addr == AES_KEY_SHARE1_6_OFFSET); |
| addr_hit[16] = (reg_addr == AES_KEY_SHARE1_7_OFFSET); |
| addr_hit[17] = (reg_addr == AES_IV_0_OFFSET); |
| addr_hit[18] = (reg_addr == AES_IV_1_OFFSET); |
| addr_hit[19] = (reg_addr == AES_IV_2_OFFSET); |
| addr_hit[20] = (reg_addr == AES_IV_3_OFFSET); |
| addr_hit[21] = (reg_addr == AES_DATA_IN_0_OFFSET); |
| addr_hit[22] = (reg_addr == AES_DATA_IN_1_OFFSET); |
| addr_hit[23] = (reg_addr == AES_DATA_IN_2_OFFSET); |
| addr_hit[24] = (reg_addr == AES_DATA_IN_3_OFFSET); |
| addr_hit[25] = (reg_addr == AES_DATA_OUT_0_OFFSET); |
| addr_hit[26] = (reg_addr == AES_DATA_OUT_1_OFFSET); |
| addr_hit[27] = (reg_addr == AES_DATA_OUT_2_OFFSET); |
| addr_hit[28] = (reg_addr == AES_DATA_OUT_3_OFFSET); |
| addr_hit[29] = (reg_addr == AES_CTRL_SHADOWED_OFFSET); |
| addr_hit[30] = (reg_addr == AES_CTRL_AUX_SHADOWED_OFFSET); |
| addr_hit[31] = (reg_addr == AES_CTRL_AUX_REGWEN_OFFSET); |
| addr_hit[32] = (reg_addr == AES_TRIGGER_OFFSET); |
| addr_hit[33] = (reg_addr == AES_STATUS_OFFSET); |
| end |
| |
| assign addrmiss = (reg_re || reg_we) ? ~|addr_hit : 1'b0 ; |
| |
| // Check sub-word write is permitted |
| always_comb begin |
| wr_err = (reg_we & |
| ((addr_hit[ 0] & (|(AES_PERMIT[ 0] & ~reg_be))) | |
| (addr_hit[ 1] & (|(AES_PERMIT[ 1] & ~reg_be))) | |
| (addr_hit[ 2] & (|(AES_PERMIT[ 2] & ~reg_be))) | |
| (addr_hit[ 3] & (|(AES_PERMIT[ 3] & ~reg_be))) | |
| (addr_hit[ 4] & (|(AES_PERMIT[ 4] & ~reg_be))) | |
| (addr_hit[ 5] & (|(AES_PERMIT[ 5] & ~reg_be))) | |
| (addr_hit[ 6] & (|(AES_PERMIT[ 6] & ~reg_be))) | |
| (addr_hit[ 7] & (|(AES_PERMIT[ 7] & ~reg_be))) | |
| (addr_hit[ 8] & (|(AES_PERMIT[ 8] & ~reg_be))) | |
| (addr_hit[ 9] & (|(AES_PERMIT[ 9] & ~reg_be))) | |
| (addr_hit[10] & (|(AES_PERMIT[10] & ~reg_be))) | |
| (addr_hit[11] & (|(AES_PERMIT[11] & ~reg_be))) | |
| (addr_hit[12] & (|(AES_PERMIT[12] & ~reg_be))) | |
| (addr_hit[13] & (|(AES_PERMIT[13] & ~reg_be))) | |
| (addr_hit[14] & (|(AES_PERMIT[14] & ~reg_be))) | |
| (addr_hit[15] & (|(AES_PERMIT[15] & ~reg_be))) | |
| (addr_hit[16] & (|(AES_PERMIT[16] & ~reg_be))) | |
| (addr_hit[17] & (|(AES_PERMIT[17] & ~reg_be))) | |
| (addr_hit[18] & (|(AES_PERMIT[18] & ~reg_be))) | |
| (addr_hit[19] & (|(AES_PERMIT[19] & ~reg_be))) | |
| (addr_hit[20] & (|(AES_PERMIT[20] & ~reg_be))) | |
| (addr_hit[21] & (|(AES_PERMIT[21] & ~reg_be))) | |
| (addr_hit[22] & (|(AES_PERMIT[22] & ~reg_be))) | |
| (addr_hit[23] & (|(AES_PERMIT[23] & ~reg_be))) | |
| (addr_hit[24] & (|(AES_PERMIT[24] & ~reg_be))) | |
| (addr_hit[25] & (|(AES_PERMIT[25] & ~reg_be))) | |
| (addr_hit[26] & (|(AES_PERMIT[26] & ~reg_be))) | |
| (addr_hit[27] & (|(AES_PERMIT[27] & ~reg_be))) | |
| (addr_hit[28] & (|(AES_PERMIT[28] & ~reg_be))) | |
| (addr_hit[29] & (|(AES_PERMIT[29] & ~reg_be))) | |
| (addr_hit[30] & (|(AES_PERMIT[30] & ~reg_be))) | |
| (addr_hit[31] & (|(AES_PERMIT[31] & ~reg_be))) | |
| (addr_hit[32] & (|(AES_PERMIT[32] & ~reg_be))) | |
| (addr_hit[33] & (|(AES_PERMIT[33] & ~reg_be))))); |
| end |
| |
| // Generate write-enables |
| assign alert_test_we = addr_hit[0] & reg_we & !reg_error; |
| |
| assign alert_test_recov_ctrl_update_err_wd = reg_wdata[0]; |
| |
| assign alert_test_fatal_fault_wd = reg_wdata[1]; |
| assign key_share0_0_we = addr_hit[1] & reg_we & !reg_error; |
| |
| assign key_share0_0_wd = reg_wdata[31:0]; |
| assign key_share0_1_we = addr_hit[2] & reg_we & !reg_error; |
| |
| assign key_share0_1_wd = reg_wdata[31:0]; |
| assign key_share0_2_we = addr_hit[3] & reg_we & !reg_error; |
| |
| assign key_share0_2_wd = reg_wdata[31:0]; |
| assign key_share0_3_we = addr_hit[4] & reg_we & !reg_error; |
| |
| assign key_share0_3_wd = reg_wdata[31:0]; |
| assign key_share0_4_we = addr_hit[5] & reg_we & !reg_error; |
| |
| assign key_share0_4_wd = reg_wdata[31:0]; |
| assign key_share0_5_we = addr_hit[6] & reg_we & !reg_error; |
| |
| assign key_share0_5_wd = reg_wdata[31:0]; |
| assign key_share0_6_we = addr_hit[7] & reg_we & !reg_error; |
| |
| assign key_share0_6_wd = reg_wdata[31:0]; |
| assign key_share0_7_we = addr_hit[8] & reg_we & !reg_error; |
| |
| assign key_share0_7_wd = reg_wdata[31:0]; |
| assign key_share1_0_we = addr_hit[9] & reg_we & !reg_error; |
| |
| assign key_share1_0_wd = reg_wdata[31:0]; |
| assign key_share1_1_we = addr_hit[10] & reg_we & !reg_error; |
| |
| assign key_share1_1_wd = reg_wdata[31:0]; |
| assign key_share1_2_we = addr_hit[11] & reg_we & !reg_error; |
| |
| assign key_share1_2_wd = reg_wdata[31:0]; |
| assign key_share1_3_we = addr_hit[12] & reg_we & !reg_error; |
| |
| assign key_share1_3_wd = reg_wdata[31:0]; |
| assign key_share1_4_we = addr_hit[13] & reg_we & !reg_error; |
| |
| assign key_share1_4_wd = reg_wdata[31:0]; |
| assign key_share1_5_we = addr_hit[14] & reg_we & !reg_error; |
| |
| assign key_share1_5_wd = reg_wdata[31:0]; |
| assign key_share1_6_we = addr_hit[15] & reg_we & !reg_error; |
| |
| assign key_share1_6_wd = reg_wdata[31:0]; |
| assign key_share1_7_we = addr_hit[16] & reg_we & !reg_error; |
| |
| assign key_share1_7_wd = reg_wdata[31:0]; |
| assign iv_0_re = addr_hit[17] & reg_re & !reg_error; |
| assign iv_0_we = addr_hit[17] & reg_we & !reg_error; |
| |
| assign iv_0_wd = reg_wdata[31:0]; |
| assign iv_1_re = addr_hit[18] & reg_re & !reg_error; |
| assign iv_1_we = addr_hit[18] & reg_we & !reg_error; |
| |
| assign iv_1_wd = reg_wdata[31:0]; |
| assign iv_2_re = addr_hit[19] & reg_re & !reg_error; |
| assign iv_2_we = addr_hit[19] & reg_we & !reg_error; |
| |
| assign iv_2_wd = reg_wdata[31:0]; |
| assign iv_3_re = addr_hit[20] & reg_re & !reg_error; |
| assign iv_3_we = addr_hit[20] & reg_we & !reg_error; |
| |
| assign iv_3_wd = reg_wdata[31:0]; |
| assign data_in_0_we = addr_hit[21] & reg_we & !reg_error; |
| |
| assign data_in_0_wd = reg_wdata[31:0]; |
| assign data_in_1_we = addr_hit[22] & reg_we & !reg_error; |
| |
| assign data_in_1_wd = reg_wdata[31:0]; |
| assign data_in_2_we = addr_hit[23] & reg_we & !reg_error; |
| |
| assign data_in_2_wd = reg_wdata[31:0]; |
| assign data_in_3_we = addr_hit[24] & reg_we & !reg_error; |
| |
| assign data_in_3_wd = reg_wdata[31:0]; |
| assign data_out_0_re = addr_hit[25] & reg_re & !reg_error; |
| assign data_out_1_re = addr_hit[26] & reg_re & !reg_error; |
| assign data_out_2_re = addr_hit[27] & reg_re & !reg_error; |
| assign data_out_3_re = addr_hit[28] & reg_re & !reg_error; |
| assign ctrl_shadowed_re = addr_hit[29] & reg_re & !reg_error; |
| assign ctrl_shadowed_we = addr_hit[29] & reg_we & !reg_error; |
| |
| assign ctrl_shadowed_operation_wd = reg_wdata[1:0]; |
| |
| assign ctrl_shadowed_mode_wd = reg_wdata[7:2]; |
| |
| assign ctrl_shadowed_key_len_wd = reg_wdata[10:8]; |
| |
| assign ctrl_shadowed_sideload_wd = reg_wdata[11]; |
| |
| assign ctrl_shadowed_prng_reseed_rate_wd = reg_wdata[14:12]; |
| |
| assign ctrl_shadowed_manual_operation_wd = reg_wdata[15]; |
| assign ctrl_aux_shadowed_re = addr_hit[30] & reg_re & !reg_error; |
| assign ctrl_aux_shadowed_we = addr_hit[30] & reg_we & !reg_error; |
| |
| assign ctrl_aux_shadowed_key_touch_forces_reseed_wd = reg_wdata[0]; |
| |
| assign ctrl_aux_shadowed_force_masks_wd = reg_wdata[1]; |
| assign ctrl_aux_regwen_we = addr_hit[31] & reg_we & !reg_error; |
| |
| assign ctrl_aux_regwen_wd = reg_wdata[0]; |
| assign trigger_we = addr_hit[32] & reg_we & !reg_error; |
| |
| assign trigger_start_wd = reg_wdata[0]; |
| |
| assign trigger_key_iv_data_in_clear_wd = reg_wdata[1]; |
| |
| assign trigger_data_out_clear_wd = reg_wdata[2]; |
| |
| assign trigger_prng_reseed_wd = reg_wdata[3]; |
| |
| // Assign write-enables to checker logic vector. |
| always_comb begin |
| reg_we_check = '0; |
| reg_we_check[0] = alert_test_we; |
| reg_we_check[1] = key_share0_0_we; |
| reg_we_check[2] = key_share0_1_we; |
| reg_we_check[3] = key_share0_2_we; |
| reg_we_check[4] = key_share0_3_we; |
| reg_we_check[5] = key_share0_4_we; |
| reg_we_check[6] = key_share0_5_we; |
| reg_we_check[7] = key_share0_6_we; |
| reg_we_check[8] = key_share0_7_we; |
| reg_we_check[9] = key_share1_0_we; |
| reg_we_check[10] = key_share1_1_we; |
| reg_we_check[11] = key_share1_2_we; |
| reg_we_check[12] = key_share1_3_we; |
| reg_we_check[13] = key_share1_4_we; |
| reg_we_check[14] = key_share1_5_we; |
| reg_we_check[15] = key_share1_6_we; |
| reg_we_check[16] = key_share1_7_we; |
| reg_we_check[17] = iv_0_we; |
| reg_we_check[18] = iv_1_we; |
| reg_we_check[19] = iv_2_we; |
| reg_we_check[20] = iv_3_we; |
| reg_we_check[21] = data_in_0_we; |
| reg_we_check[22] = data_in_1_we; |
| reg_we_check[23] = data_in_2_we; |
| reg_we_check[24] = data_in_3_we; |
| reg_we_check[25] = 1'b0; |
| reg_we_check[26] = 1'b0; |
| reg_we_check[27] = 1'b0; |
| reg_we_check[28] = 1'b0; |
| reg_we_check[29] = ctrl_shadowed_we; |
| reg_we_check[30] = ctrl_aux_shadowed_gated_we; |
| reg_we_check[31] = ctrl_aux_regwen_we; |
| reg_we_check[32] = trigger_we; |
| reg_we_check[33] = 1'b0; |
| end |
| |
| // Read data return |
| always_comb begin |
| reg_rdata_next = '0; |
| unique case (1'b1) |
| addr_hit[0]: begin |
| reg_rdata_next[0] = '0; |
| reg_rdata_next[1] = '0; |
| end |
| |
| addr_hit[1]: begin |
| reg_rdata_next[31:0] = '0; |
| end |
| |
| addr_hit[2]: begin |
| reg_rdata_next[31:0] = '0; |
| end |
| |
| addr_hit[3]: begin |
| reg_rdata_next[31:0] = '0; |
| end |
| |
| addr_hit[4]: begin |
| reg_rdata_next[31:0] = '0; |
| end |
| |
| addr_hit[5]: begin |
| reg_rdata_next[31:0] = '0; |
| end |
| |
| addr_hit[6]: begin |
| reg_rdata_next[31:0] = '0; |
| end |
| |
| addr_hit[7]: begin |
| reg_rdata_next[31:0] = '0; |
| end |
| |
| addr_hit[8]: begin |
| reg_rdata_next[31:0] = '0; |
| end |
| |
| addr_hit[9]: begin |
| reg_rdata_next[31:0] = '0; |
| end |
| |
| addr_hit[10]: begin |
| reg_rdata_next[31:0] = '0; |
| end |
| |
| addr_hit[11]: begin |
| reg_rdata_next[31:0] = '0; |
| end |
| |
| addr_hit[12]: begin |
| reg_rdata_next[31:0] = '0; |
| end |
| |
| addr_hit[13]: begin |
| reg_rdata_next[31:0] = '0; |
| end |
| |
| addr_hit[14]: begin |
| reg_rdata_next[31:0] = '0; |
| end |
| |
| addr_hit[15]: begin |
| reg_rdata_next[31:0] = '0; |
| end |
| |
| addr_hit[16]: begin |
| reg_rdata_next[31:0] = '0; |
| end |
| |
| addr_hit[17]: begin |
| reg_rdata_next[31:0] = iv_0_qs; |
| end |
| |
| addr_hit[18]: begin |
| reg_rdata_next[31:0] = iv_1_qs; |
| end |
| |
| addr_hit[19]: begin |
| reg_rdata_next[31:0] = iv_2_qs; |
| end |
| |
| addr_hit[20]: begin |
| reg_rdata_next[31:0] = iv_3_qs; |
| end |
| |
| addr_hit[21]: begin |
| reg_rdata_next[31:0] = '0; |
| end |
| |
| addr_hit[22]: begin |
| reg_rdata_next[31:0] = '0; |
| end |
| |
| addr_hit[23]: begin |
| reg_rdata_next[31:0] = '0; |
| end |
| |
| addr_hit[24]: begin |
| reg_rdata_next[31:0] = '0; |
| end |
| |
| addr_hit[25]: begin |
| reg_rdata_next[31:0] = data_out_0_qs; |
| end |
| |
| addr_hit[26]: begin |
| reg_rdata_next[31:0] = data_out_1_qs; |
| end |
| |
| addr_hit[27]: begin |
| reg_rdata_next[31:0] = data_out_2_qs; |
| end |
| |
| addr_hit[28]: begin |
| reg_rdata_next[31:0] = data_out_3_qs; |
| end |
| |
| addr_hit[29]: begin |
| reg_rdata_next[1:0] = ctrl_shadowed_operation_qs; |
| reg_rdata_next[7:2] = ctrl_shadowed_mode_qs; |
| reg_rdata_next[10:8] = ctrl_shadowed_key_len_qs; |
| reg_rdata_next[11] = ctrl_shadowed_sideload_qs; |
| reg_rdata_next[14:12] = ctrl_shadowed_prng_reseed_rate_qs; |
| reg_rdata_next[15] = ctrl_shadowed_manual_operation_qs; |
| end |
| |
| addr_hit[30]: begin |
| reg_rdata_next[0] = ctrl_aux_shadowed_key_touch_forces_reseed_qs; |
| reg_rdata_next[1] = ctrl_aux_shadowed_force_masks_qs; |
| end |
| |
| addr_hit[31]: begin |
| reg_rdata_next[0] = ctrl_aux_regwen_qs; |
| end |
| |
| addr_hit[32]: begin |
| reg_rdata_next[0] = '0; |
| reg_rdata_next[1] = '0; |
| reg_rdata_next[2] = '0; |
| reg_rdata_next[3] = '0; |
| end |
| |
| addr_hit[33]: begin |
| reg_rdata_next[0] = status_idle_qs; |
| reg_rdata_next[1] = status_stall_qs; |
| reg_rdata_next[2] = status_output_lost_qs; |
| reg_rdata_next[3] = status_output_valid_qs; |
| reg_rdata_next[4] = status_input_ready_qs; |
| reg_rdata_next[5] = status_alert_recov_ctrl_update_err_qs; |
| reg_rdata_next[6] = status_alert_fatal_fault_qs; |
| end |
| |
| default: begin |
| reg_rdata_next = '1; |
| end |
| endcase |
| end |
| |
| // shadow busy |
| logic shadow_busy; |
| logic rst_done; |
| logic shadow_rst_done; |
| always_ff @(posedge clk_i or negedge rst_ni) begin |
| if (!rst_ni) begin |
| rst_done <= '0; |
| end else begin |
| rst_done <= 1'b1; |
| end |
| end |
| |
| always_ff @(posedge clk_i or negedge rst_shadowed_ni) begin |
| if (!rst_shadowed_ni) begin |
| shadow_rst_done <= '0; |
| end else begin |
| shadow_rst_done <= 1'b1; |
| end |
| end |
| |
| // both shadow and normal resets have been released |
| assign shadow_busy = ~(rst_done & shadow_rst_done); |
| |
| // Collect up storage and update errors |
| assign shadowed_storage_err_o = |{ |
| ctrl_aux_shadowed_key_touch_forces_reseed_storage_err, |
| ctrl_aux_shadowed_force_masks_storage_err |
| }; |
| assign shadowed_update_err_o = |{ |
| ctrl_aux_shadowed_key_touch_forces_reseed_update_err, |
| ctrl_aux_shadowed_force_masks_update_err |
| }; |
| |
| // register busy |
| assign reg_busy = shadow_busy; |
| |
| // Unused signal tieoff |
| |
| // wdata / byte enable are not always fully used |
| // add a blanket unused statement to handle lint waivers |
| logic unused_wdata; |
| logic unused_be; |
| assign unused_wdata = ^reg_wdata; |
| assign unused_be = ^reg_be; |
| |
| // Assertions for Register Interface |
| `ASSERT_PULSE(wePulse, reg_we, clk_i, !rst_ni) |
| `ASSERT_PULSE(rePulse, reg_re, clk_i, !rst_ni) |
| |
| `ASSERT(reAfterRv, $rose(reg_re || reg_we) |=> tl_o_pre.d_valid, clk_i, !rst_ni) |
| |
| `ASSERT(en2addrHit, (reg_we || reg_re) |-> $onehot0(addr_hit), clk_i, !rst_ni) |
| |
| // this is formulated as an assumption such that the FPV testbenches do disprove this |
| // property by mistake |
| //`ASSUME(reqParity, tl_reg_h2d.a_valid |-> tl_reg_h2d.a_user.chk_en == tlul_pkg::CheckDis) |
| |
| endmodule |