mirror of
https://github.com/saymrwulf/pulp-runtime.git
synced 2026-11-18 08:54:44 +00:00
Add tcls config to HAL, ensure proper core number is used
This commit is contained in:
parent
ea8a9e055d
commit
dd8975eae5
6 changed files with 88 additions and 4 deletions
17
configs/tcls_pulp_ibex.sh
Normal file
17
configs/tcls_pulp_ibex.sh
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
export PULPRT_TARGET=pulp
|
||||||
|
export PULPRUN_TARGET=pulp
|
||||||
|
export USE_IBEX=1
|
||||||
|
export ARCHI_TCLS=1
|
||||||
|
|
||||||
|
if [ -n "${ZSH_VERSION:-}" ]; then
|
||||||
|
DIR="$(readlink -f -- "${(%):-%x}")"
|
||||||
|
scriptDir="$(dirname $DIR)"
|
||||||
|
else
|
||||||
|
|
||||||
|
scriptDir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
source $scriptDir/common.sh
|
||||||
|
|
@ -40,4 +40,8 @@
|
||||||
#include "hal/udma/spim/udma_spim_v3.h"
|
#include "hal/udma/spim/udma_spim_v3.h"
|
||||||
#include "hal/udma/uart/udma_uart_v1.h"
|
#include "hal/udma/uart/udma_uart_v1.h"
|
||||||
|
|
||||||
|
#ifdef ARCHI_TCLS
|
||||||
|
#include "hal/tcls/tcls.h"
|
||||||
|
#endif // ARCHI_TCLS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
47
include/hal/tcls/tcls.h
Normal file
47
include/hal/tcls/tcls.h
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2021 ETH Zurich and University of Bologna
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __HAL_TCLS_H
|
||||||
|
#define __HAL_TCLS_H
|
||||||
|
|
||||||
|
#include "archi/pulp.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
static inline void enable_tcls() {
|
||||||
|
int * tcls_config;
|
||||||
|
for (int i = 0; i < 2; i++) {
|
||||||
|
tcls_config = (int*)(ARCHI_CLUSTER_GLOBAL_ADDR(0) + ARCHI_TCLS_ADDR + 0x4 + i*0x100);
|
||||||
|
*tcls_config = 1;
|
||||||
|
}
|
||||||
|
printf("In TCLS config\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void disable_tcls() {
|
||||||
|
int * tcls_config;
|
||||||
|
for (int i = 0; i < 2; i++) {
|
||||||
|
tcls_config = (int*)(ARCHI_CLUSTER_GLOBAL_ADDR(0) + ARCHI_TCLS_ADDR + 0x4 + i*0x100);
|
||||||
|
*tcls_config = 0;
|
||||||
|
}
|
||||||
|
printf("TCLS disabled\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int check_tcls_enabled() {
|
||||||
|
int * tcls_config;
|
||||||
|
tcls_config = (int*)(ARCHI_CLUSTER_GLOBAL_ADDR(0) + ARCHI_TCLS_ADDR + 0x4);
|
||||||
|
return *tcls_config > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __HAL_TCLS_H
|
||||||
|
|
@ -27,6 +27,9 @@
|
||||||
#include <archi/pulp.h>
|
#include <archi/pulp.h>
|
||||||
#include <hal/pulp.h>
|
#include <hal/pulp.h>
|
||||||
#include <data/data.h>
|
#include <data/data.h>
|
||||||
|
#ifdef ARCHI_TCLS
|
||||||
|
#include <hal/tcls/tcls.h>
|
||||||
|
#endif // ARCHI_TCLS
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PI_FREQ_DOMAIN_FC = 0,
|
PI_FREQ_DOMAIN_FC = 0,
|
||||||
|
|
@ -66,7 +69,16 @@ void _start();
|
||||||
#define get_cluster_id hal_cluster_id
|
#define get_cluster_id hal_cluster_id
|
||||||
|
|
||||||
#ifdef ARCHI_CLUSTER_NB_PE
|
#ifdef ARCHI_CLUSTER_NB_PE
|
||||||
|
#ifndef ARCHI_TCLS
|
||||||
static inline int get_core_num() { return ARCHI_CLUSTER_NB_PE; }
|
static inline int get_core_num() { return ARCHI_CLUSTER_NB_PE; }
|
||||||
|
#else // ARCHI_TCLS
|
||||||
|
static inline int get_core_num() {
|
||||||
|
if (check_tcls_enabled()) {
|
||||||
|
return ARCHI_CLUSTER_NB_PE/3;
|
||||||
|
}
|
||||||
|
return ARCHI_CLUSTER_NB_PE;
|
||||||
|
}
|
||||||
|
#endif // ARCHI_TCLS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ static void cluster_core_init()
|
||||||
{
|
{
|
||||||
eu_evt_maskSet((1<<PULP_DISPATCH_EVENT) | (1<<PULP_MUTEX_EVENT) | (1<<PULP_HW_BAR_EVENT));
|
eu_evt_maskSet((1<<PULP_DISPATCH_EVENT) | (1<<PULP_MUTEX_EVENT) | (1<<PULP_HW_BAR_EVENT));
|
||||||
|
|
||||||
eu_bar_setup(eu_bar_addr(0), (1<<ARCHI_CLUSTER_NB_PE) - 1);
|
eu_bar_setup(eu_bar_addr(0), (1<<get_core_num()) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cluster_entry_stub()
|
void cluster_entry_stub()
|
||||||
|
|
@ -80,19 +80,19 @@ void cluster_start(int cid, int (*entry)())
|
||||||
|
|
||||||
alloc_init_l1(cid);
|
alloc_init_l1(cid);
|
||||||
|
|
||||||
cluster_stacks = pi_l1_malloc(cid, ARCHI_CLUSTER_NB_PE*CLUSTER_STACK_SIZE);
|
cluster_stacks = pi_l1_malloc(cid, get_core_num()*CLUSTER_STACK_SIZE);
|
||||||
if (cluster_stacks == NULL)
|
if (cluster_stacks == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cluster_running = 1;
|
cluster_running = 1;
|
||||||
|
|
||||||
// Fetch all cores
|
// Fetch all cores
|
||||||
for (int i=0; i<ARCHI_CLUSTER_NB_PE; i++)
|
for (int i=0; i<get_core_num(); i++)
|
||||||
{
|
{
|
||||||
plp_ctrl_core_bootaddr_set_remote(cid, i, (int)_start);
|
plp_ctrl_core_bootaddr_set_remote(cid, i, (int)_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
eoc_fetch_enable_remote(cid, (1<<ARCHI_CLUSTER_NB_PE) - 1);
|
eoc_fetch_enable_remote(cid, (1<<get_core_num()) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,10 @@ PULP_ARCH_LDFLAGS ?= -march=rv32imcxgap9
|
||||||
PULP_ARCH_OBJDFLAGS ?= -Mmarch=rv32imcxgap9
|
PULP_ARCH_OBJDFLAGS ?= -Mmarch=rv32imcxgap9
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef ARCHI_TCLS
|
||||||
|
PULP_CFLAGS += -DARCHI_TCLS
|
||||||
|
endif
|
||||||
|
|
||||||
PULP_CFLAGS += -fdata-sections -ffunction-sections -include chips/pulp/config.h -I$(PULPRT_HOME)/include/chips/pulp
|
PULP_CFLAGS += -fdata-sections -ffunction-sections -include chips/pulp/config.h -I$(PULPRT_HOME)/include/chips/pulp
|
||||||
PULP_OMP_CFLAGS += -fopenmp -mnativeomp
|
PULP_OMP_CFLAGS += -fopenmp -mnativeomp
|
||||||
PULP_LDFLAGS += -nostartfiles -nostdlib -Wl,--gc-sections -L$(PULPRT_HOME)/kernel -Tchips/pulp/link.ld -lgcc
|
PULP_LDFLAGS += -nostartfiles -nostdlib -Wl,--gc-sections -L$(PULPRT_HOME)/kernel -Tchips/pulp/link.ld -lgcc
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue