Skip to content

Commit 1e7aadb

Browse files
committed
hw: Expose cluster base offset to calculate addrmap size
1 parent 6f8f734 commit 1e7aadb

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

hw/snitch_cluster/src/snitch_cluster.sv

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,9 @@ module snitch_cluster
267267
/// Base address of cluster. TCDM and cluster peripheral location are derived from
268268
/// it. This signal is pseudo-static.
269269
input logic [PhysicalAddrWidth-1:0] cluster_base_addr_i,
270+
/// Base address of cluster. TCDM and cluster peripheral location are derived from
271+
/// it. This signal is pseudo-static.
272+
input logic [PhysicalAddrWidth-1:0] cluster_base_offset_i,
270273
/// Configuration inputs for the memory cuts used in implementation.
271274
/// These signals are pseudo-static.
272275
input sram_cfgs_t sram_cfgs_i,
@@ -564,6 +567,9 @@ module snitch_cluster
564567
assign ext_mem_start_address = zero_mem_end_address;
565568
assign ext_mem_end_address = ext_mem_start_address + ExtMemorySize * 1024;
566569

570+
addr_t cluster_end_address;
571+
assign cluster_end_address = cluster_base_addr_i + cluster_base_offset_i;
572+
567573
localparam addr_t TCDMAliasStart = AliasRegionBase & TCDMMask;
568574
localparam addr_t TCDMAliasEnd = (TCDMAliasStart + TCDMSizeNapotRounded) & TCDMMask;
569575

@@ -692,7 +698,7 @@ module snitch_cluster
692698
assign dma_xbar_default_rule = '{
693699
idx: dma_xbar_default_port,
694700
start_addr: tcdm_start_address,
695-
end_addr: zero_mem_end_address
701+
end_addr: cluster_end_address
696702
};
697703

698704
// Define the address map for the wide XBAR

hw/snitch_cluster/src/snitch_cluster_pkg.sv.tpl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,9 @@ ${ssr_cfg(core, '{reg_idx}', '/*None*/ 0', ',')}\
247247
};
248248
249249
// Forward potentially optional configuration parameters
250-
localparam logic [9:0] CfgBaseHartId = (${to_sv_hex(cfg['cluster']['cluster_base_hartid'], 10)});
251-
localparam addr_t CfgClusterBaseAddr = (${to_sv_hex(cfg['cluster']['cluster_base_addr'], cfg['cluster']['addr_width'])});
250+
localparam logic [9:0] CfgBaseHartId = (${to_sv_hex(cfg['cluster']['cluster_base_hartid'], 10)});
251+
localparam addr_t CfgClusterBaseAddr = (${to_sv_hex(cfg['cluster']['cluster_base_addr'], cfg['cluster']['addr_width'])});
252+
localparam addr_t CfgClusterBaseOffset = (${to_sv_hex(cfg['cluster']['cluster_base_offset'], cfg['cluster']['addr_width'])});
252253
253254
endpackage
254255
// verilog_lint: waive-stop package-filename

hw/snitch_cluster/src/snitch_cluster_wrapper.sv.tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ module ${cfg['cluster']['name']}_wrapper (
4444
input logic [${cfg['cluster']['name']}_pkg::NrCores-1:0] mxip_i,
4545
input logic [9:0] hart_base_id_i,
4646
input logic [${cfg['cluster']['addr_width']-1}:0] cluster_base_addr_i,
47+
input logic [${cfg['cluster']['addr_width']-1}:0] cluster_base_offset_i,
4748
input logic clk_d2_bypass_i,
4849
input ${cfg['cluster']['name']}_pkg::sram_cfgs_t sram_cfgs_i,
4950
input ${cfg['cluster']['name']}_pkg::narrow_in_req_t narrow_in_req_i,
@@ -198,9 +199,11 @@ module ${cfg['cluster']['name']}_wrapper (
198199
% if cfg['cluster']['cluster_base_expose']:
199200
.hart_base_id_i,
200201
.cluster_base_addr_i,
202+
.cluster_base_offset_i,
201203
% else:
202204
.hart_base_id_i (snitch_cluster_pkg::CfgBaseHartId),
203205
.cluster_base_addr_i (snitch_cluster_pkg::CfgClusterBaseAddr),
206+
.cluster_base_offset_i (snitch_cluster_pkg::CfgClusterBaseOffset),
204207
% endif
205208
% if cfg['cluster']['timing']['iso_crossings']:
206209
.clk_d2_bypass_i,

util/clustergen/snitch_cluster.schema.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
"description": "Base address of this cluster.",
2929
"default": 0
3030
},
31+
"cluster_base_offset": {
32+
"type": "number",
33+
"description": "Address offset between successive clusters.",
34+
"default": 0
35+
},
3136
"tcdm": {
3237
"type": "object",
3338
"description": "Configuration of the Tightly Coupled Data Memory of this cluster.",
@@ -238,7 +243,7 @@
238243
},
239244
"cluster_base_expose": {
240245
"type": "boolean",
241-
"description": "Whether to expose base_addr and base_hart_id",
246+
"description": "Whether to expose base_addr, base_offset and base_hart_id",
242247
"default": false
243248
},
244249
"sram_cfg_expose": {

0 commit comments

Comments
 (0)