Commit 7c466c21 authored by apvrille's avatar apvrille
Browse files

Adding IN in NoC

parent 8c9cf5aa
......@@ -374,6 +374,14 @@ public class TMLChannel extends TMLCommunicationElement {
destinationTask = _destination;
}
public void setOriginTask(TMLTask t) {
originTask = t;
}
public void setDestinationTask(TMLTask t) {
destinationTask = t;
}
public void setPorts(TMLPort _origin, TMLPort _destination) {
originPort = _origin;
destinationPort = _destination;
......
......@@ -107,6 +107,16 @@ public class TMLEvent extends TMLCommunicationElement {
isBlocking = _isBlocking;
}
public void setOriginTask(TMLTask t) {
origin = t;
}
public void setDestinationTask(TMLTask t) {
destination = t;
}
public void setTasks(TMLTask _origin, TMLTask _destination) {
origin = _origin;
destination = _destination;
......
......@@ -64,6 +64,14 @@ public class TaskINForDispatch extends TMLTask {
this.nbOfVCs = nbOfVCs;
inputEvent.setDestinationTask(this);
inputChannel.setDestinationTask(this);
for(TMLEvent evt: outputEvents) {
evt.setOriginTask(this);
}
for(TMLChannel ch: outputChannels) {
ch.setOriginTask(this);
}
// Attributes
TMLAttribute pktlen = new TMLAttribute("pktlen", "pktlen", new TMLType(TMLType.NATURAL), "0");
......
......@@ -60,7 +60,7 @@ public class TaskINForVC extends TMLTask {
// Output Channels are given in the order of VCs
public void generate(TMLEvent inPacketEvent, Vector<TMLEvent> inFeedbackEvents, TMLChannel inChannel,
TMLEvent outFeedbackEvent, Vector<TMLEvent> outVCEvents) {
TMLEvent outFeedbackEvent, Vector<TMLEvent> outVCEvents, int nocSize, int xPos, int yPos) {
TMLSendEvent sendEvt;
TMLStopState stop;
......@@ -83,14 +83,32 @@ public class TaskINForVC extends TMLTask {
TMLAttribute j = new TMLAttribute("j", "j", new TMLType(TMLType.NATURAL), "0");
this.addAttribute(j);
TMLAttribute noc_xsize = new TMLAttribute("noc_xsize", "noc_xsize", new TMLType(TMLType.NATURAL), "" + nocSize);
this.addAttribute(noc_xsize);
TMLAttribute noc_ysize = new TMLAttribute("noc_ysize", "noc_ysize", new TMLType(TMLType.NATURAL), "" + nocSize);
this.addAttribute(noc_ysize);
TMLAttribute x = new TMLAttribute("x", "x", new TMLType(TMLType.NATURAL), "" + xPos);
this.addAttribute(x);
TMLAttribute y = new TMLAttribute("y", "y", new TMLType(TMLType.NATURAL), "" + yPos);
this.addAttribute(y);
TMLAttribute xd = new TMLAttribute("xd", "xd", new TMLType(TMLType.NATURAL), "0");
this.addAttribute(xd);
TMLAttribute yd = new TMLAttribute("yd", "yd", new TMLType(TMLType.NATURAL), "0");
this.addAttribute(yd);
// Events and channels
addTMLEvent(inPacketEvent);
for(TMLEvent evt: inFeedbackEvents) {
for (TMLEvent evt : inFeedbackEvents) {
addTMLEvent(evt);
}
addReadTMLChannel(inChannel);
addTMLEvent(outFeedbackEvent);
for(TMLEvent evt: outVCEvents) {
for (TMLEvent evt : outVCEvents) {
addTMLEvent(evt);
}
......@@ -137,17 +155,52 @@ public class TaskINForVC extends TMLTask {
waitEvt.addParam("eop");
activity.addLinkElement(loop2, waitEvt);
TMLActionState reqOut = new TMLActionState("ReqOut", referenceObject);
reqOut.setAction("requestedOutput = dst");
activity.addLinkElement(waitEvt, reqOut);
TMLSequence secondSeq = new TMLSequence("SecondSeq", referenceObject);
activity.addLinkElement(waitEvt, secondSeq);
// Routing : first branch of secondSeq
TMLActionState computeyd = new TMLActionState("computeyd", referenceObject);
computeyd.setAction("yd = dst/noc_xsize");
activity.addLinkElement(secondSeq, computeyd);
TMLActionState computexd = new TMLActionState("computexd", referenceObject);
computexd.setAction("xd = dst - yd * noc_xsize");
activity.addLinkElement(computeyd, computexd);
TMLChoice firstRoutingChoice = new TMLChoice("firstRoutingChoice", referenceObject);
activity.addLinkElement(computexd, firstRoutingChoice);
TMLActionState requested3 = new TMLActionState("requested3", referenceObject);
requested3.setAction("requested_output = 3");
activity.addLinkElement(firstRoutingChoice, requested3);
firstRoutingChoice.addGuard("xd > x");
activity.addLinkElement(requested3, new TMLStopState("stopOfRequest3", referenceObject));
TMLActionState requested2 = new TMLActionState("requested2", referenceObject);
requested2.setAction("requested_output = 2");
activity.addLinkElement(firstRoutingChoice, requested2);
firstRoutingChoice.addGuard("xd < x");
activity.addLinkElement(requested2, new TMLStopState("stopOfRequest2", referenceObject));
TMLChoice secondRoutingChoice = new TMLChoice("secondRoutingChoice", referenceObject);
activity.addLinkElement(firstRoutingChoice, secondRoutingChoice);
firstRoutingChoice.addGuard("xd == x");
// Main choice
// Main choice : second branch of secondSeq
TMLChoice mainChoice = new TMLChoice("mainChoice", referenceObject);
activity.addLinkElement(reqOut, mainChoice);
activity.addLinkElement(secondSeq, mainChoice);
// Each link to an output for a given packet
for(int i=0; i<outVCEvents.size(); i++) {
for (int i = 0; i < outVCEvents.size(); i++) {
TMLForLoop packetLoop = new TMLForLoop("packetLoop", referenceObject);
packetLoop.setInit("j=0");
packetLoop.setCondition("j<pktlen-1");
......
......@@ -54,14 +54,28 @@ import java.util.Vector;
*/
public class TaskMUXAppDispatch extends TMLTask {
private TMLEvent outputEvent;
private List<TMLEvent> inputEvents;
public TaskMUXAppDispatch(String name, Object referenceToClass, Object referenceToActivityDiagram) {
super(name, referenceToClass, referenceToActivityDiagram);
}
public TMLEvent getOutputEvent() {
return outputEvent;
}
// Output Channels are given in the order of VCs
public void generate(List<TMLEvent> inputEvents, TMLEvent outputEvent) {
this.inputEvents = inputEvents;
this.outputEvent = outputEvent;
for(TMLEvent evt: inputEvents) {
evt.setDestinationTask(this);
}
outputEvent.setOriginTask(this);
// Attributes
TMLAttribute pktlen = new TMLAttribute("pktlen", "pktlen", new TMLType(TMLType.NATURAL), "0");
this.addAttribute(pktlen);
......
......@@ -67,6 +67,18 @@ public class TaskNetworkInterface extends TMLTask {
this.nbOfVCs = nbOfVCs;
for(TMLEvent evt: inputFeedbackEvents) {
evt.setDestinationTask(this);
}
for(TMLEvent evt: inputEventsFromMUX) {
evt.setDestinationTask(this);
}
outputEvent.setOriginTask(this);
outputChannel.setOriginTask(this);
// Attributes
//TMLAttribute dst = new TMLAttribute("dst", "dst", new TMLType(TMLType.NATURAL), "0");
......
......@@ -137,81 +137,100 @@ public class TranslatedRouter<E> {
}
}
// 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
// We can create the MUX task: one mux task for each VC
Vector<TaskMUXAppDispatch> muxTasks = new Vector<>();
for(i=0; i<nbOfVCs; i++) {
// 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) {
if (chan.getVC() == i) {
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);
TaskMUXAppDispatch muxTask = new TaskMUXAppDispatch("MUXof" + nameOfExecNode +"_VC" + i, null, null);
tmlm.addTask(muxTask);
muxTask.generate(inputEventsOfMUX, eventForMUX_and_NI_IN);
muxTasks.add(muxTask);
}
// Finally, we need to modify the src apps with the new event, and modifying the channel in order to write into
// the corresponding local memory
// VC DISPATCHERS
// One dispatcher per port
// A dispatcher outputs to VCs tasks
dispatchers = new Vector<TMLTask>();
for(i=0; i<NB_OF_PORTS; i++) {
//TaskINForDispatch dt = new TaskINForDispatch(nbOfVCs);
//dispatchers.add(dt);
// NETWORK INTERFACE IN
// We must first gathers events from must task
Vector<TMLEvent> inputEventsFromMUX = new Vector<>();
for(TaskMUXAppDispatch tmux: muxTasks) {
inputEventsFromMUX.add(tmux.getOutputEvent());
}
// PORT DISPATCHER // according to destination
TaskNetworkInterface tniIn = new TaskNetworkInterface("NI_IN_" + nameOfExecNode, null,
null);
tmlm.addTask(tniIn);
// Create all channels
// For each input VC, we have to create a channel
for (i=0; i<NB_OF_PORTS*nbOfVCs; i++) {
TMLChannel channel = new TMLChannel("Channel" + i + getInfo(), this);
channel.setSize(CHANNEL_SIZE);
channel.setMax(CHANNEL_MAX);
channel.setType(TMLChannel.BRBW);
tmlm.addChannel(channel);
// One TMLEvent for feedback for each VC
Vector<TMLEvent> feedbackEventsNIINs = new Vector<>();
for(i=0; i<nbOfVCs; i++) {
TMLEvent eventFeedback = new TMLEvent("EventBetweenNI_IN_ANd_IN_for_" + nameOfExecNode,
null, 8, true);
feedbackEventsNIINs.add(eventFeedback);
tmlm.addEvent(eventFeedback);
}
TMLEvent outputFromNIINtoIN = new TMLEvent("EventBetweenNI_IN_to_IN_for_" + nameOfExecNode,
null, 8, true);
tmlm.addEvent(outputFromNIINtoIN);
TMLChannel outputChannelFromNIINtoIN = new TMLChannel("channelBetweenNI_IN_to_IN_for_" + nameOfExecNode,
null);
outputChannelFromNIINtoIN.setSize(4);
outputChannelFromNIINtoIN.setMax(8);
tmlm.addChannel(outputChannelFromNIINtoIN);
tniIn.generate(nbOfVCs, feedbackEventsNIINs, inputEventsFromMUX, outputFromNIINtoIN, outputChannelFromNIINtoIN);
// IN NOC
// We need one ouput channel per VC and one output event per VC
Vector<TMLEvent> evtFromINtoINVCs = new Vector<>();
Vector<TMLChannel> chFromINtoINVCs = new Vector<>();
for(i=0; i<nbOfVCs; i++) {
TMLEvent evtFromINtoINVC = new TMLEvent("EventBetweenIN_IN_forVC_" + i + "_" + nameOfExecNode,
null, 8, true);
tmlm.addEvent(evtFromINtoINVC);
evtFromINtoINVCs.add(evtFromINtoINVC);
TMLChannel chFromINtoINVC = new TMLChannel("channelBetweenIN_IN_for_VC" + i + "_" + nameOfExecNode,
null);
chFromINtoINVC.setSize(4);
chFromINtoINVC.setMax(8);
tmlm.addChannel(chFromINtoINVC);
chFromINtoINVCs.add(chFromINtoINVC);
}
// Create all events
// pktins: between tasks
// Feedbacks between OUTVC and INVC
// Create all tasks
TaskINForDispatch inDispatch = new TaskINForDispatch("IN_" + execNode, null, null);
tmlm.addTask(inDispatch);
inDispatch.generate(nbOfVCs, outputFromNIINtoIN, outputChannelFromNIINtoIN, evtFromINtoINVCs, chFromINtoINVCs);
// Create the architecture
// Map tasks
// IN specific to an input of the NoC apart from internal CPU
// inputs 0 to 3
// Map channels
}
......
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