mirror of
https://github.com/saymrwulf/pulp-runtime.git
synced 2026-05-23 22:13:47 +00:00
Hardcoded changes for cluster standalone.
This commit is contained in:
parent
1ddf10447c
commit
b921066dc3
8 changed files with 91 additions and 60 deletions
|
|
@ -59,7 +59,8 @@
|
|||
#define ARCHI_SOC_EU_ADDR ( ARCHI_SOC_PERIPHERALS_ADDR + ARCHI_SOC_EU_OFFSET )
|
||||
#define ARCHI_FC_ITC_ADDR ( ARCHI_SOC_PERIPHERALS_ADDR + ARCHI_FC_ITC_OFFSET )
|
||||
#define ARCHI_FC_TIMER_ADDR ( ARCHI_SOC_PERIPHERALS_ADDR + ARCHI_FC_TIMER_OFFSET )
|
||||
#define ARCHI_STDOUT_ADDR ( ARCHI_SOC_PERIPHERALS_ADDR + ARCHI_STDOUT_OFFSET )
|
||||
//#define ARCHI_STDOUT_ADDR ( ARCHI_SOC_PERIPHERALS_ADDR + ARCHI_STDOUT_OFFSET )
|
||||
#define ARCHI_STDOUT_ADDR 0x40000000
|
||||
|
||||
#define ARCHI_FLL_AREA_SIZE 0x00000010
|
||||
|
||||
|
|
|
|||
|
|
@ -105,12 +105,12 @@
|
|||
* FC
|
||||
*/
|
||||
|
||||
#ifndef ARCHI_NO_FC
|
||||
#define ARCHI_FC_CID 31
|
||||
#define ARCHI_HAS_FC_ITC 1
|
||||
#define ARCHI_HAS_FC 1
|
||||
#define ARCHI_CORE_HAS_1_10 1
|
||||
#endif
|
||||
//#ifndef ARCHI_NO_FC
|
||||
//#define ARCHI_FC_CID 31
|
||||
//#define ARCHI_HAS_FC_ITC 1
|
||||
//#define ARCHI_HAS_FC 1
|
||||
//#define ARCHI_CORE_HAS_1_10 1
|
||||
//#endif
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ void run_benchmark(testcase_t *test, testresult_t *result)
|
|||
|
||||
bench_timer_reset();
|
||||
|
||||
printf("x\n", test);
|
||||
test->test(result, bench_timer_start, bench_timer_stop);
|
||||
|
||||
result->time = get_time();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ OUTPUT_ARCH(riscv)
|
|||
ENTRY( _start )
|
||||
MEMORY
|
||||
{
|
||||
L2 : ORIGIN = 0x1c000004, LENGTH = 0x0007fffc
|
||||
L2 : ORIGIN = 0x1c000000, LENGTH = 0x0007fffc
|
||||
L1 : ORIGIN = 0x10000004, LENGTH = 0x0000fffc
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,18 +18,18 @@
|
|||
|
||||
void pos_soc_init()
|
||||
{
|
||||
#if __PLATFORM__ != ARCHI_PLATFORM_FPGA
|
||||
|
||||
pos_fll_constructor();
|
||||
|
||||
pos_freq_domains[PI_FREQ_DOMAIN_FC] = pos_fll_init(POS_FLL_FC);
|
||||
|
||||
pos_freq_domains[PI_FREQ_DOMAIN_PERIPH] = pos_fll_init(POS_FLL_PERIPH);
|
||||
|
||||
|
||||
pos_freq_domains[PI_FREQ_DOMAIN_CL] = pos_fll_init(POS_FLL_CL);
|
||||
|
||||
#else
|
||||
//#if __PLATFORM__ != ARCHI_PLATFORM_FPGA
|
||||
//
|
||||
// pos_fll_constructor();
|
||||
//
|
||||
// pos_freq_domains[PI_FREQ_DOMAIN_FC] = pos_fll_init(POS_FLL_FC);
|
||||
//
|
||||
// pos_freq_domains[PI_FREQ_DOMAIN_PERIPH] = pos_fll_init(POS_FLL_PERIPH);
|
||||
//
|
||||
//
|
||||
// pos_freq_domains[PI_FREQ_DOMAIN_CL] = pos_fll_init(POS_FLL_CL);
|
||||
//
|
||||
//#else
|
||||
|
||||
pos_freq_domains[PI_FREQ_DOMAIN_FC] = ARCHI_FPGA_SOC_FREQUENCY;
|
||||
|
||||
|
|
@ -37,6 +37,6 @@ void pos_soc_init()
|
|||
|
||||
pos_freq_domains[PI_FREQ_DOMAIN_CL] = ARCHI_FPGA_CL_FREQUENCY;
|
||||
|
||||
#endif
|
||||
//#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,15 +17,16 @@
|
|||
#include "pulp.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
//#include "init.c"
|
||||
|
||||
volatile void *cluster_entry;
|
||||
|
||||
L1_DATA char *cluster_stacks;
|
||||
|
||||
|
||||
static volatile int cluster_running;
|
||||
static volatile int cluster_retval;
|
||||
|
||||
extern int main(int argc, const char * const argv[]);
|
||||
|
||||
static void pos_wait_forever()
|
||||
{
|
||||
|
|
@ -43,12 +44,22 @@ static void cluster_core_init()
|
|||
eu_bar_setup(eu_bar_addr(0), (1<<ARCHI_CLUSTER_NB_PE) - 1);
|
||||
}
|
||||
|
||||
// executed by the FC!
|
||||
void cluster_entry_stub()
|
||||
{
|
||||
cluster_core_init();
|
||||
|
||||
synch_barrier();
|
||||
|
||||
if(hal_core_id()==0)
|
||||
cluster_start(hal_cluster_id(), main);
|
||||
|
||||
synch_barrier();
|
||||
|
||||
int retval = ((int (*)())cluster_entry)();
|
||||
|
||||
synch_barrier();
|
||||
|
||||
if (hal_core_id() == 0)
|
||||
{
|
||||
cluster_retval = retval;
|
||||
|
|
@ -65,7 +76,7 @@ void cluster_start(int cid, int (*entry)())
|
|||
cluster_entry = entry;
|
||||
|
||||
// Init FLL
|
||||
pos_fll_init(POS_FLL_CL);
|
||||
//pos_fll_init(POS_FLL_CL);
|
||||
|
||||
// Initialize cluster L1 memory allocator
|
||||
alloc_init_l1(cid);
|
||||
|
|
@ -73,26 +84,26 @@ void cluster_start(int cid, int (*entry)())
|
|||
// Activate icache
|
||||
hal_icache_cluster_enable(cid);
|
||||
|
||||
if (!hal_is_fc())
|
||||
{
|
||||
cluster_core_init();
|
||||
}
|
||||
// if (!hal_is_fc())
|
||||
// {
|
||||
// cluster_core_init();
|
||||
// }
|
||||
|
||||
alloc_init_l1(cid);
|
||||
|
||||
cluster_stacks = pi_l1_malloc(cid, ARCHI_CLUSTER_NB_PE*CLUSTER_STACK_SIZE);
|
||||
if (cluster_stacks == NULL)
|
||||
return;
|
||||
|
||||
cluster_running = 1;
|
||||
|
||||
// if (cluster_stacks == NULL)
|
||||
// return;
|
||||
//
|
||||
// cluster_running = 1;
|
||||
//
|
||||
// Fetch all cores
|
||||
for (int i=0; i<ARCHI_CLUSTER_NB_PE; i++)
|
||||
{
|
||||
plp_ctrl_core_bootaddr_set_remote(cid, i, (int)_start);
|
||||
}
|
||||
|
||||
eoc_fetch_enable_remote(cid, (1<<ARCHI_CLUSTER_NB_PE) - 1);
|
||||
// for (int i=0; i<ARCHI_CLUSTER_NB_PE; i++)
|
||||
// {
|
||||
// plp_ctrl_core_bootaddr_set_remote(cid, i, (int)_start);
|
||||
// }
|
||||
//
|
||||
// eoc_fetch_enable_remote(cid, (1<<ARCHI_CLUSTER_NB_PE) - 1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -27,22 +27,28 @@ pos_init_entry:
|
|||
csrr a0, 0xF14
|
||||
andi a1, a0, 0x1f
|
||||
srli a0, a0, 5
|
||||
#ifdef ARCHI_CL_BOOT
|
||||
|
||||
li a2, ARCHI_FC_CID
|
||||
beq a0, a2, do_cl_boot
|
||||
bnez a1, pe_start
|
||||
|
||||
#else
|
||||
|
||||
#ifdef ARCHI_FC_CID
|
||||
li a2, ARCHI_FC_CID
|
||||
bne a0, a2, pe_start
|
||||
#else
|
||||
bnez a1, pe_start
|
||||
#endif
|
||||
#endif
|
||||
|
||||
li x2, 0x10200000
|
||||
li x3, 0x1
|
||||
la x4, _start
|
||||
sw x4, 0x40(x2)
|
||||
sw x3, 8(x2)
|
||||
//#ifdef ARCHI_CL_BOOT
|
||||
//
|
||||
// li a2, ARCHI_FC_CID
|
||||
// j do_cl_boot
|
||||
//// beq a0, a2, do_cl_boot // FC will go there
|
||||
//// bnez a1, pe_start // cluster will go here
|
||||
//
|
||||
//#else
|
||||
//
|
||||
//#ifdef ARCHI_FC_CID
|
||||
// li a2, ARCHI_FC_CID
|
||||
// bne a0, a2, pe_start
|
||||
//#else
|
||||
// bnez a1, pe_start
|
||||
//#endif
|
||||
//#endif
|
||||
//
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -159,7 +165,7 @@ pe_start:
|
|||
addi a1, a1, 1
|
||||
mul x1, x3, a1
|
||||
add x2, x2, x1
|
||||
j cluster_entry_stub
|
||||
j cluster_entry_stub // fc will go here
|
||||
#endif
|
||||
|
||||
do_cl_boot:
|
||||
|
|
@ -168,6 +174,8 @@ do_cl_boot:
|
|||
la x4, _start
|
||||
sw x4, 0x40(x2)
|
||||
sw x3, 8(x2)
|
||||
li x2, 0x1a109800
|
||||
sw x0, 0(x2)
|
||||
|
||||
loop:
|
||||
li x2, 0x1a109800
|
||||
|
|
|
|||
|
|
@ -58,21 +58,23 @@ void pos_init_start()
|
|||
hal_pmu_bypass_set (ARCHI_REG_FIELD_SET (hal_pmu_bypass_get (), 1, 11, 1) );
|
||||
#endif
|
||||
|
||||
if(hal_core_id()==0) {
|
||||
pos_soc_init();
|
||||
|
||||
pos_irq_init();
|
||||
|
||||
pos_soc_event_init();
|
||||
// pos_soc_event_init();
|
||||
|
||||
// Initialize first the memory allocators and the utils so that they are
|
||||
// available for constructors, especially to let them declare
|
||||
// callbacks
|
||||
//__rt_utils_init();
|
||||
|
||||
pos_allocs_init();
|
||||
|
||||
// Call global and static constructors
|
||||
// Each module may do private initializations there
|
||||
pos_init_do_ctors();
|
||||
//pos_init_do_ctors();
|
||||
|
||||
// Now that the system is ready, activate IO
|
||||
pos_io_start();
|
||||
|
|
@ -80,10 +82,18 @@ void pos_init_start()
|
|||
// Now now the minimal init are done, we can activate interruptions
|
||||
hal_irq_enable();
|
||||
|
||||
if (!hal_is_fc())
|
||||
{
|
||||
cluster_start(hal_cluster_id(), main);
|
||||
}
|
||||
|
||||
cluster_entry_stub();
|
||||
|
||||
//if (!hal_is_fc())
|
||||
//{
|
||||
// cluster_start(hal_cluster_id(), main);
|
||||
//} else
|
||||
//{
|
||||
// cluster_entry_stub();
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue