import pandas as pd # Get dictionaries of: # - Non-global GPIO to FPGA mapping # - Global GPIO to FPGA mapping # (Ordered) def GPIOMapping(): # Standard extraction of data from excel file data = pd.read_excel("nmigen/FPGA_pins.xlsx", skiprows = range(1,2)) df = pd.DataFrame(data, columns=["Designator", "Pin Name", "Net"]) stm32 = df[df.Net.str.startswith("STM32")] # Change some GPIO mapping for Nucleo-H743ZI2 # Created a mapping from old pins to new pins old_to_new_dict = { # Old : New "PC1" :"PB1" , "PC4" :"PC2" , "PC5" :"PF10" , "PA1" :"PB2" , "PA7" :"PE9" , "PA8" :"PF2" , "PA9" :"PF1" , "PA10" :"PF0" , "PB1" :"PF4" , "PC2" :"PF5" , "PA2" :"PF6" , "PB6" :"PG6" , "PE13" :"PG12" , "PF14" :"PE14" , "PE14" :"PE6" , } # Extract data from stm32 dataframe to a dictionary gpio_dict = {} global_gpio_dict = {} for index, row in stm32.iterrows(): # Replace old pins with new pins # Note: There are 2 PE6 pins on Nucleo-H743ZI2 # This will remove 1 mapping of PE6, keys cannot be duplicated key = row["Net"].split("_")[1] if key in old_to_new_dict: key = old_to_new_dict.pop(key) dict_entry = {key: row["Designator"]} # Insert mappings into dictionary if "BIN" in row["Pin Name"]: global_gpio_dict.update(dict_entry) else: gpio_dict.update(dict_entry) return gpio_dict, global_gpio_dict # Function to provide mapping EEM pins to differential pins # Usage: # Positive pin: [][][0] # Negative pin: [][][1] def diffMapping(): eem0 = [ # P+ve , N-ve [ "J3" , "H1" ], [ "F5" , "B1" ], [ "C1" , "C2" ], [ "F4" , "D2" ], [ "G5" , "D1" ], [ "G4" , "E3" ], [ "H5" , "E2" ], [ "G3" , "F3" ], ] eem1 = [ # P+ve , N-ve [ "L6" , "L3" ], [ "H6" , "F1" ], [ "H4" , "G2" ], [ "J4" , "H2" ], [ "J2" , "J1" ], [ "K1" , "K3" ], [ "L4" , "L1" ], [ "K4" , "M1" ], ] eem2 = [ # P+ve , N-ve [ "J5" , "G1" ], [ "K5" , "M2" ], [ "L7" , "N2" ], [ "M6" , "M3" ], [ "L5" , "N3" ], [ "P1" , "M4" ], [ "P2" , "M5" ], [ "R1" , "N4" ], ] return [eem0, eem1, eem2]