From 9d235b81bbbf86eebddc2870ceff9ff050757796 Mon Sep 17 00:00:00 2001 From: Salvatore Girolamo Date: Sun, 2 May 2021 16:58:27 +0200 Subject: [PATCH] moving L2 parameters to config file --- hw/src/memories/l2_mem.sv | 5 +++-- hw/src/pspin.sv | 32 +++++++++++++++----------------- hw/src/pspin_cfg_pkg.sv | 26 +++++++++++++++----------- 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/hw/src/memories/l2_mem.sv b/hw/src/memories/l2_mem.sv index a495239..464b16b 100644 --- a/hw/src/memories/l2_mem.sv +++ b/hw/src/memories/l2_mem.sv @@ -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, @@ -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; @@ -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 diff --git a/hw/src/pspin.sv b/hw/src/pspin.sv index 308136b..d94a230 100644 --- a/hw/src/pspin.sv +++ b/hw/src/pspin.sv @@ -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; @@ -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; @@ -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), @@ -814,15 +812,15 @@ 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 #( @@ -830,15 +828,15 @@ module pspin #( .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 #( diff --git a/hw/src/pspin_cfg_pkg.sv b/hw/src/pspin_cfg_pkg.sv index 2816854..969e4ff 100644 --- a/hw/src/pspin_cfg_pkg.sv +++ b/hw/src/pspin_cfg_pkg.sv @@ -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; @@ -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 @@ -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;