// dst.getBasename().equals(_epiphanyHostName)) {
/* this is an SHM buffer */
System.out.println("\tBuffer: " +
- src.getBasename() + ":" + srcP.getBasename() +
+ src.getName() + ":" + srcP.getName() +
" ==> " +
- dst.getBasename() + ":" + dstP.getBasename() +
+ dst.getName() + ":" + dstP.getName() +
" (size " + ch.getSize() + ")" +
" as SHM:" + _numShmBufs);
private void createProcessWrapper(Process p) throws Exception
{
System.out.println("\tcreateProcessWrapper(): " +
- p.getBasename());
+ p.getName());
/* copy template file */
String filename = _packageName + _delimiter + "esrc" +
- _delimiter + p.getBasename() + "_Wrapper.c";
+ _delimiter + p.getName() + "_Wrapper.c";
String template = _ui.getMySystemCLib() + _delimiter +
"process_Wrapper.c";
template = template.replaceAll("systemC", "epiphany");
File fTemplate = new File(template);
copyFile(fTemplate, fFilename);
+ /* handle this process' iterators */
+ String instance = "";
+ Vector<Integer> indices = p.getIteratorIndices();
+ switch(indices.size()) {
+ case 0: instance =
+ "0,0,0,0"; break;
+ case 1: instance =
+ indices.elementAt(0) +
+ ",0,0,0"; break;
+ case 2: instance =
+ indices.elementAt(0) +
+ indices.elementAt(1) +
+ ",0,0"; break;
+ case 3: instance =
+ indices.elementAt(0) +
+ "," + indices.elementAt(1) +
+ "," + indices.elementAt(2) +
+ ",0"; break;
+ case 4: instance =
+ indices.elementAt(0) +
+ "," + indices.elementAt(1) +
+ "," + indices.elementAt(2) +
+ "," + indices.elementAt(3); break;
+ default:
+ throw new Exception("Unsupported iterator dimension");
+ }
+
+
/* handle this process' ports */
Integer portNum = 0;
String portMapping = "";
EpiphanyBuffer buf = getBuffer(p, port);
/* port mapping */
- portMapping += "\t{ \"" + port.getBasename() + "\", size_" + portNum + ", level_" + portNum + ", ";
+ portMapping += "\t{ \"" + port.getName() + "\", size_" + portNum + ", level_" + portNum + ", ";
portMapping += port.isInPort() ? "read_" + portNum + ", " : "NULL, ";
portMapping += port.isOutPort() ? "write_" + portNum + ", " : "NULL, ";
portMapping += "},\n";
/* replace information */
Sed sed = new Sed();
sed.sed(filename, "@@PROCESSNAME@@", p.getBasename());
+ sed.sed(filename, "@@INSTANCE@@", instance);
sed.sed(filename, "@@NUM_PORTS@@", portNum.toString());
sed.sed(filename, "@@PORTMAPPING@@", portMapping);
sed.sed(filename, "@@PORTFUNCTIONS@@", portFunctions);
String srecFiles = "";
Integer srecNum = 0;
for(Process p : pn.getProcessList()) {
+ /* TODO: fix _epiphanyHostName */
if(!_epiphanyHostName.equals(p.getBasename())) {
srecFiles += "\t\"bin/" + p.getBasename() + ".srec\",\n";
srecNum++;
/* generate srec filenames */
String srecFiles = "";
for(Process p : pn.getProcessList()) {
+ /* TODO: fix _epiphanyHostName */
if(!_epiphanyHostName.equals(p.getBasename())) {
srecFiles += "\\$(DEST)/" +
- p.getBasename() + ".srec ";
+ p.getName() + ".srec ";
}
}
+ /* generate .elf rules, because wrapper file names are
+ non-obvious with iterated processes... */
+ String elfRules = "";
+ for(Process p : pn.getProcessList()) {
+ elfRules +=
+ "\\$(EDEST)/" + p.getName() + ".elf: " +
+ "\\$(EDEST)/" + p.getBasename() + ".o " +
+ "\\$(EDEST)/" + p.getName() + "_Wrapper.o " +
+ "\\$(ECOMMON)\n";
+ elfRules +=
+ "\t@\\$(ECHO) \"\\\\t(EPIPHANY) LINK\\\\t\\\\t\\$@\"\n" +
+ "\t@\\$(CC) -o \\$@ \\$^ \\$(LFLAGS)\n\n";
+ }
+
/* do the replace */
Sed sed = new Sed();
- sed.sed(filename, "@@SREC_FILES@@", srecFiles);
+ sed.sed(filename, "@@SREC_FILES@@", srecFiles);
+ sed.sed(filename, "@@ELF_RULES@@", elfRules);
System.out.println("done!");
}
}