Skip to content

Commit

Permalink
occamy: Add interleaved mode to HBM crossbar (pulp-platform/snitch#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
thommythomaso authored Apr 26, 2022
1 parent 44170c2 commit 8de1915
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Bender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ sources:
- src/occamy_soc_ctrl/occamy_soc_reg_top.sv
- src/occamy_quadrant_s1_ctrl/occamy_quadrant_s1_reg_pkg.sv
- src/occamy_quadrant_s1_ctrl/occamy_quadrant_s1_reg_top.sv
- src/occamy_hbm_xbar_ctrl/occamy_hbm_xbar_reg_pkg.sv
- src/occamy_hbm_xbar_ctrl/occamy_hbm_xbar_reg_top.sv
- src/rv_plic/rv_plic_reg_pkg.sv
- src/rv_plic/rv_plic_reg_top.sv
- src/rv_plic/rv_plic.sv
Expand Down
29 changes: 29 additions & 0 deletions hw/occamy/hbm_xbar_ctrl/occamy_hbm_xbar_reg.hjson.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2020 ETH Zurich and University of Bologna.
// Solderpad Hardware License, Version 0.51, see LICENSE for details.
// SPDX-License-Identifier: SHL-0.51
// Licensed under Solderpad Hardware License, Version 0.51, see LICENSE for details.
{
name: "${name}_HBM_xbar"
clock_primary: "clk_i"
bus_interfaces: [
{ protocol: "reg_iface", direction: "device" }
],
regwidth: 32
registers: [
{ name: "INTERLEAVED_ENA"
desc: "Interleaved mode of the x-bar is enabled."
swaccess: "rw"
hwaccess: "hro"
fields: [
{
bits: "0:0"
resval: "0"
name: "INTERLEAVED_ENA"
desc: '''
Interleaved mode of the x-bar is enabled.
'''
}
]
}
]
}
11 changes: 10 additions & 1 deletion hw/occamy/occamy_soc.sv.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,18 @@ module ${name}_soc
input logic [0:0] debug_req_i,

/// SRAM configuration
input sram_cfgs_t sram_cfgs_i
input sram_cfgs_t sram_cfgs_i,

/// HBM XBAR configuration
input logic hbm_xbar_interleaved_mode_ena_i
);

///////////////////
// HBM XBAR CTRL //
///////////////////
logic hbm_xbar_interleaved_mode_ena;
assign hbm_xbar_interleaved_mode_ena = hbm_xbar_interleaved_mode_ena_i;

///////////////
// Crossbars //
///////////////
Expand Down
43 changes: 42 additions & 1 deletion hw/occamy/occamy_top.sv.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,46 @@ module ${name}_top

${module}

//////////////////////////
// HBM XBAR CFG //
//////////////////////////

${soc_regbus_periph_xbar.out_hbm_xbar_cfg.req_type()} reg_hbm_xbar_cfg_req;
${soc_regbus_periph_xbar.out_hbm_xbar_cfg.rsp_type()} reg_hbm_xbar_cfg_rsp;

occamy_hbm_xbar_reg_pkg::occamy_hbm_xbar_reg2hw_t hbm_xbar_reg2hw;

reg_cdc #(
.req_t ( ${soc_regbus_periph_xbar.out_hbm_xbar_cfg.req_type()} ),
.rsp_t ( ${soc_regbus_periph_xbar.out_hbm_xbar_cfg.rsp_type()} )
) i_reg_cdc_hbm_xbar_cfg (
.src_clk_i ( clk_periph_i ),
.src_rst_ni ( rst_periph_ni ),
.src_req_i ( ${soc_regbus_periph_xbar.out_hbm_xbar_cfg.req_name()} ),
.src_rsp_o ( ${soc_regbus_periph_xbar.out_hbm_xbar_cfg.rsp_name()} ),

.dst_clk_i ( clk_i ),
.dst_rst_ni ( rst_ni ),
.dst_req_o ( reg_hbm_xbar_cfg_req ),
.dst_rsp_i ( reg_hbm_xbar_cfg_rsp )
);

occamy_hbm_xbar_reg_top #(
.reg_req_t ( ${soc_regbus_periph_xbar.out_hbm_xbar_cfg.req_type()} ),
.reg_rsp_t ( ${soc_regbus_periph_xbar.out_hbm_xbar_cfg.rsp_type()} )
) i_occamy_hbm_xbar_reg_top (
.clk_i ( clk_i ),
.rst_ni ( rst_ni ),
.reg_req_i ( reg_hbm_xbar_cfg_req ),
.reg_rsp_o ( reg_hbm_xbar_cfg_rsp ),
.reg2hw ( hbm_xbar_reg2hw ),
`ifndef SYNTHESIS
.devmode_i ( 1'b1 )
`else
.devmode_i ( 1'b0 )
`endif
);

///////////////////////////////
// Synchronous top level //
///////////////////////////////
Expand Down Expand Up @@ -204,7 +244,8 @@ module ${name}_top
.msip_i ( msip ),
.eip_i ( eip ),
.debug_req_i ( debug_req ),
.sram_cfgs_i
.sram_cfgs_i,
.hbm_xbar_interleaved_mode_ena_i (hbm_xbar_reg2hw.interleaved_ena.q )
);

// Connect AXI-lite master
Expand Down
1 change: 1 addition & 0 deletions target/sim/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ endef

update-socreg:
$(call update_ctrl_regs,SOCREGS,src/occamy_soc_ctrl,occamy_soc_reg.hjson,occamy_soc_peripheral,1)
$(call update_ctrl_regs,HBMXBARREGS,src/occamy_hbm_xbar_ctrl,occamy_hbm_xbar_reg.hjson,occamy_hbm_xbar_peripheral,1)

update-quadreg:
$(call update_ctrl_regs,QUADREGS,src/occamy_quadrant_s1_ctrl,occamy_quadrant_s1_reg.hjson,occamy_quad_peripheral,1)
Expand Down
1 change: 1 addition & 0 deletions util/occamygen/occamygen.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ def main():
fall_through=occamy.cfg["hbm_xbar"]["fall_through"],
no_loopback=True,
atop_support=False,
interleaved_ena=True,
context="soc",
node=am_hbm_xbar)

Expand Down
10 changes: 9 additions & 1 deletion util/solder/solder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1338,6 +1338,7 @@ def __init__(self,
no_loopback=False,
atop_support=True,
latency_mode=None,
interleaved_ena=False,
**kwargs):
super().__init__(**kwargs)
self.aw = aw
Expand All @@ -1351,6 +1352,7 @@ def __init__(self,
self.symbolic_addrmap = list()
self.symbolic_addrmap_multi = list()
self.atop_support = atop_support
self.interleaved_ena = interleaved_ena
self.addrmap = list()
self.connections = dict()
self.latency_mode = latency_mode or "axi_pkg::CUT_ALL_PORTS"
Expand Down Expand Up @@ -1546,7 +1548,10 @@ def emit(self):
self.__dict__["out_" + name] = bus

# Emit the crossbar instance itself.
code = "axi_xbar #(\n"
if not self.interleaved_ena:
code = "axi_xbar #(\n"
else:
code = "axi_interleaved_xbar #(\n"
code += " .Cfg ( {cfg_name} ),\n".format(
cfg_name=self.cfg_name)
code += " .Connectivity ( {} ), \n".format(self.connectivity())
Expand Down Expand Up @@ -1585,6 +1590,9 @@ def emit(self):
name=self.name)
code += " .addr_map_i ( {addrmap_name} ),\n".format(
addrmap_name=addrmap_name)
if self.interleaved_ena:
code += " .interleaved_mode_ena_i ( {name}_interleaved_mode_ena ),\n".format(
name=self.name)
code += " .en_default_mst_port_i ( '1 ),\n"
code += " .default_mst_port_i ( '0 )\n"
code += ");\n"
Expand Down

0 comments on commit 8de1915

Please sign in to comment.