forked from olofk/ipyxact
-
Notifications
You must be signed in to change notification settings - Fork 0
/
print_businterfaces.py
43 lines (38 loc) · 1.74 KB
/
print_businterfaces.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import sys
from ipyxact.ipyxact import Component
def get_businterfaces(busInterfaces):
ifs = []
for busInterface in busInterfaces.busInterface:
print('='*20)
print('name : ' + busInterface.name)
_vendor = busInterface.busType.vendor
_library = busInterface.busType.library
_name = busInterface.busType.name
_version = busInterface.busType.version
print(busInterface.busType.name)
print('busType : {}/{}/{}/{}'.format(_vendor,
_library,
_name,
_version))
print('abstractionType : {}/{}/{}/{}'.format(_vendor,
_library,
_name,
_version))
for portMap in busInterface.portMaps.portMap:
print("{}[{}:{}] => {}[{}:{}]".format(portMap.logicalPort.name,
portMap.logicalPort.vector.left,
portMap.logicalPort.vector.right,
portMap.physicalPort.name,
portMap.physicalPort.vector.left,
portMap.physicalPort.vector.right))
return ifs
if __name__ == "__main__":
f = open(sys.argv[1])
component = Component()
component.load(f)
if component.busInterfaces is not None:
ifs = get_businterfaces(component.busInterfaces)
print(ifs)
else:
print("No bus interfaces found in file")
f.close()