Skip to content

Commit

Permalink
HW: Refactor Cluster integration (#24)
Browse files Browse the repository at this point in the history
* HW: Refactor Cluster integration
  • Loading branch information
Scheremo authored Aug 19, 2024
1 parent 5490b52 commit 9d5c562
Show file tree
Hide file tree
Showing 10 changed files with 602 additions and 405 deletions.
6 changes: 3 additions & 3 deletions Bender.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ packages:
- common_cells
- register_interface
cheshire:
revision: 4dfba37385eae48c44080defdfaa3f580921a60c
revision: 8aa5c40f2af14f0a40ed08ba4b24c3759ae944e5
version: null
source:
Git: https://github.com/pulp-platform/cheshire.git
Expand Down Expand Up @@ -198,8 +198,8 @@ packages:
- common_verification
- tech_cells_generic
obi:
revision: c2141a653c755461ff44f61d12aeb5d99fc8e760
version: 0.1.3
revision: 5321106817e177d6c16ecc4daa922b96b1bc946b
version: 0.1.5
source:
Git: https://github.com/pulp-platform/obi.git
dependencies:
Expand Down
4 changes: 3 additions & 1 deletion Bender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package:
dependencies:
register_interface: { git: "https://github.com/pulp-platform/register_interface.git", version: 0.4.3 }
axi: { git: "https://github.com/pulp-platform/axi.git", version: 0.39.2 }
cheshire: { git: "https://github.com/pulp-platform/cheshire.git", rev: 4dfba37385eae48c44080defdfaa3f580921a60c}
cheshire: { git: "https://github.com/pulp-platform/cheshire.git", rev: 8aa5c40}
snitch_cluster: { git: "https://github.com/pulp-platform/snitch_cluster.git", rev: c12ce9b2af1ac8edf3d4feb18939e1ad20c42225}
common_cells: { git: "https://github.com/pulp-platform/common_cells.git", version: 1.31.1}
idma: { git: "https://github.com/pulp-platform/iDMA.git", rev: 9edf489f57389dce5e71252c79e337f527d3aded}
Expand All @@ -27,6 +27,8 @@ sources:
- hw/bootrom/snitch/snitch_bootrom.sv
- hw/narrow_adapter.sv
- hw/chimera_cluster_adapter.sv
- hw/chimera_cluster.sv
- hw/chimera_clu_domain.sv
- hw/chimera_top_wrapper.sv

- target: any(simulation, test)
Expand Down
24 changes: 12 additions & 12 deletions hw/bootrom/snitch/snitch_startup.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ void cluster_return(uint32_t ret) {
*((volatile uint32_t *)(SOC_CTRL_BASE + CHIMERA_SNITCH_CLUSTER_0_RETURN_REG_OFFSET)) =
retVal;
break;
case 10:
case 1 + CLUSTER_0_NUMCORES:
*((volatile uint32_t *)(SOC_CTRL_BASE + CHIMERA_SNITCH_CLUSTER_1_RETURN_REG_OFFSET)) =
retVal;
break;
case 19:
case 1 + CLUSTER_0_NUMCORES + CLUSTER_1_NUMCORES:
*((volatile uint32_t *)(SOC_CTRL_BASE + CHIMERA_SNITCH_CLUSTER_2_RETURN_REG_OFFSET)) =
retVal;
break;
case 28:
case 1 + CLUSTER_0_NUMCORES + CLUSTER_1_NUMCORES + CLUSTER_2_NUMCORES:
*((volatile uint32_t *)(SOC_CTRL_BASE + CHIMERA_SNITCH_CLUSTER_3_RETURN_REG_OFFSET)) =
retVal;
break;
case 37:
case 1 + CLUSTER_0_NUMCORES + CLUSTER_1_NUMCORES + CLUSTER_2_NUMCORES + CLUSTER_3_NUMCORES:
*((volatile uint32_t *)(SOC_CTRL_BASE + CHIMERA_SNITCH_CLUSTER_4_RETURN_REG_OFFSET)) =
retVal;
break;
Expand All @@ -74,16 +74,16 @@ void clean_busy() {
case 1:
*((volatile uint32_t *)(SOC_CTRL_BASE + CHIMERA_CLUSTER_0_BUSY_REG_OFFSET)) = 0;
break;
case 10:
case 1 + CLUSTER_0_NUMCORES:
*((volatile uint32_t *)(SOC_CTRL_BASE + CHIMERA_CLUSTER_1_BUSY_REG_OFFSET)) = 0;
break;
case 19:
case 1 + CLUSTER_0_NUMCORES + CLUSTER_1_NUMCORES:
*((volatile uint32_t *)(SOC_CTRL_BASE + CHIMERA_CLUSTER_2_BUSY_REG_OFFSET)) = 0;
break;
case 28:
case 1 + CLUSTER_0_NUMCORES + CLUSTER_1_NUMCORES + CLUSTER_2_NUMCORES:
*((volatile uint32_t *)(SOC_CTRL_BASE + CHIMERA_CLUSTER_3_BUSY_REG_OFFSET)) = 0;
break;
case 37:
case 1 + CLUSTER_0_NUMCORES + CLUSTER_1_NUMCORES + CLUSTER_2_NUMCORES + CLUSTER_3_NUMCORES:
*((volatile uint32_t *)(SOC_CTRL_BASE + CHIMERA_CLUSTER_4_BUSY_REG_OFFSET)) = 0;
break;
}
Expand All @@ -101,16 +101,16 @@ void set_busy() {
case 1:
*((volatile uint32_t *)(SOC_CTRL_BASE + CHIMERA_CLUSTER_0_BUSY_REG_OFFSET)) = 1;
break;
case 10:
case 1 + CLUSTER_0_NUMCORES:
*((volatile uint32_t *)(SOC_CTRL_BASE + CHIMERA_CLUSTER_1_BUSY_REG_OFFSET)) = 1;
break;
case 19:
case 1 + CLUSTER_0_NUMCORES + CLUSTER_1_NUMCORES:
*((volatile uint32_t *)(SOC_CTRL_BASE + CHIMERA_CLUSTER_2_BUSY_REG_OFFSET)) = 1;
break;
case 28:
case 1 + CLUSTER_0_NUMCORES + CLUSTER_1_NUMCORES + CLUSTER_2_NUMCORES:
*((volatile uint32_t *)(SOC_CTRL_BASE + CHIMERA_CLUSTER_3_BUSY_REG_OFFSET)) = 1;
break;
case 37:
case 1 + CLUSTER_0_NUMCORES + CLUSTER_1_NUMCORES + CLUSTER_2_NUMCORES + CLUSTER_3_NUMCORES:
*((volatile uint32_t *)(SOC_CTRL_BASE + CHIMERA_CLUSTER_4_BUSY_REG_OFFSET)) = 1;
break;
}
Expand Down
86 changes: 86 additions & 0 deletions hw/chimera_clu_domain.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// Copyright 2024 ETH Zurich and University of Bologna.
// Solderpad Hardware License, Version 0.51, see LICENSE for details.
// SPDX-License-Identifier: SHL-0.51
//
// Moritz Scherer <[email protected]>

`define NRCORES(extClusterIdx) ChimeraClusterCfg.NrCores[extClusterIdx]
`define PREVNRCORES(extClusterIdx) \
_sumVector( \
ChimeraClusterCfg.NrCores, extClusterIdx \
)

// Wraps all snitch-type clusters in chimera
module chimera_clu_domain
import chimera_pkg::*;
import cheshire_pkg::*;
#(
parameter cheshire_cfg_t Cfg = '0,
parameter type narrow_in_req_t = logic,
parameter type narrow_in_resp_t = logic,
parameter type narrow_out_req_t = logic,
parameter type narrow_out_resp_t = logic,
parameter type wide_out_req_t = logic,
parameter type wide_out_resp_t = logic
) (
input logic soc_clk_i,
input logic [ ExtClusters-1:0] clu_clk_i,
input logic rst_ni,
input logic [ ExtClusters-1:0] widemem_bypass_i,
//-----------------------------
// Interrupt ports
//-----------------------------
input logic [iomsb(NumIrqCtxts*Cfg.NumExtIrqHarts):0] xeip_i,
input logic [ iomsb(Cfg.NumExtIrqHarts):0] mtip_i,
input logic [ iomsb(Cfg.NumExtIrqHarts):0] msip_i,
input logic [ iomsb(Cfg.NumExtDbgHarts):0] debug_req_i,
//-----------------------------
// Narrow AXI ports
//-----------------------------
input narrow_in_req_t [ iomsb(Cfg.AxiExtNumSlv):0] narrow_in_req_i,
output narrow_in_resp_t [ iomsb(Cfg.AxiExtNumSlv):0] narrow_in_resp_o,
output narrow_out_req_t [ iomsb(Cfg.AxiExtNumMst):0] narrow_out_req_o,
input narrow_out_resp_t [ iomsb(Cfg.AxiExtNumMst):0] narrow_out_resp_i,
//-----------------------------
// Wide AXI ports
//-----------------------------
output wide_out_req_t [ iomsb(Cfg.AxiExtNumWideMst):0] wide_out_req_o,
input wide_out_resp_t [ iomsb(Cfg.AxiExtNumWideMst):0] wide_out_resp_i
);

for (genvar extClusterIdx = 0; extClusterIdx < ExtClusters; extClusterIdx++) begin : gen_clusters

chimera_cluster #(
.Cfg (Cfg),
.NrCores (`NRCORES(extClusterIdx)),
.narrow_in_req_t (narrow_in_req_t),
.narrow_in_resp_t (narrow_in_resp_t),
.narrow_out_req_t (narrow_out_req_t),
.narrow_out_resp_t(narrow_out_resp_t),
.wide_out_req_t (wide_out_req_t),
.wide_out_resp_t (wide_out_resp_t)
) i_chimera_cluster (
.soc_clk_i (soc_clk_i),
.clu_clk_i (clu_clk_i[extClusterIdx]),
.rst_ni,
.widemem_bypass_i (widemem_bypass_i[extClusterIdx]),
.debug_req_i (debug_req_i[`PREVNRCORES(extClusterIdx)+:`NRCORES(extClusterIdx)]),
.meip_i (xeip_i[`PREVNRCORES(extClusterIdx)+:`NRCORES(extClusterIdx)]),
.mtip_i (mtip_i[`PREVNRCORES(extClusterIdx)+:`NRCORES(extClusterIdx)]),
.msip_i (msip_i[`PREVNRCORES(extClusterIdx)+:`NRCORES(extClusterIdx)]),
.hart_base_id_i (10'(`PREVNRCORES(extClusterIdx) + 1)),
.cluster_base_addr_i(Cfg.AxiExtRegionStart[extClusterIdx][Cfg.AddrWidth-1:0]),
.boot_addr_i (SnitchBootROMRegionStart[31:0]),

.narrow_in_req_i (narrow_in_req_i[extClusterIdx]),
.narrow_in_resp_o (narrow_in_resp_o[extClusterIdx]),
.narrow_out_req_o (narrow_out_req_o[2*extClusterIdx+:2]),
.narrow_out_resp_i(narrow_out_resp_i[2*extClusterIdx+:2]),
.wide_out_req_o (wide_out_req_o[extClusterIdx]),
.wide_out_resp_i (wide_out_resp_i[extClusterIdx])
);

end : gen_clusters


endmodule
Loading

0 comments on commit 9d5c562

Please sign in to comment.