Skip to content

Commit

Permalink
[config] Make the L1 size configurable through the Makefiles
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelRiedel committed Sep 22, 2023
1 parent 1e4ed97 commit 74d37cc
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion config/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ include $(MEMPOOL_DIR)/config/$(config).mk
# Boot address (in dec)
boot_addr ?= 2684354560 # A0000000

# L2 memory configuration (in hex)
# L2 memory configuration (in dec)
l2_base ?= 2147483648 # 80000000
l2_size ?= 4194304 # 400000
l2_banks ?= 4

# L1 size per bank (in dec)
l1_bank_size ?= 1024

# Size of sequential memory per core (in bytes)
# (must be a power of two)
seq_mem_size ?= 1024
Expand Down
1 change: 1 addition & 0 deletions hardware/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ vlog_args += -work $(library)
# Defines
vlog_defs += -DNUM_CORES=$(num_cores) -DNUM_CORES_PER_TILE=$(num_cores_per_tile) -DNUM_GROUPS=$(num_groups) -DBANKING_FACTOR=$(banking_factor)
vlog_defs += -DL2_BASE=$(l2_base) -DL2_SIZE=$(l2_size) -DL2_BANKS=$(l2_banks)
vlog_defs += -DL1_BANK_SIZE=$(l1_bank_size)
vlog_defs += -DBOOT_ADDR=$(boot_addr) -DXPULPIMG=$(xpulpimg)
vlog_defs += -DSNITCH_TRACE=$(snitch_trace)
vlog_defs += -DAXI_DATA_WIDTH=$(axi_data_width)
Expand Down
2 changes: 1 addition & 1 deletion hardware/src/mempool_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ package mempool_pkg;
localparam integer unsigned ByteOffset = $clog2(BeWidth);
localparam integer unsigned BankingFactor = `ifdef BANKING_FACTOR `BANKING_FACTOR `else 0 `endif;
localparam bit LrScEnable = 1'b1;
localparam integer unsigned TCDMSizePerBank = 1024; // [B]
localparam integer unsigned TCDMSizePerBank = `ifdef L1_BANK_SIZE `L1_BANK_SIZE `else 0 `endif;
localparam integer unsigned NumBanks = NumCores * BankingFactor;
localparam integer unsigned NumBanksPerTile = NumBanks / NumTiles;
localparam integer unsigned NumBanksPerGroup = NumBanks / NumGroups;
Expand Down
2 changes: 1 addition & 1 deletion software/runtime/arch.ld.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* This file will get processed by the precompiler to expand all macros. */

MEMORY {
l1 (R) : ORIGIN = 0x00000000, LENGTH = (NUM_CORES * 0x1000) /* NUM_CORES * 4 * 1KiB per bank */
l1 (R) : ORIGIN = 0x00000000, LENGTH = (NUM_CORES * BANKING_FACTOR * L1_BANK_SIZE)
l2 : ORIGIN = L2_BASE , LENGTH = L2_SIZE
rom (R): ORIGIN = BOOT_ADDR , LENGTH = 0x00001000
}
Expand Down
1 change: 1 addition & 0 deletions software/runtime/runtime.mk
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ DEFINES += -DNUM_CORES_PER_GROUP=$(shell awk 'BEGIN{print $(num_cores)/$(num_gro
DEFINES += -DNUM_TILES_PER_GROUP=$(shell awk 'BEGIN{print ($(num_cores)/$(num_groups))/$(num_cores_per_tile)}')
DEFINES += -DLOG2_NUM_CORES_PER_TILE=$(shell awk 'BEGIN{print log($(num_cores_per_tile))/log(2)}')
DEFINES += -DBOOT_ADDR=$(boot_addr)
DEFINES += -DL1_BANK_SIZE=$(l1_bank_size)
DEFINES += -DL2_BASE=$(l2_base)
DEFINES += -DL2_SIZE=$(l2_size)
DEFINES += -DSEQ_MEM_SIZE=$(seq_mem_size)
Expand Down

0 comments on commit 74d37cc

Please sign in to comment.