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

Update on Terminal char: backspace and ret

parent f696ae5a
No related branches found
No related tags found
No related merge requests found
......@@ -53,11 +53,18 @@ import java.util.Vector;
public class Terminal {
private final static int MAX_BUFFER_SIZE = 5000;
private final static int CR = 10;
private final static int BACKSPACE = 8;
private final static int DEL = 127;
private Vector<String> buffer;
private int maxbufferSize = MAX_BUFFER_SIZE;
private TerminalProviderInterface terminalProvider;
private int cpt;
public Terminal() {
buffer = new Vector<>();
cpt = 0;
......@@ -80,17 +87,29 @@ public class Terminal {
val = (RawConsoleInput.read(true));
x = (char) val;
if (val >= 32) {
if (val == CR) {
if (currentBuf.length() == 0) {
myPrint("\n");
printPrompt(cpt);
} else {
cpt++;
//myPrint("\n");
return currentBuf;
}
}
if ((val == BACKSPACE) || (val == DEL)) {
myPrint("\b \b");
if (currentBuf.length() > 0) {
currentBuf = currentBuf.substring(0, currentBuf.length() - 1);
}
} else if (val >= 32) {
//System.out.print("" + x + "(val=" + val + ");");
myPrint(""+x);
currentBuf += x;
}
if (val == 10) {
cpt ++;
//myPrint("\n");
return currentBuf;
}
}
} catch (Exception e) {
return null;
......
......@@ -170,7 +170,7 @@ public class TMAP2Network<E> {
TMLArchitecture tmla = tmlmapping.getTMLArchitecture();
TMLModeling<?> tmlm = tmlmapping.getTMLModeling();
// we have to redo the architecture:
// *** we have to redo the architecture:
// we assume that each processor is connected directly to the NoC via a first bus
// so, each CPU gets one memory, on bus connecting the mem and the NoC.
// all local channels are mapped on this memory, otherwise they
......@@ -262,7 +262,7 @@ public class TMAP2Network<E> {
}
}
//Create routers
// *** Create routers
for(int i=0; i<nocSize; i++) {
for(int j=0; j<nocSize; j++) {
// We must find the number of apps connected on this router
......@@ -272,6 +272,15 @@ public class TMAP2Network<E> {
}
}
// Make the channels & events of routers
for(int i=0; i<nocSize; i++) {
for(int j=0; j<nocSize; j++) {
// We must find the number of apps connected on this router
routers[i][j].makeOutputEventsChannels();
}
}
// Make all routers
for(int i=0; i<nocSize; i++) {
for(int j=0; j<nocSize; j++) {
......
......@@ -74,6 +74,21 @@ public class TranslatedRouter<E> {
private TMLMapping<?> tmlmap;
// Events and channels with other routers
// Between IN and INVC
TMLEvent [][] pktInEvtsVCs; // position, vc
TMLChannel [][] pktInChsVCs; // position, vc
// Between INVC and OUTVC
TMLEvent [][][] routeEvtVCs; // Task, vc, destination id
TMLEvent [][][] routeEvtVCsFeedback; // Task, vc, destination id
// Between OUTVC and OUT
TMLEvent [][] evtOutVCs; // position, vc
TMLEvent [][] evtSelectVC; // position, vc
public TranslatedRouter(TMAP2Network<?> main, TMLMapping<?> tmlmap, HwNoC noc, List<TMLChannel> channelsViaNoc, int nbOfVCs, int xPos, int yPos) {
this.main = main;
this.nbOfVCs = nbOfVCs;
......@@ -83,8 +98,6 @@ public class TranslatedRouter<E> {
this.yPos = yPos;
this.tmlmap = tmlmap;
//A router creates all its output events and channels, depending on its position in the NoC
}
......@@ -257,5 +270,67 @@ public class TranslatedRouter<E> {
}
public void makeOutputEventsChannels() {
TMLModeling tmlm = tmlmap.getTMLModeling();
// Internal events and channels
// Between IN and INVC
pktInEvtsVCs = new TMLEvent[TMAP2Network.DOMAIN+1][nbOfVCs];
pktInChsVCs = new TMLChannel[TMAP2Network.DOMAIN+1][nbOfVCs];
for(int i=0; i<TMAP2Network.DOMAIN+1; i++) {
for(int j=0; j<nbOfVCs; j++) {
pktInEvtsVCs[i][j] = new TMLEvent("evt_pktin" + i + "_vc" + j + "_" + xPos + "_" + yPos,
null, 8, true);
tmlm.addEvent(pktInEvtsVCs[i][j]);
pktInChsVCs[i][j] = new TMLChannel("ch_pktin" + i + "_vc" + j + "_" + xPos + "_" + yPos,
null);
pktInChsVCs[i][j].setSize(4);
pktInChsVCs[i][j].setMax(8);
tmlm.addChannel(pktInChsVCs[i][j]);
}
}
// Between INVC and OUTVC
routeEvtVCs = new TMLEvent[TMAP2Network.DOMAIN+1][nbOfVCs][TMAP2Network.DOMAIN+1];
routeEvtVCsFeedback = new TMLEvent[TMAP2Network.DOMAIN+1][nbOfVCs][TMAP2Network.DOMAIN+1];
for(int i=0; i<TMAP2Network.DOMAIN+1; i++) {
for (int j = 0; j < nbOfVCs; j++) {
for (int k = 0; k < TMAP2Network.DOMAIN+1; k++) {
routeEvtVCs[i][j][k] = new TMLEvent("evtroute_" + i + "_vc" + j + "_" + k + "_" +
xPos + "_" + yPos, null, 8, true);
tmlm.addEvent(routeEvtVCs[i][j][k]);
routeEvtVCsFeedback[i][j][k] = new TMLEvent("evtfeedback_" + i + "_vc" + j + "_" + k + "_" +
xPos + "_" + yPos, null, 8, true);
tmlm.addEvent(routeEvtVCsFeedback[i][j][k]);
}
}
}
// Between OUTVC and OUT
evtOutVCs = new TMLEvent[TMAP2Network.DOMAIN+1][nbOfVCs];
evtSelectVC = new TMLEvent[TMAP2Network.DOMAIN+1][nbOfVCs];
for(int i=0; i<TMAP2Network.DOMAIN+1; i++) {
for(int j=0; j<nbOfVCs; j++) {
evtOutVCs[i][j] = new TMLEvent("evt_out" + i + "_vc" + j + "_" + xPos + "_" + yPos,
null, 8, true);
tmlm.addEvent(evtOutVCs[i][j]);
evtSelectVC[i][j] = new TMLEvent("evt_vcselect" + i + "_vc" + j + "_" + xPos + "_" + yPos,
null, 8, true);
tmlm.addEvent(evtSelectVC[i][j]);
}
}
// Interconnection with routers depending on position
}
}
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