diff --git a/MPSoC/src/syncchannel.c b/MPSoC/src/syncchannel.c index 09dad20df3fe15746d2c029c4159e5a58d360b70..b958f318513ff89e88df9dc09c60d0b7a42ac1e5 100755 --- a/MPSoC/src/syncchannel.c +++ b/MPSoC/src/syncchannel.c @@ -16,18 +16,30 @@ void mwmr_sync_flush(struct mwmr_s *fifo){ } } -/* all synchronous communications use MWMR channels of size 1, enforcing synchronization */ - int sync_read( struct mwmr_s *fifo, void *_ptr, int lensw ){ - debugMsg("###before read "); - mwmr_read(fifo,_ptr,1); - debugMsg("###after read "); + + debugInt("debug fifo \n",fifo); + debugInt("debug ptr \n",_ptr); + debugInt("debug lensw \n", lensw); + debugInt("debug fifo status address \n", &(fifo->status)); + debugInt("debug fifo status \n", (fifo->status)); + debugInt("debug fifo lock address\n", &(fifo->status->lock)); + debugInt("debug fifo lock \n", fifo->status->lock); + mwmr_read(fifo,_ptr,lensw); + } int sync_write( struct mwmr_s *fifo, void *_ptr, int lensw ){ - debugMsg("###mwmr channel before write "); - mwmr_write(fifo,_ptr,1); - debugMsg("####mwmr channel after write: "); + + debugInt("debug fifo \n",fifo); + debugInt("debug ptr \n",_ptr); + debugInt("debug lensw \n", lensw); + debugInt("debug fifo status address \n", &(fifo->status)); + debugInt("debug fifo status \n", (fifo->status)); + debugInt("debug fifo lock address\n", &(fifo->status->lock)); + debugInt("debug fifo lock \n", fifo->status->lock); + mwmr_write(fifo,_ptr,lensw); + } syncchannel *getNewSyncchannel(char *outname, char *inname, struct mwmr_s *fifo) { @@ -41,6 +53,9 @@ syncchannel *getNewSyncchannel(char *outname, char *inname, struct mwmr_s *fifo) syncch->outWaitQueue = NULL; syncch->isBroadcast = false; syncch->mwmr_fifo=fifo; + debugInt("syncchannel address \n",syncch->mwmr_fifo); + debugInt("syncchannel depth \n", syncch->mwmr_fifo->depth); + debugInt("syncchannel width \n",syncch->mwmr_fifo->width); return syncch; } diff --git a/src/ddtranslatorSoclib/toSoclib/TasksAndMainGenerator.java b/src/ddtranslatorSoclib/toSoclib/TasksAndMainGenerator.java index a8124e673237eb555b56ab3c53b56c46d1626f75..6c87f252f324f23a0eba8f7ef90aad768643c613 100755 --- a/src/ddtranslatorSoclib/toSoclib/TasksAndMainGenerator.java +++ b/src/ddtranslatorSoclib/toSoclib/TasksAndMainGenerator.java @@ -238,10 +238,10 @@ public class TasksAndMainGenerator { mainFile.appendToMainCode(getChannelName(ar, i) + "_status.wptr = 0;" + CR); mainFile.appendToMainCode(getChannelName(ar, i) + "_status.usage = 0;" + CR); mainFile.appendToMainCode(getChannelName(ar, i) + "_status.lock = 0;" + CR2); - + //DG 10.0.2 width=1?? mainFile.appendToMainCode(getChannelName(ar, i) + ".width = 1;" + CR); - mainFile.appendToMainCode(getChannelName(ar, i) + ".depth = 1;" + CR); - mainFile.appendToMainCode(getChannelName(ar, i) + ".gdepth = 1;" + CR); + mainFile.appendToMainCode(getChannelName(ar, i) + ".depth = 4;" + CR);//DG 10.02.2017 systematiquement des entiers pour le moment + mainFile.appendToMainCode(getChannelName(ar, i) + ".gdepth = " +getChannelName(ar, i)+".depth;" + CR); mainFile.appendToMainCode(getChannelName(ar, i) + ".buffer = "+getChannelName(ar, i)+"_data;" + CR); mainFile.appendToMainCode(getChannelName(ar, i) + ".status = &"+getChannelName(ar, i)+"_status;" + CR2); @@ -256,16 +256,7 @@ public class TasksAndMainGenerator { mainFile.appendToMainCode(getChannelName(ar, i)+".status->rptr=0;" + CR); mainFile.appendToMainCode(getChannelName(ar, i)+".status->usage=0;" + CR); mainFile.appendToMainCode(getChannelName(ar, i) + ".status->wptr =0;" + CR); - - //mainFile.appendToBeforeMainCode("uint32_t const "+ getChannelName(ar, i)+"_lock LOCK"+i+";" + CR); - - //DG 26.01.2017 corrected gros bug i remplace - /* mainFile.appendToBeforeMainCode("uint32_t const "+ getChannelName(ar, i)+"_lock LOCK"+i+";" + CR); - mainFile.appendToBeforeMainCode("struct mwmr_status_s "+ getChannelName(ar, i) +"_status CHANNEL"+j+";" + CR); - - mainFile.appendToBeforeMainCode("uint8_t "+getChannelName(ar, i) +"_data[32] CHANNEL"+i+";" + CR); - - mainFile.appendToBeforeMainCode("struct mwmr_s "+getChannelName(ar, i) +" CHANNEL"+i+";" + CR2);*/ + mainFile.appendToBeforeMainCode("uint32_t const "+ getChannelName(ar, i)+"_lock LOCK"+ar.getId()+";" + CR); mainFile.appendToBeforeMainCode("struct mwmr_status_s "+ getChannelName(ar, i) +"_status CHANNEL"+ar.getId()+";" + CR); @@ -297,7 +288,7 @@ public class TasksAndMainGenerator { mainFile.appendToMainCode(getChannelName(ar, i) + "_status.usage = 0;" + CR); mainFile.appendToMainCode(getChannelName(ar, i) + "_status.lock = 0;" + CR2); - + //DG 10.2. width=1?? mainFile.appendToMainCode(getChannelName(ar, i) + ".width = 1;" + CR); mainFile.appendToMainCode(getChannelName(ar, i) + ".depth = "+ ar.getSizeOfFIFO()+"1;" + CR); mainFile.appendToMainCode(getChannelName(ar, i) + ".gdepth = "+getChannelName(ar, i)+".depth;" + CR); //gdepth = depth for sync fifo @@ -318,25 +309,20 @@ public class TasksAndMainGenerator { /* force init because mutekh initializer does not work her */ mainFile.appendToMainCode(getChannelName(ar, i) + ".status =&"+ getChannelName(ar, i)+"_status;" + CR); - mainFile.appendToMainCode(getChannelName(ar, i) +".status->lock=0;" + CR); - mainFile.appendToMainCode(getChannelName(ar, i)+".status->rptr=0;" + CR); - mainFile.appendToMainCode(getChannelName(ar, i)+".status->usage=0;" + CR); - mainFile.appendToMainCode(getChannelName(ar, i)+".status->wptr=0;" + CR); + mainFile.appendToMainCode(getChannelName(ar, i) +".status->lock=0;" + CR); + mainFile.appendToMainCode(getChannelName(ar, i)+".status->rptr=0;" + CR); + mainFile.appendToMainCode(getChannelName(ar, i)+".status->usage=0;" + CR); + mainFile.appendToMainCode(getChannelName(ar, i)+".status->wptr=0;" + CR); - /* mainFile.appendToBeforeMainCode("uint32_t const "+ getChannelName(ar, i)+"_lock LOCK"+i+";" + CR); - - - mainFile.appendToBeforeMainCode("struct mwmr_status_s "+ getChannelName(ar, i) +"_status CHANNEL"+i+";" + CR); - mainFile.appendToBeforeMainCode("uint8_t "+getChannelName(ar, i) +"_data[32] CHANNEL"+i+";" + CR); - mainFile.appendToBeforeMainCode("struct mwmr_s "+getChannelName(ar, i) + " CHANNEL"+i+";" + CR2);*/ - int seg_no=0; + + int seg_no=0; mainFile.appendToBeforeMainCode("uint32_t const "+ getChannelName(ar, i)+"_lock LOCK"+ar.getId()+";" + CR); mainFile.appendToBeforeMainCode("struct mwmr_status_s "+ getChannelName(ar, i) +"_status CHANNEL"+ar.getId()+";" + CR); mainFile.appendToBeforeMainCode("uint8_t "+getChannelName(ar, i) +"_data[32] CHANNEL"+ar.getId()+";" + CR); mainFile.appendToBeforeMainCode("struct mwmr_s "+getChannelName(ar, i) +" CHANNEL"+ar.getId()+";" + CR2); - //j++; + } } } @@ -350,7 +336,7 @@ public class TasksAndMainGenerator { return task.getCPUNo(); } } - //return 0; + return -1; } @@ -366,8 +352,7 @@ public class TasksAndMainGenerator { public void makeTask(AvatarBlock block , int cpuId) { TaskFileSoclib taskFile = new TaskFileSoclib(block.getName(),cpuId); - //taskFile.addToHeaderCode("#include \"main.h\"" + CR); - //taskFile.addToMainCode("#include \"" + block.getName() + ".h\""); + if (includeUserCode) { String tmp = block.getGlobalCode(); if (tmp != null) {