ed7a9701b3cbaf6f4f6bf42ffda73fec73b0eb30
2 N_MUX
= 1 # number of selection lines for the mux per io
12 def missing_numbers(num_list
):
13 original_list
= [x
for x
in range(num_list
[0], num_list
[-1] + 1)]
14 num_list
= set(num_list
)
15 return (list(num_list ^
set(original_list
)))
18 # == capture the number of IO cells required == #
19 pinmapfile
= open('pinmap.txt', 'r')
24 for lineno
, line
in enumerate(pinmapfile
):
27 pinnumbers
.append(int(line1
[0]))
28 if(len(line1
) == 2): # dedicated
29 dedicated_cells
.append(line1
)
31 muxed_cells
.append(line1
)
32 pinnumbers
= sorted(pinnumbers
)
33 # ============================================= #
34 # ======= Multiple checks to see if the user has not screwed ======#
35 missing_pins
= missing_numbers(pinnumbers
)
37 # Check-1: ensure that no pin is present in both muxed and dedicated pins
38 for muxcell
in muxed_cells
:
39 for dedcel
in dedicated_cells
:
40 if(dedcel
[1] in muxcell
):
41 print("ERROR: " + str(dedcel
[1]) + " present \
42 in dedicated & muxed lists")
45 # Check-2: if pin numbering is consistent:
47 print("ERROR: Following pins have no assignment: " +
48 str(missing_numbers(pinnumbers
)))
50 unique
= set(pinnumbers
)
53 count
= pinnumbers
.count(each
)
55 print("ERROR: Multiple assignment for pin: " + str(each
))
60 # Check-2: confirm if N_* matches the instances in the pinmap
61 # ============================================================== #
63 # == user info after parsin ================= #
64 N_IO
= len(dedicated_cells
) + len(muxed_cells
)
65 print("Max number of IO: " + str(N_IO
))
66 print("Muxed IOs: " + str(len(muxed_cells
)))
67 print("Dedicated IOs: " + str(len(dedicated_cells
)))
68 # ============================================ #