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