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

Merge results in a compilable and runnable Cal network, though logic is wrong.

parent d5e3a8e9
Branches
No related tags found
No related merge requests found
......@@ -42,9 +42,9 @@ aspect MergeActors {
}
}
System.out.println("Merging "+i.name()+":"+i.next.name());
i.isMerged(true);
i.merge(i.next);
i.setName(i.name()+"_"+i.next.name());
i.isMerged(true);
i.next.disabled = true;
i.next = i.next.next;
}
......@@ -74,6 +74,10 @@ aspect MergeActors {
System.out.println("Could not print to file: "+name());
}
}
if (disabled) {
// remove from AST
is$Final(false);
}
}
private boolean Instance.isMerged = false;
......@@ -123,4 +127,10 @@ aspect Rewrites {
return new ComplexElement();
}
}
rewrite Instance {
when (disabled) to ComplexElement {
System.out.println("Removing instance: "+name());
return new ComplexElement();
}
}
}
......@@ -15,12 +15,16 @@ aspect Merge {
public void EmptyStart.merge(Start dest) {}
public void design.merge(design dest) {
HashSet<module> ops = getActions(new HashSet<module>());
System.out.println("Adding actions to: "+name());
HashSet<module> ops = dest.getActions(new HashSet<module>());
System.out.println("Adding actions from: "+dest.name()+" to: "+name());
setName(name()+"_"+dest.name());
List<Element> eList = getElements();
for (module o : ops) {
o.setName(dest.name()+"_"+o.name());
System.out.println(" Adding "+o.name());
eList.insertChild(o,eList.getNumChild()-2);
actionScheduler().addTaskCall(o);
// eList.addChild(o);
}
}
}
......@@ -48,3 +52,29 @@ aspect Actions {
return ops;
}
}
aspect ActionScheduler {
syn module Element.actionScheduler() = null;
eq ComplexElement.actionScheduler() {
for (Element e : getElements()) {
if (e.actionScheduler() != null) {
return e.actionScheduler();
}
}
return null;
}
eq module.actionScheduler() {
if (isActionScheduler()) {
return this;
}
return null;
}
boolean module.isActionScheduler() {
return kind().equals("action-scheduler");
}
void module.addTaskCall(module m) {
}
}
\ No newline at end of file
......@@ -56,6 +56,18 @@ aspect Misc {
return super.name();
}
public void Element.setName(String name) {}
public void ComplexElement.setName(String name) {
for (Attribute a : getAttributes()) {
a.setName(name);
}
}
void Attribute.setName(String name) {}
void name.setName(String name) {
getAttrValue().setLITERAL(fix(name));
}
static String ASTNode.fix(String s) {
if (s.indexOf('"') == 0) {
return s.substring(1,s.length()-1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment