diff --git a/src/ddtranslatorSoclib/toSoclib/TasksAndMainGenerator.java b/src/ddtranslatorSoclib/toSoclib/TasksAndMainGenerator.java index 92c68c09219df8f76ec51c9901bb6fd13058a79f..73dcc23310ca43fb59cfb3389e9a18e6f459dec6 100755 --- a/src/ddtranslatorSoclib/toSoclib/TasksAndMainGenerator.java +++ b/src/ddtranslatorSoclib/toSoclib/TasksAndMainGenerator.java @@ -238,10 +238,16 @@ 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) + ".width = 1;" + CR); - mainFile.appendToMainCode(getChannelName(ar, i) + ".depth = 1;" + CR); - mainFile.appendToMainCode(getChannelName(ar, i) + ".gdepth = 1;" + CR); + mainFile.appendToMainCode(getChannelName(ar, i) + ".width = 4;" + CR); + //DG 16.02. + AvatarSignal sig = ar.getSignal1(0);//DG boucle? + int nbParams= sig.getNbParams(); + + mainFile.appendToMainCode(getChannelName(ar, i) + ".depth = "+(nbParams*4)+";" + CR); + 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 +262,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 +294,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 +315,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,19 +342,23 @@ public class TasksAndMainGenerator { return task.getCPUNo(); } } - return 0; + + return -1; } public void makeTasks() { for(AvatarBlock block: avspec.getListOfBlocks()) { - makeTask(block,FindCPUidFromTask(block)); + if (FindCPUidFromTask(block)!=-1) + makeTask(block,FindCPUidFromTask(block)); + else { + System.out.println("Warning: Unmapped Block "+block.getName()); + } } } 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) { diff --git a/src/ddtranslatorSoclib/toTopCell/Code.java b/src/ddtranslatorSoclib/toTopCell/Code.java index 0dacf527b3764dec9e86ae6dcf81facaa2903307..a87425e37dc0b1c17e9358d3bf155f006d58b18d 100755 --- a/src/ddtranslatorSoclib/toTopCell/Code.java +++ b/src/ddtranslatorSoclib/toTopCell/Code.java @@ -47,20 +47,29 @@ package ddtranslatorSoclib.toTopCell; import java.util.*; import ddtranslatorSoclib.*; +import java.io.*; +import myutil.FileException; +import myutil.FileUtils; +import ui.*;//DG +import ui.MainGUI;//DG +import ui.avatardd.*;//DG +import ui.window.*;//DG +import tmltranslator.*;//DG +//import TGComponentManager.*;//DG public class Code { - + static private String creation; static private String creation2; private final static String CR = "\n"; - private final static String CR2 = "\n\n"; + private final static String CR2 = "\n\n"; + private final static String GENERATED_PATH = "generated_topcell" + File.separator; + + protected MainGUI mgui; - Code(){ - } - public static String getCode(){ - + creation = CR + "//**********************************************************************" + CR + "// Processor entry and connection code" + CR + @@ -96,8 +105,50 @@ public class Code { " cpu->p_vci(m);" +CR + " }" + CR2; - //If there is a spy, add spy to vci interface -for (AvatarCPU cpu : TopCellGenerator.avatardd.getAllCPU()) { + + // If there is a spy, add spy component to vci interface + // both adjacent componants are spied + // currently applies to CPU and RAM + // RAM monitoring required for buffer size, RAM and CPU for latency + // of memory accesses other than channel + + /* ADDDiagramPanel panel = mgui.getFirstAvatarDeploymentPanelFound();//?? + + for (ADDConnector connector : TGComponentManager.getAllADDConnectors()) { + TGConnectingPoint my_p1= connector.get_p1(); + TGConnectingPoint my_p2= connector.get_p2(); + + TGComponent comp1 = panel.getComponentToWhichBelongs(my_p1) ; + TGComponent comp2 = panel.getComponentToWhichBelongs(my_p2) ; + + //If a spy glass symbol is found, and component itself not yet marked + + if (connector.hasASpy()){ + + if (comp1 instanceof ADDRAMNode){ + ADDRAMNode comp1ram = (ADDRAMNode)comp1; + comp1ram.setMonitored(1); + } + + if (comp1 instanceof ADDCPUNode){ + ADDCPUNode comp1cpu = (ADDCPUNode)comp1; + comp1cpu.setMonitored(1); + } + + if (comp2 instanceof ADDRAMNode){ + ADDRAMNode comp2ram = (ADDRAMNode)comp1; + comp2ram.setMonitored(1); + } + + if (comp2 instanceof ADDCPUNode){ + ADDCPUNode comp2cpu = (ADDCPUNode)comp2; + comp2cpu.setMonitored(1); + } + } + } */ + + //If there is a spy, add logger or stats to vci interface + for (AvatarCPU cpu : TopCellGenerator.avatardd.getAllCPU()) { // if(){ if(cpu.getMonitored()==1){ creation=creation+ @@ -114,12 +165,35 @@ for (AvatarCPU cpu : TopCellGenerator.avatardd.getAllCPU()) { "mwmr_stats0.p_vci(p_vci(m));" +CR2; } } - } +} //} creation=creation+"template <class Iss>" + CR + - "INIT_TOOLS(initialize_tools){" + CR + - //"Iss::setBoostrapCpuId(0);" + CR + // ppc - "/* Only processor 0 starts execution on reset */" + CR + + "INIT_TOOLS(initialize_tools){" + CR ; + + int isMipsArchitecture = 0; + + try { + String path = ConfigurationTTool.AVATARMPSoCCodeDirectory; + BufferedReader in = new BufferedReader(new FileReader(path+"/Makefile.forsoclib")); + String line = null; + while ((line = in.readLine()) != null) { + + if( line.equals("SOCLIB_CPU=mips32el")) + { + isMipsArchitecture = 1; + } + } + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + +if(isMipsArchitecture == 1){ + creation=creation+ + "Iss::setBoostrapCpuId(0);" + CR + + "/* Only processor 0 starts execution on reset */" + CR; +} + creation=creation+ "#if defined(CONFIG_GDB_SERVER)" + CR + "ISS_NEST(Iss)::set_loader(ldr);" + CR + "#endif" + CR +