From e9626d52866d332d5866f36b404a773363d3e64b Mon Sep 17 00:00:00 2001 From: Kai Berszin Date: Mon, 8 Dec 2025 13:39:37 +0100 Subject: [PATCH 1/2] sw: Fix runtime routine Fix runtime exit routine not recovering return address correctly --- sw/snRuntime/src/platforms/cheshire/start_snitch.S | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sw/snRuntime/src/platforms/cheshire/start_snitch.S b/sw/snRuntime/src/platforms/cheshire/start_snitch.S index 4fc46d4e..2e643355 100644 --- a/sw/snRuntime/src/platforms/cheshire/start_snitch.S +++ b/sw/snRuntime/src/platforms/cheshire/start_snitch.S @@ -25,8 +25,17 @@ _snrt_exit: # - a0: global core index # - t0: exit code bnez a0, 1f + addi sp, sp, -8 + sw a0, 0(sp) + sw ra, 4(sp) + slli t0, t0, 1 ori t0, t0, 1 mv a0, t0 call snrt_set_eoc_and_return_code + + lw t0, 0(sp) + lw ra, 4(sp) + addi sp, sp, 8 + 1: ret From ba867913bf340a7b476732f9fb72a8d40418dcd6 Mon Sep 17 00:00:00 2001 From: Kai Berszin Date: Fri, 19 Dec 2025 16:19:39 +0100 Subject: [PATCH 2/2] sw: Fix multi-cluster setting EOC correctly Use cluster local core ID for determining which core is to set EOC instead of global one. This fixes multi-cluster configurations not setting the EOC correctly on cluster != 0 --- .../src/generated/spatz_cluster_wrapper.sv | 5 ++++- hw/system/spatz_cluster/test/bootrom.elf | Bin 5320 -> 5320 bytes .../src/platforms/cheshire/start_snitch.S | 2 +- .../src/platforms/standalone/start_snitch.S | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/system/spatz_cluster/src/generated/spatz_cluster_wrapper.sv b/hw/system/spatz_cluster/src/generated/spatz_cluster_wrapper.sv index dc4519e7..f9140f44 100644 --- a/hw/system/spatz_cluster/src/generated/spatz_cluster_wrapper.sv +++ b/hw/system/spatz_cluster/src/generated/spatz_cluster_wrapper.sv @@ -58,7 +58,7 @@ package spatz_cluster_pkg; localparam int unsigned TCDMStartAddr = 32'h100000; localparam int unsigned TCDMSize = 32'h20000; - + localparam logic AddrMisalign = 1'b0; // 0-aligned, 1-misalign localparam int unsigned PeriStartAddr = TCDMStartAddr + TCDMSize; localparam int unsigned BootAddr = 32'h1000; @@ -243,6 +243,7 @@ module spatz_cluster_wrapper localparam int unsigned NumSpatzOutstandingLoads [NumCores] = '{4, 4}; localparam int unsigned NumSpatzFPUs [NumCores] = '{default: 4}; localparam int unsigned NumSpatzIPUs [NumCores] = '{default: 1}; + localparam int unsigned NumSpatzTCDMPorts [NumCores] = '{default: 4}; typedef logic [IwcAxiIdOutWidth-1:0] axi_id_out_iwc_t; @@ -302,6 +303,8 @@ module spatz_cluster_wrapper .NumSpatzOutstandingLoads (NumSpatzOutstandingLoads), .NumSpatzFPUs (NumSpatzFPUs), .NumSpatzIPUs (NumSpatzIPUs), + .NumSpatzTCDMPorts (NumSpatzTCDMPorts), + .AddrMisalign (AddrMisalign), .axi_in_req_t (axi_in_req_t), .axi_in_resp_t (axi_in_resp_t), .axi_out_req_t (spatz_axi_iwc_out_req_t), diff --git a/hw/system/spatz_cluster/test/bootrom.elf b/hw/system/spatz_cluster/test/bootrom.elf index 221918581a230b75be0611e500dc8cb6f2c90674..fe5a3eaea23eb162e533c524809ef9829f457344 100755 GIT binary patch delta 18 ZcmX@1c|vo;R3TQQu