Fix translate predicate
authorDaniel Schwyn <danielschwyn@gmail.com>
Fri, 19 May 2017 14:55:27 +0000 (16:55 +0200)
committerDaniel Schwyn <schwyda@student.ethz.ch>
Tue, 13 Jun 2017 12:21:28 +0000 (14:21 +0200)
Signed-off-by: Daniel Schwyn <schwyda@student.ethz.ch>

tools/sockeye2/decodingNet.pl

index baae557..61afaa2 100644 (file)
@@ -17,11 +17,11 @@ blockListContains([B|Blocks],Addr) :-
     blockContains(B,Addr);
     blockListContains(Blocks,Addr).
 
-mapsToName(map(Src,Dest,DestBase),Addr,Name) :-
-    blockContains(Src,Addr),
-    block(SrcBase,_) = Src,
-    DestAddr is Addr - SrcBase + DestBase,
-    Name = name(Dest,DestAddr).
+mapsToName(map(SrcBlock,Dest,DestBase),Addr,Name) :-
+    name(Dest,DestAddr) = Name,
+    blockContains(SrcBlock,Addr),
+    block(SrcBase,_) = SrcBlock,
+    DestAddr is Addr - SrcBase + DestBase.
 
 listMapsToName([M|Maps],Addr,Name) :-
     mapsToName(M,Addr,Name);
@@ -30,14 +30,19 @@ listMapsToName([M|Maps],Addr,Name) :-
 accept(node(Accept,_,_),Addr) :-
     blockListContains(Accept,Addr).
 
-translate(node(_,Translate,_),Addr,Name) :-
-    listMapsToName(Translate,Addr,Name),!.
+translateMap(node(_,Translate,_),Addr,Name) :-
+    listMapsToName(Translate,Addr,Name).
 
-translate(Node,Addr,Name) :-
+translateOverlay(Node,Addr,Name) :-
     not(accept(Node,Addr)),
+    not(translateMap(Node,Addr,Name)),
     node(_,_,Overlay) = Node,
     Name = name(Overlay,Addr).
 
+translate(Node,Addr,Name) :-
+    translateMap(Node,Addr,Name);
+    translateOverlay(Node,Addr,Name).
+
 acceptedName(Name) :-
     name(NodeId,Addr) = Name,
     net(NodeId,Node),