Skip to content
Snippets Groups Projects
Commit b164a60f authored by apvrille's avatar apvrille
Browse files

Update on MUX management

parent bc8b2e36
No related branches found
No related tags found
No related merge requests found
...@@ -41,6 +41,7 @@ package tmltranslator.tonetwork; ...@@ -41,6 +41,7 @@ package tmltranslator.tonetwork;
import tmltranslator.*; import tmltranslator.*;
import java.util.List;
import java.util.Vector; import java.util.Vector;
...@@ -52,16 +53,14 @@ import java.util.Vector; ...@@ -52,16 +53,14 @@ import java.util.Vector;
* @version 1.0 11/03/2019 * @version 1.0 11/03/2019
*/ */
public class TaskMUXAppDispatch extends TMLTask { public class TaskMUXAppDispatch extends TMLTask {
protected int nbOfApps;
public TaskMUXAppDispatch(String name, Object referenceToClass, Object referenceToActivityDiagram) { public TaskMUXAppDispatch(String name, Object referenceToClass, Object referenceToActivityDiagram) {
super(name, referenceToClass, referenceToActivityDiagram); super(name, referenceToClass, referenceToActivityDiagram);
} }
// Output Channels are given in the order of VCs // Output Channels are given in the order of VCs
public void generate(int nbOfApps, Vector<TMLEvent> inputEvents, TMLEvent outputEvent) { public void generate(List<TMLEvent> inputEvents, TMLEvent outputEvent) {
this.nbOfApps = nbOfApps;
// Attributes // Attributes
TMLAttribute pktlen = new TMLAttribute("pktlen", "pktlen", new TMLType(TMLType.NATURAL), "0"); TMLAttribute pktlen = new TMLAttribute("pktlen", "pktlen", new TMLType(TMLType.NATURAL), "0");
...@@ -95,7 +94,7 @@ public class TaskMUXAppDispatch extends TMLTask { ...@@ -95,7 +94,7 @@ public class TaskMUXAppDispatch extends TMLTask {
// Branch for each app // Branch for each app
for(int i=0; i<nbOfApps; i++) { for(int i=0; i< inputEvents.size(); i++) {
TMLWaitEvent waitEvt = new TMLWaitEvent("PacketEvent" + i, referenceObject); TMLWaitEvent waitEvt = new TMLWaitEvent("PacketEvent" + i, referenceObject);
waitEvt.setEvent(inputEvents.get(i)); waitEvt.setEvent(inputEvents.get(i));
waitEvt.addParam("pktlen"); waitEvt.addParam("pktlen");
......
...@@ -39,9 +39,11 @@ ...@@ -39,9 +39,11 @@
package tmltranslator.tonetwork; package tmltranslator.tonetwork;
import myutil.TraceManager;
import tmltranslator.*; import tmltranslator.*;
import ui.TGComponent; import ui.TGComponent;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
...@@ -96,6 +98,78 @@ public class TranslatedRouter<E> { ...@@ -96,6 +98,78 @@ public class TranslatedRouter<E> {
String nameOfExecNode = noc.getHwExecutionNode(xPos, yPos); String nameOfExecNode = noc.getHwExecutionNode(xPos, yPos);
HwExecutionNode execNode = tmlmap.getTMLArchitecture().getHwExecutionNodeByName(nameOfExecNode); HwExecutionNode execNode = tmlmap.getTMLArchitecture().getHwExecutionNodeByName(nameOfExecNode);
if (nameOfExecNode == null) {
nameOfExecNode = "fakeCPU_" + xPos + "_" + yPos;
}
if (execNode == null) {
TraceManager.addDev("Could NOT find an exec node for (" + xPos + "," + yPos + ")");
} else {
TraceManager.addDev("Found an exec node for (" + xPos + "," + yPos + "): " + execNode.getName());
}
// Then, we need to find the channels starting from/arriving to a task mapped on this execNode
Vector<TMLChannel> inputChannels = new Vector<>();
Vector<TMLChannel> outputChannels = new Vector<>();
if (execNode != null) {
for(TMLChannel ch: channelsViaNoc) {
TMLTask origin = ch.getOriginTask();
TMLTask destination = ch.getDestinationTask();
if (origin != null) {
// find on which CPU is mapped this task
HwNode cpuOfOrigin = tmlmap.getHwNodeOf(origin);
if (cpuOfOrigin == execNode) {
TraceManager.addDev("Found an output channel:" + ch.getName());
outputChannels.add(ch);
}
}
if (destination != null) {
// find on which CPU is mapped this task
HwNode cpuOfDestination = tmlmap.getHwNodeOf(destination);
if (cpuOfDestination == execNode) {
TraceManager.addDev("Found an input channel:" + ch.getName());
inputChannels.add(ch);
}
}
}
}
// Now that we know all channels, we can generate the MUX tasks
// We need one event par outputChannel
HashMap<TMLChannel, TMLEvent> mapOfOutputChannels = new HashMap<>();
Vector<TMLEvent> inputEventsOfMUX = new Vector<>();
for(TMLChannel chan: outputChannels) {
TMLEvent outputEventOfMux = new TMLEvent("EventMUXof" + chan.getName(), null, 8,
true);
mapOfOutputChannels.put(chan, outputEventOfMux);
inputEventsOfMUX.add(outputEventOfMux);
tmlm.addEvent(outputEventOfMux);
}
// We also need an output event for MUX / NI_IN
TMLEvent eventForMUX_and_NI_IN = new TMLEvent("EventBetweenMUXandNI_IN_for_" + nameOfExecNode,
null, 8, true);
tmlm.addEvent(eventForMUX_and_NI_IN);
// We can create the MUX task
TaskMUXAppDispatch muxTask = new TaskMUXAppDispatch("MUXof" + nameOfExecNode, null, null);
tmlm.addTask(muxTask);
muxTask.generate(inputEventsOfMUX, eventForMUX_and_NI_IN);
// Finally, we need to modify the src apps with the new event, and modifying the channel as well to write in the local memory
// All done for MUX
// VC DISPATCHERS // VC DISPATCHERS
// One dispatcher per port // One dispatcher per port
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment