1 import matplotlib.cm
as cm
2 import matplotlib
as matplotlib
3 from matplotlib.colors
import Normalize
4 import matplotlib.pyplot
as plt
5 import matplotlib.patches
as patches
8 from matplotlib.patches
import Patch
15 assert(len(sys.argv) == 3)
17 targetPath = sys.argv[1]
18 deviceName = sys.argv[2]
20 deviceInfoFile = open(targetPath+
"/"+deviceName +
21 "/"+deviceName+
"_PCIEPin2Sw",
"r")
22 refpinnamefile = open(
23 str(pathlib.Path(__file__).parent.absolute())+
"/pcierefpinname",
"r")
26 lines = deviceInfoFile.readlines()
27 exportfile = open(targetPath+
"/"+deviceName +
28 "/"+deviceName+
"_PCIEPin2SwXY",
"w")
30 devicePinNames = set()
34 pin_SW = line.replace(
"\n",
"").replace(
35 "pin=> ",
"").replace(
" swtile=> ",
";").split(
";")
39 if (re.search(
"[0-9]+", pinName)):
40 if (pinName.find(
"_") >= 0):
41 lastWord = pinName[pinName.rfind(
"_")+1:]
42 prevWord = pinName[:pinName.rfind(
"_")]
43 tmploc = re.search(
"[0-9]+", lastWord)
44 if (
not tmploc
is None):
45 tmploc = re.search(
"[0-9]+", lastWord).span()[0]
46 lastWord = lastWord[:tmploc]+
"["+lastWord[tmploc:]+
"]"
47 pinName = prevWord+lastWord
49 tmploc = re.search(
"[0-9]+", pinName).span()[0]
50 pinName = pinName[:tmploc]+
"["+pinName[tmploc:]+
"]"
52 pinName = pinName.replace(
"_",
"")
53 pinName = pinName.split(
"/")[1]
57 Y = int(SWName[SWName.rfind(
"Y")+1:])
58 devicePinNames.add(pinName)
60 print(
"pin=> "+pinName+
" swX=> "+str(X) +
61 " swY=> "+str(Y), file=exportfile)
65 lines = refpinnamefile.readlines()
67 designRefPinNames = set(lines[0].replace(
"\n",
"").split(
" "))
69 print(
"designRefPinNames-devicePinNames: ", designRefPinNames-devicePinNames)
71 if (len(designRefPinNames-devicePinNames) > 0):
72 print(
"WARNING!!!!!!!!!!!!!!!!!")
73 print(
"The pins shown above fail to match with the design pins!")
74 print(
"They are required to find their loacations!! Find them in Vivado!!!!")
75 print(
"Add them in file: ( ", targetPath+
"/"+deviceName +
76 "/"+deviceName+
"_PCIEPin2SwXY",
" )")