Cluster stacks are now dynamically allocated to avoid long preloading on netlist sim

This commit is contained in:
Germain Haugou 2020-04-02 11:09:49 +02:00
parent ecc4003354
commit 961edb14af
4 changed files with 27 additions and 1 deletions

View file

@ -78,6 +78,14 @@ int uart_read(int uart_id, void *buffer, uint32_t size);
void synch_barrier();
void *pi_l1_malloc(int cid, int size);
void pi_l1_free(int cid, void *chunk, int size);
void *pi_l2_malloc(int size);
void pi_l2_free(void *_chunk, int size);
#endif

View file

@ -90,6 +90,17 @@ void alloc_init_l1(int cid)
{
pos_alloc_init(&pos_alloc_l1[cid], pos_l1_base(cid), pos_l1_size(cid));
}
void *pi_l1_malloc(int cid, int size)
{
return pos_alloc(&pos_alloc_l1[cid], size);
}
void pi_l1_free(int cid, void *chunk, int size)
{
return pos_free(&pos_alloc_l1[cid], chunk, size);
}
#endif

View file

@ -20,7 +20,7 @@
volatile void *cluster_entry;
L1_DATA char cluster_stacks[ARCHI_CLUSTER_NB_PE*CLUSTER_STACK_SIZE];
L1_DATA char *cluster_stacks;
static volatile int cluster_running;
@ -78,6 +78,12 @@ void cluster_start(int cid, int (*entry)())
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;
// Fetch all cores

View file

@ -160,6 +160,7 @@ pos_semihosting_call:
#if defined(ARCHI_HAS_CLUSTER)
pe_start:
la x2, cluster_stacks
lw x2, 0(x2)
li x3, CLUSTER_STACK_SIZE
addi a1, a1, 1
mul x1, x3, a1