Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • mbe-tools/TTool
1 result
Show changes
Commits on Source (15)
Showing
with 1423 additions and 240 deletions
......@@ -26,6 +26,7 @@
<root url="jar://$PROJECT_DIR$/libs/batik-xml.jar!/" />
<root url="jar://$PROJECT_DIR$/libs/jautomata-core.jar!/" />
<root url="jar://$PROJECT_DIR$/libs/com.microsoft.z3.jar!/" />
<root url="jar://$PROJECT_DIR$/libs/jna-3.3.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/libs/commons-io-2.5-javadoc.jar!/" />
......
12987
\ No newline at end of file
12991
\ No newline at end of file
......@@ -26,6 +26,7 @@ dependencies {
compileOnly name: 'commons-codec-1.10'
compileOnly name: 'jsoup-1.8.1'
compile name: 'jautomata-core'
compileOnly name: 'jna-3.3.0'
}
jar {
......
......@@ -21,6 +21,7 @@ dependencies {
compileOnly name: 'commons-codec-1.10'
compileOnly name: 'jsoup-1.8.1'
compile name: 'jautomata-core'
compileOnly name: 'jna-3.3.0'
}
jar {
......
......@@ -15,6 +15,7 @@ dependencies {
compile name: 'commons-codec-1.10'
compileOnly name: 'commons-io-2.5'
compileOnly name: 'jsoup-1.8.1'
compileOnly name: 'jna-3.3.0'
}
jar {
......
File added
......@@ -25,6 +25,7 @@ dependencies {
compileOnly name:'batik-util'
compile name:'jautomata-core'
compile name:'com.microsoft.z3'
compileOnly name: 'jna-3.3.0'
}
jar {
......
......@@ -145,8 +145,31 @@ public class Command implements CommandInterface {
level --;
}
return ret;
}
public Vector<Command> findCommands(String[] split, int index) {
if (split == null) {
return null;
}
if (index >= split.length) {
return null;
}
String s = split[index];
Vector<Command> couldBe = new Vector<>();
// Search of all compatible commands starting with s
for (Command c: subcommands) {
if (c.getShortCommand().startsWith(s) || c.getCommand().startsWith(s)) {
Vector<Command> others = c.findCommands(split, index+1);
if (others != null) {
couldBe.addAll(others);
}
}
}
return couldBe;
}
}
......@@ -59,7 +59,8 @@ import java.util.*;
*
* @author Ludovic APVRILLE
*/
public class Interpreter implements Runnable {
public class Interpreter implements Runnable, TerminalProviderInterface {
public final static Command[] commands = {new Help(), new Quit(), new Action(),
new Set(), new Wait(), new Print(), new History(), new TestSpecific()};
......@@ -85,6 +86,7 @@ public class Interpreter implements Runnable {
private boolean ttoolStarted = false;
public MainGUI mgui;
private Vector<String> formerCommands;
private Terminal term;
public Interpreter(String script, InterpreterOutputInterface printInterface, boolean show) {
......@@ -102,6 +104,18 @@ public class Interpreter implements Runnable {
public void interact() {
Terminal term = new Terminal();
term.setTerminalProvider(this);
String line;
int cptLine = 0;
while ((line = term.getNextCommand()) != null) {
executeLine(line, cptLine, false);
cptLine ++;
}
}
public void interactIntegratedTerminal() {
/*if (RawConsoleInput.isWindows) {
print("In Windows");
} else {
......@@ -141,7 +155,7 @@ public class Interpreter implements Runnable {
private void executeLine(String line, int cptLine, boolean exitOnError) {
// Comment
TraceManager.addDev("Executing line:" + line);
//TraceManager.addDev("Executing line:" + line);
line = line.trim();
if (line.length() == 0) {
......@@ -167,7 +181,7 @@ public class Interpreter implements Runnable {
begOfLine = begOfLine.substring(0, index).trim();
}
TraceManager.addDev("Handling line: " + lineWithNoVariable);
//TraceManager.addDev("Handling line: " + lineWithNoVariable);
String [] commandInfo = lineWithNoVariable.split(" ");
if ((commandInfo == null) || (commandInfo.length < 1)){
......@@ -297,5 +311,56 @@ public class Interpreter implements Runnable {
return null;
}
// Terminal provider interface
public String getMidPrompt() {
return "> ";
}
public boolean tabAction(String buffer) {
// Print all possibilities from current buffer
String buf = Conversion.replaceAllString(buffer, " ", " ");
String[] split = buf.split(" ");
// From the split, determine commands already entered and completes it
Vector<Command> listOfCommands = findCommands(split, 0);
if (listOfCommands.size()== 0) {
return false;
}
for(Command c: listOfCommands) {
System.out.println(""+c.getCommand());
return true;
}
return true;
}
public Vector<Command> findCommands(String[] split, int index) {
if (split == null) {
return null;
}
if (index >= split.length) {
return null;
}
String s = split[index];
Vector<Command> couldBe = new Vector<>();
// Search of all compatible commands starting with s
for (Command c: commands) {
if (c.getShortCommand().startsWith(s) || c.getCommand().startsWith(s)) {
Vector<Command> others = c.findCommands(split, index+1);
if (others != null) {
couldBe.addAll(others);
}
}
}
return couldBe;
}
}
// Copyright 2015 Christian d'Heureuse, Inventec Informatik AG, Zurich, Switzerland
// www.source-code.biz, www.inventec.ch/chdh
//
// This module is multi-licensed and may be used under the terms of any of the following licenses:
//
// LGPL, GNU Lesser General Public License, V2.1 or later, http://www.gnu.org/licenses/lgpl.html
// EPL, Eclipse Public License, V1.0 or later, http://www.eclipse.org/legal
//
// Please contact the author if you need another license.
// This module is provided "as is", without warranties of any kind.
//
// Home page: http://www.source-code.biz/snippets/java/RawConsoleInput
package myutil;
import java.io.InputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CodingErrorAction;
import java.util.Arrays;
import java.util.List;
import com.sun.jna.LastErrorException;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Structure;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.IntByReference;
/**
* A JNA based driver for reading single characters from the console.
*
* <p>This class is used for console mode programs.
* It supports non-blocking reads of single key strokes without echo.
*/
public class RawConsoleInput {
private static final boolean isWindows = System.getProperty("os.name").startsWith("Windows");
private static final int invalidKey = 0xFFFE;
private static final String invalidKeyStr = String.valueOf((char)invalidKey);
private static boolean initDone;
private static boolean stdinIsConsole;
private static boolean consoleModeAltered;
/**
* Reads a character from the console without echo.
*
* @param wait
* <code>true</code> to wait until an input character is available,
* <code>false</code> to return immediately if no character is available.
* @return
* -2 if <code>wait</code> is <code>false</code> and no character is available.
* -1 on EOF.
* Otherwise an Unicode character code within the range 0 to 0xFFFF.
*/
public static int read (boolean wait) throws IOException {
if (isWindows) {
return readWindows(wait); }
else {
return readUnix(wait); }}
/**
* Resets console mode to normal line mode with echo.
*
* <p>On Windows this method re-enables Ctrl-C processing.
*
* <p>On Unix this method switches the console back to echo mode.
* read() leaves the console in non-echo mode.
*/
public static void resetConsoleMode() throws IOException {
if (isWindows) {
resetConsoleModeWindows(); }
else {
resetConsoleModeUnix(); }}
private static void registerShutdownHook() {
Runtime.getRuntime().addShutdownHook( new Thread() {
public void run() {
shutdownHook(); }}); }
private static void shutdownHook() {
try {
resetConsoleMode(); }
catch (Exception e) {}}
//--- Windows ------------------------------------------------------------------
// The Windows version uses _kbhit() and _getwch() from msvcrt.dll.
private static Msvcrt msvcrt;
private static Kernel32 kernel32;
private static Pointer consoleHandle;
private static int originalConsoleMode;
private static int readWindows (boolean wait) throws IOException {
initWindows();
if (!stdinIsConsole) {
int c = msvcrt.getwchar();
if (c == 0xFFFF) {
c = -1; }
return c; }
consoleModeAltered = true;
setConsoleMode(consoleHandle, originalConsoleMode & ~Kernel32Defs.ENABLE_PROCESSED_INPUT);
// ENABLE_PROCESSED_INPUT must remain off to prevent Ctrl-C from beeing processed by the system
// while the program is not within getwch().
if (!wait && msvcrt._kbhit() == 0) {
return -2; } // no key available
return getwch(); }
private static int getwch() {
int c = msvcrt._getwch();
if (c == 0 || c == 0xE0) { // Function key or arrow key
c = msvcrt._getwch();
if (c >= 0 && c <= 0x18FF) {
return 0xE000 + c; } // construct key code in private Unicode range
return invalidKey; }
if (c < 0 || c > 0xFFFF) {
return invalidKey; }
return c; } // normal key
private static synchronized void initWindows() throws IOException {
if (initDone) {
return; }
msvcrt = (Msvcrt)Native.loadLibrary("msvcrt", Msvcrt.class);
kernel32 = (Kernel32)Native.loadLibrary("kernel32", Kernel32.class);
try {
consoleHandle = getStdInputHandle();
originalConsoleMode = getConsoleMode(consoleHandle);
stdinIsConsole = true; }
catch (IOException e) {
stdinIsConsole = false; }
if (stdinIsConsole) {
registerShutdownHook(); }
initDone = true; }
private static Pointer getStdInputHandle() throws IOException {
Pointer handle = kernel32.GetStdHandle(Kernel32Defs.STD_INPUT_HANDLE);
if (Pointer.nativeValue(handle) == 0 || Pointer.nativeValue(handle) == Kernel32Defs.INVALID_HANDLE_VALUE) {
throw new IOException("GetStdHandle(STD_INPUT_HANDLE) failed."); }
return handle; }
private static int getConsoleMode (Pointer handle) throws IOException {
IntByReference mode = new IntByReference();
int rc = kernel32.GetConsoleMode(handle, mode);
if (rc == 0) {
throw new IOException("GetConsoleMode() failed."); }
return mode.getValue(); }
private static void setConsoleMode (Pointer handle, int mode) throws IOException {
int rc = kernel32.SetConsoleMode(handle, mode);
if (rc == 0) {
throw new IOException("SetConsoleMode() failed."); }}
private static void resetConsoleModeWindows() throws IOException {
if (!initDone || !stdinIsConsole || !consoleModeAltered) {
return; }
setConsoleMode(consoleHandle, originalConsoleMode);
consoleModeAltered = false; }
private static interface Msvcrt extends Library {
int _kbhit();
int _getwch();
int getwchar(); }
private static class Kernel32Defs {
static final int STD_INPUT_HANDLE = -10;
static final long INVALID_HANDLE_VALUE = (Pointer.SIZE == 8) ? -1 : 0xFFFFFFFFL;
static final int ENABLE_PROCESSED_INPUT = 0x0001;
static final int ENABLE_LINE_INPUT = 0x0002;
static final int ENABLE_ECHO_INPUT = 0x0004;
static final int ENABLE_WINDOW_INPUT = 0x0008; }
private static interface Kernel32 extends Library {
int GetConsoleMode (Pointer hConsoleHandle, IntByReference lpMode);
int SetConsoleMode (Pointer hConsoleHandle, int dwMode);
Pointer GetStdHandle (int nStdHandle); }
//--- Unix ---------------------------------------------------------------------
// The Unix version uses tcsetattr() to switch the console to non-canonical mode,
// System.in.available() to check whether data is available and System.in.read()
// to read bytes from the console.
// A CharsetDecoder is used to convert bytes to characters.
private static final int stdinFd = 0;
private static Libc libc;
private static CharsetDecoder charsetDecoder;
private static Termios originalTermios;
private static Termios rawTermios;
private static Termios intermediateTermios;
private static int readUnix (boolean wait) throws IOException {
initUnix();
if (!stdinIsConsole) { // STDIN is not a console
return readSingleCharFromByteStream(System.in); }
consoleModeAltered = true;
setTerminalAttrs(stdinFd, rawTermios); // switch off canonical mode, echo and signals
try {
if (!wait && System.in.available() == 0) {
System.out.println("Not ready");
return -2; } // no input available
return readSingleCharFromByteStream(System.in); }
finally {
setTerminalAttrs(stdinFd, intermediateTermios); }} // reset some console attributes
private static Termios getTerminalAttrs (int fd) throws IOException {
Termios termios = new Termios();
try {
int rc = libc.tcgetattr(fd, termios);
if (rc != 0) {
throw new RuntimeException("tcgetattr() failed."); }}
catch (LastErrorException e) {
throw new IOException("tcgetattr() failed.", e); }
return termios; }
private static void setTerminalAttrs (int fd, Termios termios) throws IOException {
try {
int rc = libc.tcsetattr(fd, LibcDefs.TCSANOW, termios);
if (rc != 0) {
System.out.println("Exception in term tcset");
throw new RuntimeException("tcsetattr() failed."); }}
catch (LastErrorException e) {
System.out.println("Exception in term tcset");
throw new IOException("tcsetattr() failed.", e); }}
private static int readSingleCharFromByteStream (InputStream inputStream) throws IOException {
byte[] inBuf = new byte[4];
int inLen = 0;
while (true) {
if (inLen >= inBuf.length) { // input buffer overflow
return invalidKey; }
int b = inputStream.read(); // read next byte
if (b == -1) { // EOF
return -1; }
inBuf[inLen++] = (byte)b;
int c = decodeCharFromBytes(inBuf, inLen);
if (c != -1) {
return c; }}}
// (This method is synchronized because the charsetDecoder must only be used by a single thread at once.)
private static synchronized int decodeCharFromBytes (byte[] inBytes, int inLen) {
charsetDecoder.reset();
charsetDecoder.onMalformedInput(CodingErrorAction.REPLACE);
charsetDecoder.replaceWith(invalidKeyStr);
ByteBuffer in = ByteBuffer.wrap(inBytes, 0, inLen);
CharBuffer out = CharBuffer.allocate(1);
charsetDecoder.decode(in, out, false);
if (out.position() == 0) {
return -1; }
return out.get(0); }
private static synchronized void initUnix() throws IOException {
if (initDone) {
return; }
libc = (Libc)Native.loadLibrary("c", Libc.class);
stdinIsConsole = libc.isatty(stdinFd) == 1;
charsetDecoder = Charset.defaultCharset().newDecoder();
if (stdinIsConsole) {
//System.out.println("IsConsole=" + stdinIsConsole);
originalTermios = getTerminalAttrs(stdinFd);
rawTermios = new Termios(originalTermios);
rawTermios.c_lflag &= ~(LibcDefs.ICANON | LibcDefs.ECHO | LibcDefs.ECHONL | LibcDefs.ISIG);
//rawTermios.c_lflag &= ~(LibcDefs.ICANON | LibcDefs.ECHO | LibcDefs.ECHONL);
intermediateTermios = new Termios(rawTermios);
//intermediateTermios.c_lflag |= LibcDefs.ICANON;
// Canonical mode can be switched off between the read() calls, but echo must remain disabled.
registerShutdownHook();
System.out.println("New console");
}
initDone = true; }
private static void resetConsoleModeUnix() throws IOException {
if (!initDone || !stdinIsConsole || !consoleModeAltered) {
return; }
setTerminalAttrs(stdinFd, originalTermios);
consoleModeAltered = false; }
protected static class Termios extends Structure { // termios.h
public int c_iflag;
public int c_oflag;
public int c_cflag;
public int c_lflag;
public byte c_line;
public byte[] filler = new byte[64]; // actual length is platform dependent
@Override protected List<String> getFieldOrder() {
return Arrays.asList("c_iflag", "c_oflag", "c_cflag", "c_lflag", "c_line", "filler"); }
Termios() {}
Termios (Termios t) {
c_iflag = t.c_iflag;
c_oflag = t.c_oflag;
c_cflag = t.c_cflag;
c_lflag = t.c_lflag;
c_line = t.c_line;
filler = t.filler.clone(); }}
private static class LibcDefs {
// termios.h
static final int ISIG = 0000001;
static final int ICANON = 0000002;
static final int ECHO = 0000010;
static final int ECHONL = 0000100;
static final int TCSANOW = 0; }
private static interface Libc extends Library {
// termios.h
int tcgetattr (int fd, Termios termios) throws LastErrorException;
int tcsetattr (int fd, int opt, Termios termios) throws LastErrorException;
// unistd.h
int isatty (int fd); }
}
/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
*
* ludovic.apvrille AT enst.fr
*
* This software is a computer program whose purpose is to allow the
* edition of TURTLE analysis, design and deployment diagrams, to
* allow the generation of RT-LOTOS or Java code from this diagram,
* and at last to allow the analysis of formal validation traces
* obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
* from INRIA Rhone-Alpes.
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited
* liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*/
package myutil;
import java.util.Vector;
/**
* Class Terminal
* Creation: 21/03/2019
* Version 2.0 21/03/2019
* @author Ludovic APVRILLE
*/
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 final static int ESC = 27;
private final static int TAB = 9;
private Vector<String> buffer;
private int maxbufferSize = MAX_BUFFER_SIZE;
private TerminalProviderInterface terminalProvider;
private int cpt;
private String sequence;
private String os;
public Terminal() {
buffer = new Vector<>();
cpt = 0;
os = System.getProperty("os.name").toLowerCase();
System.out.println("Detected OS:" + os);
os = os.split(" ")[0];
}
public void setTerminalProvider(TerminalProviderInterface tp) {
terminalProvider = tp;
}
public String getNextCommand() {
char x;
int val = 0;
printPrompt(cpt);
String currentBuf = "";
sequence = null;
long timeSeq = 0;
try {
while(val != 3) {
val = (RawConsoleInput.read(true));
x = (char) val;
// Special sequence?
if (sequence == null) {
if (val == ESC) {
sequence = "";
timeSeq = System.currentTimeMillis();
}
} else {
//Time check
long now = System.currentTimeMillis();
if (now - timeSeq > 10) {
sequence = null;
} else {
sequence += x;
}
}
if ((sequence != null) && (sequence.length() == 3)) {
//TraceManager.addDev("Sequence=" + sequence);
//printSequence(sequence);
if ((sequence.charAt(0) == 91) && (sequence.charAt(1) == 51) &&
(sequence.charAt(2) == 126)) {
currentBuf = del(currentBuf);
sequence = null;
val = -1;
// DEL
//TraceManager.addDev("DEL");
}
} else if ((sequence != null) && (sequence.length() > 4)) {
}
// Usual CHAR
if ((sequence == null) && (val != -1)) {
if (val == CR) {
if (currentBuf.length() == 0) {
myPrint("\n");
printPrompt(cpt);
} else {
cpt++;
//myPrint("\n");
return currentBuf;
}
}
//BACKSPACE
if ((val == BACKSPACE) || (val == DEL)) {
currentBuf = del(currentBuf);
//TAB
} else if (val == TAB) {
System.out.println("TAB");
if (terminalProvider != null) {
boolean b =terminalProvider.tabAction(currentBuf);
if (b) {
printPrompt(cpt);
}
}
} else if (val >= 32) {
//System.out.print("" + x + "(val=" + val + ");");
myPrint("" + x);
currentBuf += x;
}
}
}
} catch (Exception e) {
TraceManager.addDev("Exception in terminal:" + e.getMessage());
return null;
}
return "";
}
private String del(String currentBuf) {
if (currentBuf.length() > 0) {
myPrint("\b \b");
currentBuf = currentBuf.substring(0, currentBuf.length() - 1);
}
return currentBuf;
}
public void myPrint(String s) {
if (os.compareTo("mac") != 0) {
System.out.print(s);
}
//System.out.flush();
}
public void printHistory() {
int cpt = 1;
for(String s: buffer) {
System.out.println("" + cpt+ ":" + s);
cpt ++;
}
}
private void printSequence(String seq) {
for(int i=0; i<seq.length(); i++) {
System.out.print("" + (int)(seq.charAt(i)) + " ");
}
System.out.println("");
}
public void printPrompt(int cpt) {
System.out.print("" + cpt + "> ");
}
}
/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
*
* ludovic.apvrille AT enst.fr
*
* This software is a computer program whose purpose is to allow the
* edition of TURTLE analysis, design and deployment diagrams, to
* allow the generation of RT-LOTOS or Java code from this diagram,
* and at last to allow the analysis of formal validation traces
* obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
* from INRIA Rhone-Alpes.
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited
* liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*/
package myutil;
/**
* Class TerminalProviderInterface
* Creation: 21/03/2019
* Version 1.0 21/03/2019
* @author Ludovic APVRILLE
*/
public interface TerminalProviderInterface {
public String getMidPrompt();
public boolean tabAction(String buffer);
}
......@@ -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
}
}
......@@ -1387,7 +1387,14 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
v = new Vector<TMLCPrimitiveComponent>();
v.addElement((TMLCPrimitiveComponent) tgc);
}
if (tgc instanceof TMLCCompositeComponent) {
if (v == null)
v = new Vector<TMLCPrimitiveComponent>();
v.addAll(((TMLCCompositeComponent) (tgc)).getAllPrimitiveComponents());
}
}
}
return v;
......
......@@ -50,8 +50,8 @@ package ui.util;
*/
public class DefaultText {
public static String BUILD = "12986";
public static String DATE = "2019/03/21 03:02:14 CET";
public static String BUILD = "12990";
public static String DATE = "2019/03/25 03:02:17 CET";
public static StringBuffer sbAbout = makeAbout();
......
......@@ -20,6 +20,7 @@ dependencies {
compileOnly name: 'commons-io-2.5'
compileOnly name: 'jsoup-1.8.1'
compileOnly name: 'commons-codec-1.10'
compileOnly name: 'jna-3.3.0'
}
jar {
......
......@@ -26,6 +26,7 @@ dependencies {
compile name: 'commons-math3-3.6.1'
compile name: 'jautomata-core'
compile name: 'com.microsoft.z3'
compileOnly name: 'jna-3.3.0'
}
jar {
......
......@@ -34,6 +34,7 @@ dependencies {
compile name: 'batik-awt-util'
compile name: 'jautomata-core'
compile name: 'com.microsoft.z3'
compile name: 'jna-3.3.0'
// Use JUnit test framework
testCompile 'junit:junit:4.12'
......