diff --git a/hw/system/spatz_cluster/src/spatz_cluster_peripheral/spatz_cluster_peripheral_reg.hjson b/hw/system/spatz_cluster/src/spatz_cluster_peripheral/spatz_cluster_peripheral_reg.hjson index c96f5ed8..a722ddeb 100644 --- a/hw/system/spatz_cluster/src/spatz_cluster_peripheral/spatz_cluster_peripheral_reg.hjson +++ b/hw/system/spatz_cluster/src/spatz_cluster_peripheral/spatz_cluster_peripheral_reg.hjson @@ -426,6 +426,18 @@ name: "ENTRY_POINT", desc: "Post-bootstrapping entry point." }] + }, + { + name: "CLUSTER_EOC_EXIT", + desc: '''End of computation and exit status register''' + swaccess: "rw", + hwaccess: "hro", + resval: "0", + fields: [{ + bits: "31:0", + name: "EOC_EXIT", + desc: "Indicates the end of computation and exit status." + }] } ] } diff --git a/hw/system/spatz_cluster/src/spatz_cluster_peripheral/spatz_cluster_peripheral_reg_pkg.sv b/hw/system/spatz_cluster/src/spatz_cluster_peripheral/spatz_cluster_peripheral_reg_pkg.sv index 1ae776d5..0272383c 100644 --- a/hw/system/spatz_cluster/src/spatz_cluster_peripheral/spatz_cluster_peripheral_reg_pkg.sv +++ b/hw/system/spatz_cluster/src/spatz_cluster_peripheral/spatz_cluster_peripheral_reg_pkg.sv @@ -147,6 +147,10 @@ package spatz_cluster_peripheral_reg_pkg; logic [31:0] q; } spatz_cluster_peripheral_reg2hw_cluster_boot_control_reg_t; + typedef struct packed { + logic [31:0] q; + } spatz_cluster_peripheral_reg2hw_cluster_eoc_exit_reg_t; + typedef struct packed { logic [47:0] d; } spatz_cluster_peripheral_hw2reg_perf_counter_mreg_t; @@ -157,15 +161,16 @@ package spatz_cluster_peripheral_reg_pkg; // Register -> HW type typedef struct packed { - spatz_cluster_peripheral_reg2hw_perf_counter_enable_mreg_t [1:0] perf_counter_enable; // [311:250] - spatz_cluster_peripheral_reg2hw_hart_select_mreg_t [1:0] hart_select; // [249:230] - spatz_cluster_peripheral_reg2hw_perf_counter_mreg_t [1:0] perf_counter; // [229:132] - spatz_cluster_peripheral_reg2hw_cl_clint_set_reg_t cl_clint_set; // [131:99] - spatz_cluster_peripheral_reg2hw_cl_clint_clear_reg_t cl_clint_clear; // [98:66] - spatz_cluster_peripheral_reg2hw_hw_barrier_reg_t hw_barrier; // [65:34] - spatz_cluster_peripheral_reg2hw_icache_prefetch_enable_reg_t icache_prefetch_enable; // [33:33] - spatz_cluster_peripheral_reg2hw_spatz_status_reg_t spatz_status; // [32:32] - spatz_cluster_peripheral_reg2hw_cluster_boot_control_reg_t cluster_boot_control; // [31:0] + spatz_cluster_peripheral_reg2hw_perf_counter_enable_mreg_t [1:0] perf_counter_enable; // [343:282] + spatz_cluster_peripheral_reg2hw_hart_select_mreg_t [1:0] hart_select; // [281:262] + spatz_cluster_peripheral_reg2hw_perf_counter_mreg_t [1:0] perf_counter; // [261:164] + spatz_cluster_peripheral_reg2hw_cl_clint_set_reg_t cl_clint_set; // [163:131] + spatz_cluster_peripheral_reg2hw_cl_clint_clear_reg_t cl_clint_clear; // [130:98] + spatz_cluster_peripheral_reg2hw_hw_barrier_reg_t hw_barrier; // [97:66] + spatz_cluster_peripheral_reg2hw_icache_prefetch_enable_reg_t icache_prefetch_enable; // [65:65] + spatz_cluster_peripheral_reg2hw_spatz_status_reg_t spatz_status; // [64:64] + spatz_cluster_peripheral_reg2hw_cluster_boot_control_reg_t cluster_boot_control; // [63:32] + spatz_cluster_peripheral_reg2hw_cluster_eoc_exit_reg_t cluster_eoc_exit; // [31:0] } spatz_cluster_peripheral_reg2hw_t; // HW -> register type @@ -187,6 +192,7 @@ package spatz_cluster_peripheral_reg_pkg; parameter logic [BlockAw-1:0] SPATZ_CLUSTER_PERIPHERAL_ICACHE_PREFETCH_ENABLE_OFFSET = 7'h 48; parameter logic [BlockAw-1:0] SPATZ_CLUSTER_PERIPHERAL_SPATZ_STATUS_OFFSET = 7'h 50; parameter logic [BlockAw-1:0] SPATZ_CLUSTER_PERIPHERAL_CLUSTER_BOOT_CONTROL_OFFSET = 7'h 58; + parameter logic [BlockAw-1:0] SPATZ_CLUSTER_PERIPHERAL_CLUSTER_EOC_EXIT_OFFSET = 7'h 60; // Reset values for hwext registers and their fields parameter logic [47:0] SPATZ_CLUSTER_PERIPHERAL_PERF_COUNTER_0_RESVAL = 48'h 0; @@ -208,11 +214,12 @@ package spatz_cluster_peripheral_reg_pkg; SPATZ_CLUSTER_PERIPHERAL_HW_BARRIER, SPATZ_CLUSTER_PERIPHERAL_ICACHE_PREFETCH_ENABLE, SPATZ_CLUSTER_PERIPHERAL_SPATZ_STATUS, - SPATZ_CLUSTER_PERIPHERAL_CLUSTER_BOOT_CONTROL + SPATZ_CLUSTER_PERIPHERAL_CLUSTER_BOOT_CONTROL, + SPATZ_CLUSTER_PERIPHERAL_CLUSTER_EOC_EXIT } spatz_cluster_peripheral_id_e; // Register width information to check illegal writes - parameter logic [3:0] SPATZ_CLUSTER_PERIPHERAL_PERMIT [12] = '{ + parameter logic [3:0] SPATZ_CLUSTER_PERIPHERAL_PERMIT [13] = '{ 4'b 1111, // index[ 0] SPATZ_CLUSTER_PERIPHERAL_PERF_COUNTER_ENABLE_0 4'b 1111, // index[ 1] SPATZ_CLUSTER_PERIPHERAL_PERF_COUNTER_ENABLE_1 4'b 0011, // index[ 2] SPATZ_CLUSTER_PERIPHERAL_HART_SELECT_0 @@ -224,7 +231,8 @@ package spatz_cluster_peripheral_reg_pkg; 4'b 1111, // index[ 8] SPATZ_CLUSTER_PERIPHERAL_HW_BARRIER 4'b 0001, // index[ 9] SPATZ_CLUSTER_PERIPHERAL_ICACHE_PREFETCH_ENABLE 4'b 0001, // index[10] SPATZ_CLUSTER_PERIPHERAL_SPATZ_STATUS - 4'b 1111 // index[11] SPATZ_CLUSTER_PERIPHERAL_CLUSTER_BOOT_CONTROL + 4'b 1111, // index[11] SPATZ_CLUSTER_PERIPHERAL_CLUSTER_BOOT_CONTROL + 4'b 1111 // index[12] SPATZ_CLUSTER_PERIPHERAL_CLUSTER_EOC_EXIT }; endpackage diff --git a/hw/system/spatz_cluster/src/spatz_cluster_peripheral/spatz_cluster_peripheral_reg_top.sv b/hw/system/spatz_cluster/src/spatz_cluster_peripheral/spatz_cluster_peripheral_reg_top.sv index b5cf96a4..72d31f69 100644 --- a/hw/system/spatz_cluster/src/spatz_cluster_peripheral/spatz_cluster_peripheral_reg_top.sv +++ b/hw/system/spatz_cluster/src/spatz_cluster_peripheral/spatz_cluster_peripheral_reg_top.sv @@ -281,6 +281,9 @@ module spatz_cluster_peripheral_reg_top #( logic [31:0] cluster_boot_control_qs; logic [31:0] cluster_boot_control_wd; logic cluster_boot_control_we; + logic [31:0] cluster_eoc_exit_qs; + logic [31:0] cluster_eoc_exit_wd; + logic cluster_eoc_exit_we; // Register instances @@ -2120,9 +2123,36 @@ module spatz_cluster_peripheral_reg_top #( ); + // R[cluster_eoc_exit]: V(False) + prim_subreg #( + .DW (32), + .SWACCESS("RW"), + .RESVAL (32'h0) + ) u_cluster_eoc_exit ( + .clk_i (clk_i ), + .rst_ni (rst_ni ), + + // from register interface + .we (cluster_eoc_exit_we), + .wd (cluster_eoc_exit_wd), + + // from internal hardware + .de (1'b0), + .d ('0 ), - logic [11:0] addr_hit; + // to internal hardware + .qe (), + .q (reg2hw.cluster_eoc_exit.q ), + + // to register interface (read) + .qs (cluster_eoc_exit_qs) + ); + + + + + logic [12:0] addr_hit; always_comb begin addr_hit = '0; addr_hit[ 0] = (reg_addr == SPATZ_CLUSTER_PERIPHERAL_PERF_COUNTER_ENABLE_0_OFFSET); @@ -2137,6 +2167,7 @@ module spatz_cluster_peripheral_reg_top #( addr_hit[ 9] = (reg_addr == SPATZ_CLUSTER_PERIPHERAL_ICACHE_PREFETCH_ENABLE_OFFSET); addr_hit[10] = (reg_addr == SPATZ_CLUSTER_PERIPHERAL_SPATZ_STATUS_OFFSET); addr_hit[11] = (reg_addr == SPATZ_CLUSTER_PERIPHERAL_CLUSTER_BOOT_CONTROL_OFFSET); + addr_hit[12] = (reg_addr == SPATZ_CLUSTER_PERIPHERAL_CLUSTER_EOC_EXIT_OFFSET); end assign addrmiss = (reg_re || reg_we) ? ~|addr_hit : 1'b0 ; @@ -2155,7 +2186,8 @@ module spatz_cluster_peripheral_reg_top #( (addr_hit[ 8] & (|(SPATZ_CLUSTER_PERIPHERAL_PERMIT[ 8] & ~reg_be))) | (addr_hit[ 9] & (|(SPATZ_CLUSTER_PERIPHERAL_PERMIT[ 9] & ~reg_be))) | (addr_hit[10] & (|(SPATZ_CLUSTER_PERIPHERAL_PERMIT[10] & ~reg_be))) | - (addr_hit[11] & (|(SPATZ_CLUSTER_PERIPHERAL_PERMIT[11] & ~reg_be))))); + (addr_hit[11] & (|(SPATZ_CLUSTER_PERIPHERAL_PERMIT[11] & ~reg_be))) | + (addr_hit[12] & (|(SPATZ_CLUSTER_PERIPHERAL_PERMIT[12] & ~reg_be))))); end assign perf_counter_enable_0_cycle_0_we = addr_hit[0] & reg_we & !reg_error; @@ -2375,6 +2407,9 @@ module spatz_cluster_peripheral_reg_top #( assign cluster_boot_control_we = addr_hit[11] & reg_we & !reg_error; assign cluster_boot_control_wd = reg_wdata[31:0]; + assign cluster_eoc_exit_we = addr_hit[12] & reg_we & !reg_error; + assign cluster_eoc_exit_wd = reg_wdata[31:0]; + // Read data return always_comb begin reg_rdata_next = '0; @@ -2487,6 +2522,10 @@ module spatz_cluster_peripheral_reg_top #( reg_rdata_next[31:0] = cluster_boot_control_qs; end + addr_hit[12]: begin + reg_rdata_next[31:0] = cluster_eoc_exit_qs; + end + default: begin reg_rdata_next = '1; end