Commit d8304757 authored by Daniela Genius's avatar Daniela Genius
Browse files

model introducing hw accelerators to generated SoClib platform

parent 0c616996
This diff is collapsed.
......@@ -43,6 +43,7 @@ package ddtranslatorSoclib.toSoclib;
import avatartranslator.*;
import ddtranslatorSoclib.AvatarRAM;
import ddtranslatorSoclib.AvatarCoproMWMR;
import ddtranslatorSoclib.AvatarTask;
import ddtranslatorSoclib.AvatarddSpecification;
import ddtranslatorSoclib.toTopCell.TopCellGenerator;
......@@ -1033,8 +1034,7 @@ public class TasksAndMainGenerator {
mainFile.appendToMainCode("/* Activating randomness */" + CR);
mainFile.appendToMainCode("initRandom();" + CR);
/* DG 7.9.2017 additions for use of hardware MWMR controller */
/* Use of hardware MWMR controller */
/*void mwmr_hw_init( void *coproc, enum SoclibMwmrWay way,
size_t no, const struct mwmr_s* mwmr );*/
......@@ -1044,14 +1044,78 @@ public class TasksAndMainGenerator {
/* mwmr_t *p_mwmr_in = (mwmr_t*)(base(MWMRd)+0x1000);*/
/*mwmr_initialize_pointer(p_mwmr_in, WIDTH, DEPTH, fifo_data_in, lock_in );*/
/*mwmr_initialize_pointer(p_mwmr_in, WIDTH, DEPTH, fifo_data_in, lock_in );*/
/* mwmr_hw_init(base(MWMR), MWMR_TO_COPROC, 0 , p_mwmr_in);*/
/*for all coproc
uint32_t *fifo = (uint32_t*) + i*4096;*/
//DG 11.09.
int width = 4; //nb_params;//ToDo
/* mwmr_hw_init(base(MWMR), MWMR_TO_COPROC, 0 , p_mwmr_in);*/
int i=0;
int MWMRd_SIZE=12288;
for (AvatarCoproMWMR copro : TopCellGenerator.avatardd.getAllCoproMWMR()){
for(AvatarRelation ar: avspec.getRelations()) {
if(ar.nbOfSignals()!=0){
for(i=0; i<ar.nbOfSignals() ; i++) {
if(((ar.block1.getName()==copro.getName())||(ar.block2.getName()==copro.getName()))){
mainFile.appendToMainCode("uint32_t *fifo_data"+i+"=(uint32_t*)(0x"+Integer.toHexString(538968064+MWMRd_SIZE*i)+");"+CR);
//one single RAMLOCKS, fixed address
mainFile.appendToMainCode("uint32_t *fifo_lock"+i+"= (uint32_t*)("+0x1A200000+");"+CR);
mainFile.appendToMainCode("mwmr_t *"+getChannelName(ar, i)+" = (mwmr_t*)(0x"+Integer.toHexString(538968064+MWMRd_SIZE*i)+");"+CR);
//depth 100 per default, to be changed later
mainFile.appendToMainCode("mwmr_initialize_pointer("+getChannelName(ar, i)+","+(width*4)+", 100, fifo_data"+i+",fifo_lock"+i+");"+CR);
//DG 10.09. il faut encore associer p_mwmr_i avec le canal dans le main.c
//mainFile.appendToBeforeMainCode("struct mwmr_s "+getChannelName(ar, i) +" CHANNEL"+k+";" + CR2);
i++;
}
}
}
}
}
i=0;
int MWMR_SIZE=4096;
for (AvatarCoproMWMR copro : TopCellGenerator.avatardd.getAllCoproMWMR()){
for(AvatarRelation ar: avspec.getRelations()) {
if(ar.nbOfSignals()!=0){
for(i=0; i<ar.nbOfSignals() ; i++) {
// detect if there is a coprocessors implicated in the FIFO MWMR communication
//in this case we have to address the hardware wrapper rather than the software channel
if(((ar.block1.getName()==copro.getName())||(ar.block2.getName()==copro.getName()))){
// 0 = MWMR_FROM_COPROC = READ
// 1 = MWMR_FROM_COPROC = WRITE
//distinguish incoming and outgoing FIFOs
AvatarSignal sig = ar.getSignal1(i);
if(sig.isIn()){
mainFile.appendToMainCode("mwmr_hw_init(0xA0"+ Integer.toHexString(2097152+MWMR_SIZE*i)+","+ 0 +",1,"+getChannelName(ar, i)+");"+CR);
}
else{ //sig.isOut()
mainFile.appendToMainCode("mwmr_hw_init(0xA0"+ Integer.toHexString(2097152+MWMR_SIZE*i)+","+ 0 +",0,"+getChannelName(ar, i)+");"+CR);
}
i++;
}
}
}
}
}
/*for all coproc
uint32_t *fifo = (uint32_t*) + i*4096;*/
/* end ajoute 7.9. */
mainFile.appendToMainCode("/* Initializing the main mutex */" + CR);
mainFile.appendToMainCode("if (pthread_mutex_init(&__mainMutex, NULL) < 0) { exit(-1);}" + CR + CR);
......@@ -1073,7 +1137,7 @@ public class TasksAndMainGenerator {
String channelString= "";
int j=0;
for(AvatarRelation ar: avspec.getRelations()) {
int i;
// int i;
if(ar.nbOfSignals()!=0){
for(i=0; i<ar.nbOfSignals() ; i++) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment