Skip to content
Snippets Groups Projects
Commit 8dc42211 authored by Anders Nilsson's avatar Anders Nilsson
Browse files

Can merge actor connections in an xdf (though only in very simple cases).

parent 6db494f9
Branches
No related tags found
No related merge requests found
......@@ -23,28 +23,35 @@ aspect MergeActors {
HashSet<Connection> cons = getConnections(new HashSet<Connection>());
for (Instance i : schedule) {
while (i.next != null) {
// System.out.println("Searching connections for: "+i.name()+" "+i.next.name());
for (Connection c : cons) {
System.out.println(" "+c.getSource().name()+" "+c.getDest().name());
if (c.getSource() == i && c.getDest() == i.next) {
// System.out.println(" Found");
// Check port names and perform actual actor
// merge. Then set remove_me flag so that this
// connection will be removed from the actor
// network.
c.remove_me = true;
c.is$Final(false);
} else if (c.getSource() == i.next) {
c.setSource(i.id());
}
}
i.merge(i.next);
i.setName(i.name()+"_"+i.next.name());
i.next = i.next.next;
}
}
}
void Connection.mergeActors() {
Instance src = getSource();
Instance dest = getDest();
if (dest.isSDF() && src.isSDF()) {
src.merge(dest);
src.setName(src.name()+"_"+dest.name());
}
}
// void Connection.mergeActors() {
// Instance src = getSource();
// Instance dest = getDest();
// if (dest.isSDF() && src.isSDF()) {
// src.merge(dest);
// src.setName(src.name()+"_"+dest.name());
// }
// }
void Instance.merge(Instance inst) {}
}
......
......@@ -28,15 +28,17 @@ aspect SSR {
}
aspect SDF {
syn boolean Instance.isSDF() {
syn boolean Instance.isSDF() = xlimInstance().isSDF();
syn xlimAST.design Instance.xlimInstance() {
try {
System.out.println("Trying to open: "+name());
xlimAST.XmlParser parser = new xlimAST.XmlParser(new FileReader(name()+".xlim"));
return parser.Start().isSDF();
return (xlimAST.design) parser.Start().getSpecification().getElement(0);
} catch (Exception e) {
System.out.println( name()+".xlim not found");
// e.printStackTrace();
return false;
return new xlimAST.design();
}
}
}
......@@ -92,6 +94,14 @@ aspect ActorLookup {
return "";
}
void Connection.setSource(String src) {
for (Attribute a : getAttributes()) {
if (a instanceof src) {
a.getAttrValue().setLITERAL(src);
}
}
}
syn Instance Connection.getDest() = root().getInstance(dest());
String Connection.dest() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment