X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=dol%2Fsrc%2Fdol%2Fvisitor%2Fepiphany%2FEpiphanyVisitor.java;fp=dol%2Fsrc%2Fdol%2Fvisitor%2Fepiphany%2FEpiphanyVisitor.java;h=75647964c665498c14c085def7ec43f4e0ae7ded;hb=5c6b254e8b3f8c0104ffb5ef6c1e800f5ee04323;hp=5a053ca424e84a289462d5bd141750dd49b7f2ee;hpb=84b2539b604e9b7781aa0bd56a09b2736b661ce2;p=jump.git diff --git a/dol/src/dol/visitor/epiphany/EpiphanyVisitor.java b/dol/src/dol/visitor/epiphany/EpiphanyVisitor.java index 5a053ca..7564796 100644 --- a/dol/src/dol/visitor/epiphany/EpiphanyVisitor.java +++ b/dol/src/dol/visitor/epiphany/EpiphanyVisitor.java @@ -97,9 +97,9 @@ public class EpiphanyVisitor extends PNVisitor { // 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); @@ -194,11 +194,11 @@ public class EpiphanyVisitor extends PNVisitor { 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"); @@ -208,6 +208,34 @@ public class EpiphanyVisitor extends PNVisitor { File fTemplate = new File(template); copyFile(fTemplate, fFilename); + /* handle this process' iterators */ + String instance = ""; + Vector 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 = ""; @@ -216,7 +244,7 @@ public class EpiphanyVisitor extends PNVisitor { 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"; @@ -244,6 +272,7 @@ public class EpiphanyVisitor extends PNVisitor { /* 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); @@ -309,6 +338,7 @@ public class EpiphanyVisitor extends PNVisitor { 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++; @@ -354,15 +384,31 @@ public class EpiphanyVisitor extends PNVisitor { /* 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!"); } }