Add predicates to print all origin/target ranges of a node
authorDaniel Schwyn <danielschwyn@gmail.com>
Tue, 23 May 2017 10:17:21 +0000 (12:17 +0200)
committerDaniel Schwyn <schwyda@student.ethz.ch>
Tue, 13 Jun 2017 12:21:52 +0000 (14:21 +0200)
Signed-off-by: Daniel Schwyn <schwyda@student.ethz.ch>

tools/sockeye2/decodingNet.pl

index a72e4a9..32a6295 100644 (file)
@@ -94,12 +94,29 @@ findOrigins(SrcName,DestName) :-
     name(_,Addr) = SrcName,
     labeling([Addr]).
 
-findTargetRange(SrcName,SrcRange,DestRange) :-
+findRanges(SrcName,DestName,SrcRange,DestRange) :-
     resolve(SrcName,DestName),
     name(SrcId,SrcAddr) = SrcName,
     name(DestId,DestAddr) = DestName,
     get_min(SrcAddr,SrcMin),get_max(SrcAddr,SrcMax),
     get_min(DestAddr,DestMin),get_max(DestAddr,DestMax),
-    SrcRange = (SrcId,SrcMin,SrcMax),
-    DestRange = (DestId,DestMin,DestMax),
-    labeling([DestMin]).
\ No newline at end of file
+    SrcRange = (SrcId, SrcMin, SrcMax),
+    DestRange = (DestId, DestMin, DestMax).
+
+printRanges((SrcId,SrcMin,SrcMax),(DestId,DestMin,DestMax)) :-
+    printf("%a [0x%x..0x%x] -> %a [0x%x..0x%x]\n",
+        [ SrcId,SrcMin,SrcMax
+        , DestId,DestMin,DestMax
+        ]
+    ).
+
+findTargetRanges(NodeId) :-
+    SrcName = name(NodeId,_),
+    findall((SrcRange,DestRange),findRanges(SrcName,_,SrcRange,DestRange),List),
+    (foreach((Src,Dest),List) do printRanges(Src,Dest)).
+
+
+findOriginRanges(NodeId) :-
+    DestName = name(NodeId,_),
+    findall((SrcRange,DestRange),findRanges(_,DestName,SrcRange,DestRange),List),
+    (foreach((Src,Dest),List) do printRanges(Src,Dest)).
\ No newline at end of file