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