Skip to content

Commit

Permalink
Merge pull request #45 from pulp-platform/top-level-cfg
Browse files Browse the repository at this point in the history
Add cleaner top level configuration parameter to PULP cluster.
  • Loading branch information
yvantor authored Feb 10, 2024
2 parents ac0d053 + 13c6da8 commit 4bc352b
Show file tree
Hide file tree
Showing 13 changed files with 833 additions and 567 deletions.
1 change: 0 additions & 1 deletion Bender.local
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
overrides:
hci : { git: "https://github.com/pulp-platform/hci.git" , rev: 3cb3d99b2cebfeed55cb6ab9d98fce7b99e97cb9 } # branch: master
axi : { git: "https://github.com/pulp-platform/axi.git" , version: =0.39.1-beta }
register_interface : { git: "https://github.com/pulp-platform/register_interface.git" , rev: 19163bb5191d2669a8cbc267cdd4ce8e60f20746 } # branch: master
cluster_interconnect: { git: "https://github.com/pulp-platform/cluster_interconnect.git", rev: 89e1019d64a86425211be6200770576cbdf3e8b3 } # branch: assertion-fix
6 changes: 3 additions & 3 deletions Bender.lock
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ packages:
dependencies:
- common_cells
cluster_peripherals:
revision: c015839816938a790c8da5fd5829cfc536f1ca9c
revision: c9defcfb4f4e8733383b28a451c430783c2febbd
version: null
source:
Git: https://github.com/pulp-platform/cluster_peripherals.git
Expand Down Expand Up @@ -105,7 +105,7 @@ packages:
dependencies:
- common_cells
hci:
revision: 3cb3d99b2cebfeed55cb6ab9d98fce7b99e97cb9
revision: 4823e503851eb7e8cc765a58621d767a01d6a77b
version: null
source:
Git: https://github.com/pulp-platform/hci.git
Expand Down Expand Up @@ -183,7 +183,7 @@ packages:
dependencies:
- axi_slice
redmule:
revision: 532f9514ad5c7ee21dde9e3a84ae99d2a5760610
revision: 1b30b0b9a31afa702eb2d166d672ceda2f5d463a
version: null
source:
Git: https://github.com/pulp-platform/redmule.git
Expand Down
6 changes: 3 additions & 3 deletions Bender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies:
mchan: { git: "https://github.com/pulp-platform/mchan.git", rev: 7f064f205a3e0203e959b14773c4afecf56681ab } # branch: yt/fix-parametrization
idma: { git: "https://github.com/pulp-platform/iDMA.git", rev: 437ffa9dac5dea0daccfd3e8ae604d4f6ae2cdf1 } # branch: master
hier-icache: { git: "https://github.com/pulp-platform/hier-icache.git", rev: "a971e364bf8090cf77fafad995b480c1ac7ea4e0" } # branch: yt/carfield
cluster_peripherals: { git: "https://github.com/pulp-platform/cluster_peripherals.git", rev: c015839816938a790c8da5fd5829cfc536f1ca9c } # branch: yt/return-reg
cluster_peripherals: { git: "https://github.com/pulp-platform/cluster_peripherals.git", rev: c9defcfb4f4e8733383b28a451c430783c2febbd } # branch: astral
axi: { git: "https://github.com/pulp-platform/axi.git", version: =0.39.1-beta }
axi_slice: { git: "https://github.com/pulp-platform/axi_slice.git", version: 1.1.4 } # deprecated, replaced by axi_cut (in axi repo)
timer_unit: { git: "https://github.com/pulp-platform/timer_unit.git", version: 1.0.2 }
Expand All @@ -30,11 +30,11 @@ dependencies:
cv32e40p: { git: "https://github.com/pulp-platform/cv32e40p.git", rev: e863f576699815b38cc9d80dbdede8ed5efd5991 } # `michaero/safety-island-clic` branch
ibex: { git: "https://github.com/pulp-platform/ibex.git", rev: "pulpissimo-v6.1.2" }
scm: { git: "https://github.com/pulp-platform/scm.git", rev: 74426dee36f28ae1c02f7635cf844a0156145320 } # branch: yt/bump-clkgating
hci: { git: "https://github.com/pulp-platform/hci.git", rev: 3cb3d99b2cebfeed55cb6ab9d98fce7b99e97cb9 } # branch: test_mode_fix
hci: { git: "https://github.com/pulp-platform/hci.git", rev: v1.1 }
register_interface: { git: "https://github.com/pulp-platform/register_interface.git", rev: 19163bb5191d2669a8cbc267cdd4ce8e60f20746 } # branch: master
common_cells: { git: "https://github.com/pulp-platform/common_cells.git", version: 1.29.0 }
redundancy_cells: { git: "https://github.com/pulp-platform/redundancy_cells.git", rev: 651441e4a6459f84f3dde4242cf34961925a2142 } # branch: astral_rebase
redmule: { git: "https://github.com/pulp-platform/redmule.git", rev: 532f9514ad5c7ee21dde9e3a84ae99d2a5760610 } # branch: astral
redmule: { git: "https://github.com/pulp-platform/redmule.git", rev: 1b30b0b9a31afa702eb2d166d672ceda2f5d463a } # branch: astral

export_include_dirs:
- include
Expand Down
22 changes: 12 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Solderpad Hardware License, Version 0.51, see LICENSE for details.
# SPDX-License-Identifier: SHL-0.51

ROOT_DIR = $(strip $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))))
ROOT_DIR = $(strip $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))))

QUESTA ?= questa-2022.3
GIT ?= git
Expand All @@ -15,6 +15,8 @@ library ?= work
elf-bin ?= stimuli.riscv
bwruntest = $(ROOT_DIR)/pulp-runtime/scripts/bwruntests.py

REGRESSIONS := $(ROOT_DIR)/regression-tests

CFLAGS ?= -I$(QUESTASIM_HOME)/include \
-I$(RISCV)/include/ \
-I/include -std=c++11 -I../tb/dpi -O3
Expand All @@ -31,6 +33,7 @@ bender_defs += -D ICAHE_USE_FF
bender_defs += -D NO_FPU
bender_defs += -D TRACE_EXECUTION
bender_defs += -D CLUSTER_ALIAS
bender_defs += -D USE_PULP_PARAMETERS

bender_targs += -t rtl
bender_targs += -t test
Expand All @@ -50,7 +53,7 @@ endef
######################

NONFREE_REMOTE ?= git@iis-git.ee.ethz.ch:pulp-restricted/pulp-cluster-nonfree.git
NONFREE_COMMIT ?= e327fb9f8cb4a583d219862e81245405f22283bb
NONFREE_COMMIT ?= bb64efc82c3cff99a5de9585c8963025078c16c2

nonfree-init:
git clone $(NONFREE_REMOTE) nonfree
Expand All @@ -77,11 +80,13 @@ Bender.lock:

## Clone pulp-runtime as SW stack
pulp-runtime:
git clone git@github.com:pulp-platform/pulp-runtime.git -b astral $@
git clone https://github.com/pulp-platform/pulp-runtime.git $@
cd $@; git checkout 197d06b6ad1d8014cef73e0e87b59b5ebf66d019; cd $(ROOT_DIR)

## Clone regression tests for bare-metal verification
regression-tests:
git clone git@github.com:pulp-platform/regression_tests.git -b astral $@
git clone https://github.com/pulp-platform/regression_tests.git $@
cd $@; git checkout b85310fd9ed068a0b310b67ed7b3aa46ec30c9bb; cd $(ROOT_DIR)

########################
# Build and simulation #
Expand Down Expand Up @@ -114,16 +119,13 @@ run:
.PHONY: test-rt-par-bare
## Run only parallel tests on pulp-runtime
test-rt-par-bare: pulp-runtime regression-tests
source env/carfield-env.sh; \
cd regression-tests && $(bwruntest) --proc-verbose -v \
cd $(REGRESSIONS)/carfield && $(bwruntest) --proc-verbose -v \
-t 3600 --yaml --max-procs 2 \
-o runtime-parallel.xml parallel-bare-tests.yaml

-o $(REGRESSIONS)/carfield/runtime-parallel.xml $(REGRESSIONS)/carfield/parallel-bare-tests.yaml

.PHONY: test-rt-mchan
## Run mchan tests on pulp-runtime
test-rt-mchan: pulp-runtime regression-tests
source env/carfield-env.sh; \
cd regression-tests && $(bwruntest) --proc-verbose -v \
-t 3600 --yaml --max-procs 2 \
-o runtime-mchan.xml pulp_cluster-mchan-tests.yaml
-o $(REGRESSIONS)/carfield/runtime-mchan.xml $(REGRESSIONS)/carfield/pulp_cluster-mchan-tests.yaml
15 changes: 15 additions & 0 deletions env/carfield-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,20 @@

# set up environment variables for rtl simulation, pulp-runtime and freertos
ROOTD=$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")/.." && pwd)

# If at IIS, set up appropriate questa version.
if test -f /etc/iis.version; then
export QUESTA=questa-2023.4-zr
export VLOG="$QUESTA vlog"
export VLIB="$QUESTA vlib"
export VMAP="$QUESTA vmap"
export VCOM="$QUESTA vcom"
export VOPT="$QUESTA vopt"
export VSIM="$QUESTA vsim"
export QUESTA_HOME=/usr/pack/${QUESTA}/questasim
export QUESTASIM_HOME=/usr/pack/${QUESTA}/questasim
export PULP_RUNTIME_GCC_TOOLCHAIN=/usr/pack/riscv-1.0-kgf/pulp-gcc-1.0.16
fi

source "$ROOTD/pulp-runtime/configs/carfield-cluster.sh"
source "$ROOTD/scripts/vsim.sh"
14 changes: 14 additions & 0 deletions env/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,19 @@

# set up environment variables for rtl simulation, pulp-runtime and freertos
ROOTD=$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")/.." && pwd)

# If at IIS, set up appropriate questa version.
if test -f /etc/iis.version; then
export QUESTA=questa-2023.4-zr
export VLOG="$QUESTA vlog"
export VLIB="$QUESTA vlib"
export VMAP="$QUESTA vmap"
export VCOM="$QUESTA vcom"
export VOPT="$QUESTA vopt"
export VSIM="$QUESTA vsim"
export QUESTA_HOME=/usr/pack/${QUESTA}/questasim
export QUESTASIM_HOME=/usr/pack/${QUESTA}/questasim
fi

source "$ROOTD/pulp-runtime/configs/pulp_cluster.sh"
source "$ROOTD/scripts/vsim.sh"
2 changes: 1 addition & 1 deletion include/pulp_soc_defines.sv
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

//PARAMETRES
`define NB_CLUSTERS 1
`define NB_CORES 8
`define NB_CORES 12
`define NB_DMAS 4
`define NB_MPERIPHS 1
`define NB_SPERIPHS 10
177 changes: 164 additions & 13 deletions packages/pulp_cluster_package.sv
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,115 @@
package pulp_cluster_package;

import rapid_recovery_pkg::*;

typedef bit [ 7:0] byte_t;
typedef bit [12:0] alias_t;
typedef bit [31:0] word_t;
typedef bit [63:0] doub_t;

// Core type
typedef enum logic[1:0] {
CV32,
RISCY,
IBEX
} core_type_e;

// PULP cluster configuration
typedef struct packed {
// Type of core in the cluster
core_type_e CoreType;
// Number of cores in the cluster
byte_t NumCores;
// Number of DMA TCDM plugs
byte_t DmaNumPlugs;
// Number of DMA outstanding transactions
byte_t DmaNumOutstandingBursts;
// DMA burst length in bits
word_t DmaBurstLength;
// Number of masters in crossbar peripherals
byte_t NumMstPeriphs;
// Number of slaves in crossbar peripherals
byte_t NumSlvPeriphs;
// Enable cluster aliasing
bit ClusterAlias;
// Base of the cluster alias
alias_t ClusterAliasBase;
// Number of internal synchronization stages
byte_t NumSyncStages;
// Enable HCI
bit UseHci;
// Size of the TCDM in bytes (power of two)
word_t TcdmSize;
// Number of TCDM banks (power of two)
byte_t TcdmNumBank;
// Enable HWPEs
bit HwpePresent;
// Number of memory ports available for HWPEs
byte_t HwpeNumPorts;
// Number if I$ banks
byte_t iCacheNumBanks;
// Number of I$ lines
byte_t iCacheNumLines;
// Number of I$ ways
byte_t iCacheNumWays; // default is 4
// Shared I$ size in bytes
word_t iCacheSharedSize; // default is 4096
// Private I$ size in bytes
word_t iCachePrivateSize; // default is 521
// Private I$ data width
byte_t iCachePrivateDataWidth;
// Enable reduced tag
bit EnableReducedTag;
// L2 size
word_t L2Size;
// Debug module base address
doub_t DmBaseAddr;
// BootROM base address
doub_t BootRomBaseAddr;
// Cores boot address
doub_t BootAddr;
// Enable private FPU
bit EnablePrivateFpu;
// Enable private FP division/sqrt
bit EnablePrivateFpDivSqrt;
// Enable shared FPUs
bit EnableSharedFpu;
// Enable shared FP division/sqrt
bit EnableSharedFpDivSqrt;
// Number of shared FPUs
byte_t NumSharedFpu;
// Number of AXI crossbar subordinate ports
byte_t NumAxiIn;
// Number of AXI crossbar manager ports
byte_t NumAxiOut;
// AXI ID width of crossbar subordinate ports
byte_t AxiIdInWidth;
// AXI ID width of crossbar manager ports
byte_t AxiIdOutWidth;
// AXI address width
byte_t AxiAddrWidth;
// AXI data width from external to cluster
byte_t AxiDataInWidth;
// AXI data width from cluster to external
byte_t AxiDataOutWidth;
// AXI user width
byte_t AxiUserWidth;
// Log depth of AXI CDC FIFOs
byte_t AxiCdcLogDepth; // old LOG_DEPTH
// Sinchronization stages of AXI CDC FIFOs
byte_t AxiCdcSyncStages;
// Input synchronization stages
byte_t SyncStages;
// Cluster base address
doub_t ClusterBaseAddr;
// Cluster peripherals offset
doub_t ClusterPeriphOffs;
// Cluster base external offset
doub_t ClusterExternalOffs;
// Address remap for virtualization
bit EnableRemapAddress;
} pulp_cluster_cfg_t;

parameter NB_SPERIPH_PLUGS_EU = 2;

// number of master and slave cluster periphs
Expand All @@ -35,19 +144,61 @@ package pulp_cluster_package;
parameter SPER_HMR_UNIT_ID = 8; // 0x2000 - 0x2400
parameter SPER_EXT_ID = 9; // 0x2400 - 0x2800
parameter SPER_ERROR_ID = 10; // 0x2800 - 0x2C00

// if set to 1, then instantiate APU in the cluster
// parameter APU_CLUSTER = 0;

// // if set to 1, the 0x0000_0000 to 0x0040_0000 is the alias of the current cluster address space (eg cluster 0 is from 0x1000_0000 to 0x1040_0000)
// parameter CLUSTER_ALIAS = 1;

// // if set to 1, the DEMUX peripherals (EU, MCHAN) are placed right before the test and set region.
// // This will steal 16KB from the 1MB TCDM reegion.
// // EU is mapped from 0x10100000 - 0x400
// // MCHAN regs are mapped from 0x10100000 - 0x800
// // remember to change the defines in the pulp.h as well to be coherent with this approach
// parameter DEM_PER_BEFORE_TCDM_TS = 0;

// The following parameters refer to the cluster AXI crossbar
localparam byte_t NumAxiSubordinatePorts = 4;
localparam byte_t NumAxiManagerPorts = 3;
localparam byte_t AxiSubordinateIdwidth = 4;
localparam byte_t AxiManagerIdwidth = AxiSubordinateIdwidth + $clog2(NumAxiSubordinatePorts);

localparam pulp_cluster_cfg_t PulpClusterDefaultCfg = '{
CoreType: CV32,
NumCores: 8,
DmaNumPlugs: 4,
DmaNumOutstandingBursts: 8,
DmaBurstLength: 256,
NumMstPeriphs: NB_MPERIPHS,
NumSlvPeriphs: NB_SPERIPHS,
ClusterAlias: 1,
ClusterAliasBase: 'h0,
NumSyncStages: 3,
UseHci: 1,
TcdmSize: 64*1024,
TcdmNumBank: 16,
HwpePresent: 0,
HwpeNumPorts: 0,
iCacheNumBanks: 2,
iCacheNumLines: 1,
iCacheNumWays: 4,
iCacheSharedSize: 4*1024,
iCachePrivateSize: 512,
iCachePrivateDataWidth: 32,
EnableReducedTag: 1,
L2Size: 1000*1024,
DmBaseAddr: 'h1A110000,
BootRomBaseAddr: 'h1A000000,
BootAddr: 'h1C000000,
EnablePrivateFpu: 1,
EnablePrivateFpDivSqrt: 0,
EnableSharedFpu: 0,
EnableSharedFpDivSqrt: 0,
NumSharedFpu: 0,
NumAxiIn: NumAxiSubordinatePorts,
NumAxiOut: NumAxiManagerPorts,
AxiIdInWidth: AxiSubordinateIdwidth,
AxiIdOutWidth:AxiManagerIdwidth,
AxiAddrWidth: 32,
AxiDataInWidth: 32,
AxiDataOutWidth: 32,
AxiUserWidth: 10,
AxiCdcLogDepth: 3,
AxiCdcSyncStages: 3,
ClusterBaseAddr: 'h10000000,
ClusterPeriphOffs: 'h00200000,
ClusterExternalOffs: 'h00400000,
EnableRemapAddress: 0,
default: '0
};

typedef struct packed {
logic gnt;
Expand Down
Loading

0 comments on commit 4bc352b

Please sign in to comment.