Add first versions of predicates for configuration queries
authorDaniel Schwyn <danielschwyn@gmail.com>
Wed, 24 May 2017 14:00:54 +0000 (16:00 +0200)
committerDaniel Schwyn <schwyda@student.ethz.ch>
Tue, 13 Jun 2017 12:21:56 +0000 (14:21 +0200)
Signed-off-by: Daniel Schwyn <schwyda@student.ethz.ch>

tools/sockeye2/decodingNet.pl

index 32a6295..23da5bb 100644 (file)
@@ -103,20 +103,51 @@ findRanges(SrcName,DestName,SrcRange,DestRange) :-
     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
-        ]
+printRange((SrcId,SrcMin,SrcMax)) :-
+    printf("%a [0x%x..0x%x]",
+        [ SrcId,SrcMin,SrcMax ]
     ).
 
+printSrcDestRanges(SrcRange,DestRange) :-
+    printRange(SrcRange),
+    write(" -> "),
+    printRange(DestRange),
+    writeln("").
+
+printSharedRanges(Range1,SharedRange,Range2) :-
+    printRange(Range1),
+    write(" -> "),
+    printRange(SharedRange),
+    write(" <- "),
+    printRange(Range2),
+    writeln("").
+
 findTargetRanges(NodeId) :-
     SrcName = name(NodeId,_),
     findall((SrcRange,DestRange),findRanges(SrcName,_,SrcRange,DestRange),List),
-    (foreach((Src,Dest),List) do printRanges(Src,Dest)).
+    (foreach((Src,Dest),List) do printSrcDestRanges(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
+    (foreach((Src,Dest),List) do printSrcDestRanges(Src,Dest)).
+
+findDeviceFrame(NodeId,DeviceId) :-
+    SrcName = name(NodeId,_),
+    DestName = name(DeviceId,_),
+    findRanges(SrcName,DestName,SrcRange,DestRange),
+    printSrcDestRanges(SrcRange,DestRange).
+
+findInterruptLine(NodeId,DeviceId) :-
+    SrcName = name(DeviceId,_),
+    DestName = name(NodeId,_),
+    findRanges(SrcName,DestName,SrcRange,DestRange),
+    printSrcDestRanges(SrcRange,DestRange).
+
+findSharedMemoryFrame(NodeId,DeviceId) :-
+    NodeName = name(NodeId,_),
+    DevName = name(DeviceId,_),
+    findRanges(NodeName,_,NodeRange,SharedRange),
+    findRanges(DevName,_,DeviceRange,SharedRange),
+    printSharedRanges(NodeRange,SharedRange,DeviceRange).    
\ No newline at end of file