Skip to content

Commit

Permalink
moving L2 parameters to config file
Browse files Browse the repository at this point in the history
  • Loading branch information
Salvatore Girolamo committed May 2, 2021
1 parent 9287fcc commit 9d235b8
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 30 deletions.
5 changes: 3 additions & 2 deletions hw/src/memories/l2_mem.sv
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module l2_mem #(
// Cuts
parameter int unsigned CUT_DW = 64, // [bit], must be a power of 2 and >=8
parameter int unsigned CUT_N_WORDS = 16384, // must be a power of 2
parameter int unsigned N_PAR_CUTS_MUL = 4
parameter int unsigned N_PAR_CUTS = AXI_DW / CUT_DW
) (
input logic clk_i,
input logic rst_ni,
Expand All @@ -34,7 +34,7 @@ module l2_mem #(
localparam int unsigned CUT_N_BITS = CUT_DW * CUT_N_WORDS;

// Derived properties of memory array
localparam int unsigned N_PAR_CUTS = N_PAR_CUTS_MUL * AXI_DW / CUT_DW;
//localparam int unsigned N_PAR_CUTS = N_PAR_CUTS_MUL * AXI_DW / CUT_DW;
localparam int unsigned PAR_CUTS_N_BYTES = N_PAR_CUTS * CUT_N_BITS / 8;
localparam int unsigned N_SER_CUTS = N_BYTES / PAR_CUTS_N_BYTES;

Expand Down Expand Up @@ -188,6 +188,7 @@ module l2_mem #(
assert (AXI_DW >= CUT_DW);
assert (CUT_N_WORDS % 2**$clog2(CUT_N_WORDS) == 0);
assert (N_BYTES % PAR_CUTS_N_BYTES == 0);
assert (N_PAR_CUTS >= AXI_DW/CUT_DW);
end
// pragma translate_on

Expand Down
32 changes: 15 additions & 17 deletions hw/src/pspin.sv
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ module pspin #(
import pspin_cfg_pkg::resp_t;
import pspin_cfg_pkg::host_req_t;
import pspin_cfg_pkg::host_resp_t;
import pspin_cfg_pkg::PKT_MEM_SIZE;
import pspin_cfg_pkg::HND_MEM_SIZE;
import pspin_cfg_pkg::L1_CLUSTER_BASE;
import pspin_cfg_pkg::L1_CLUSTER_MEM_SIZE;
localparam int unsigned L2_SIZE = pulp_cluster_cfg_pkg::L2_SIZE;
Expand Down Expand Up @@ -592,10 +590,10 @@ module pspin #(
l2_prog_start_addr, l2_prog_end_addr,
l2_start_addr, l2_end_addr;
assign l2_hnd_start_addr = 32'h1C00_0000;
assign l2_hnd_end_addr = l2_hnd_start_addr + addr_t'(HND_MEM_SIZE);
assign l2_hnd_end_addr = l2_hnd_start_addr + addr_t'(pspin_cfg_pkg::MEM_HND_SIZE);

assign l2_pkt_start_addr = l2_hnd_end_addr;
assign l2_pkt_end_addr = l2_pkt_start_addr + addr_t'(PKT_MEM_SIZE);
assign l2_pkt_end_addr = l2_pkt_start_addr + addr_t'(pspin_cfg_pkg::MEM_PKT_SIZE);

assign l2_prog_start_addr = 32'h1D00_0000;
assign l2_prog_end_addr = l2_prog_start_addr + 32'h0000_8000;
Expand All @@ -610,7 +608,7 @@ module pspin #(

prog_mem #(
.NumClusters (N_CLUSTERS),
.NumBytes (32*1024),
.NumBytes (pspin_cfg_pkg::MEM_PROG_SIZE),
.AddrWidth (AXI_AW),
.DataWidth (pulp_cluster_cfg_pkg::AXI_DW_ICACHE),
.IdWidth (pulp_cluster_cfg_pkg::AXI_IW_ICACHE),
Expand Down Expand Up @@ -814,31 +812,31 @@ module pspin #(
.AXI_DW (AXI_WIDE_DW),
.AXI_UW (AXI_UW),
.AXI_IW (AXI_IW),
.N_BYTES (HND_MEM_SIZE),
.CUT_DW (64),
.CUT_N_WORDS (16384),
.N_PAR_CUTS_MUL (4)
.N_BYTES (pspin_cfg_pkg::MEM_HND_SIZE),
.CUT_DW (pspin_cfg_pkg::MEM_HND_CUT_DW),
.CUT_N_WORDS (pspin_cfg_pkg::MEM_HND_CUT_N_WORDS),
.N_PAR_CUTS (pspin_cfg_pkg::MEM_HND_N_PAR_CUTS)
) i_l2_hnd_mem (
.clk_i,
.rst_ni,
.slv_a (l2_hnd_mst_wo_atomics),
.slv_b (l2_hnd_mst_b)
.slv_a (l2_hnd_mst_wo_atomics),
.slv_b (l2_hnd_mst_b)
);

l2_mem #(
.AXI_AW (AXI_AW),
.AXI_DW (AXI_WIDE_DW),
.AXI_UW (AXI_UW),
.AXI_IW (AXI_IW),
.N_BYTES (PKT_MEM_SIZE),
.CUT_DW (512),
.CUT_N_WORDS (2048),
.N_PAR_CUTS_MUL (32)
.N_BYTES (pspin_cfg_pkg::MEM_PKT_SIZE),
.CUT_DW (pspin_cfg_pkg::MEM_PKT_CUT_DW),
.CUT_N_WORDS (pspin_cfg_pkg::MEM_PKT_CUT_N_WORDS),
.N_PAR_CUTS (pspin_cfg_pkg::MEM_PKT_N_PAR_CUTS)
) i_l2_pkt_mem (
.clk_i,
.rst_ni,
.slv_a (l2_pkt_mst_a),
.slv_b (l2_pkt_mst_b)
.slv_a (l2_pkt_mst_a),
.slv_b (l2_pkt_mst_b)
);

soc_peripherals #(
Expand Down
26 changes: 15 additions & 11 deletions hw/src/pspin_cfg_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,9 @@ package automatic pspin_cfg_pkg;
localparam int unsigned AXI_IW = 6;
localparam int unsigned AXI_UW = pulp_cluster_cfg_pkg::AXI_UW;

localparam int unsigned PKT_MEM_SIZE = pulp_cluster_cfg_pkg::L2_SIZE / 2;
localparam int unsigned HND_MEM_SIZE = pulp_cluster_cfg_pkg::L2_SIZE / 2;

localparam int unsigned SOC_DMA_AXI_REQ_DEPTH = 12;
localparam int unsigned SOC_DMA_REQ_FIFO_DEPT = 64; //tune me!

/*
localparam longint unsigned PCIE_START_ADDR = 64'h1000_0000_0000_0000;
localparam longint unsigned PCIE_END_ADDR = 64'h1FFF_FFFF_FFFF_FFFF;
localparam int unsigned NHI_START_ADDR = 32'h1000_0000;
localparam int unsigned NHI_END_ADDR = 32'hFF00_0000;
*/

localparam int unsigned C_SIZE_WIDTH = AXI_AW;
localparam int unsigned C_MSGID_WIDTH = 10;
localparam int unsigned C_ADDR_WIDTH = AXI_AW;
Expand All @@ -42,7 +32,7 @@ package automatic pspin_cfg_pkg;
localparam int unsigned NUM_CORES = 8;

//MPQ engine
localparam int unsigned NUM_MPQ = 1024;
localparam int unsigned NUM_MPQ = 256;
localparam int unsigned NUM_MPQ_CELLS = 128;
localparam int unsigned NUM_MPQ_STATIC_CELLS = 1; //per MPQ

Expand Down Expand Up @@ -85,6 +75,20 @@ package automatic pspin_cfg_pkg;
localparam int unsigned CMD_NIC_OUTBOUND_ID = 1;
localparam int unsigned CMD_EDMA_ID = 2;

// L2 program memory
localparam int unsigned MEM_PROG_SIZE = 32*1024;

// L2 packet buffer
localparam int unsigned MEM_PKT_SIZE = 4*1024*1024;
localparam int unsigned MEM_PKT_N_PAR_CUTS = 32;
localparam int unsigned MEM_PKT_CUT_N_WORDS = 2048;
localparam int unsigned MEM_PKT_CUT_DW = 512;

// L2 handler memory
localparam int unsigned MEM_HND_SIZE = 4*1024*1024;
localparam int unsigned MEM_HND_N_PAR_CUTS = 32;
localparam int unsigned MEM_HND_CUT_N_WORDS = 16384;
localparam int unsigned MEM_HND_CUT_DW = 64;

// Interface types
typedef logic [AXI_AW-1:0] addr_t;
Expand Down

0 comments on commit 9d235b8

Please sign in to comment.