From f6ccae48f3a048d6f46e33db5a5db38023d616f2 Mon Sep 17 00:00:00 2001 From: occheung Date: Fri, 7 Aug 2020 16:32:44 +0800 Subject: [PATCH] humpback: copied connectors --- nmigen/humpback.py | 79 +++++++++++++++++++++++++++++--- nmigen/pin_mapper.py | 105 ------------------------------------------- 2 files changed, 73 insertions(+), 111 deletions(-) delete mode 100644 nmigen/pin_mapper.py diff --git a/nmigen/humpback.py b/nmigen/humpback.py index a040f60..257ab92 100644 --- a/nmigen/humpback.py +++ b/nmigen/humpback.py @@ -62,10 +62,10 @@ class HumpbackPlatform(LatticeICE40Platform): ] # Using the dict approach in (o)migen - # Note: Numbering is required in nMigen, so some probably meaningful strings/integers are inserted + # Note: Numbering is required in nMigen, so some probably not very meaningful strings/integers are inserted connectors = [ - # EEM0 Connection Interface + # EEM0 Connector Connector("eem", 0, { "d0_cc_n": "H1", "d0_cc_p": "J3", @@ -85,7 +85,7 @@ class HumpbackPlatform(LatticeICE40Platform): "d7_p" : "G3", }), - # EEM1 Connection Interface + # EEM1 Connector Connector("eem", 1, { "d0_cc_n": "L3", "d0_cc_p": "L6", @@ -105,7 +105,7 @@ class HumpbackPlatform(LatticeICE40Platform): "d7_p": "K4", }), - # EEM2 Connection Interface + # EEM2 Connector Connector("eem", 2, { "d0_cc_n": "G1", "d0_cc_p": "J5", @@ -125,8 +125,8 @@ class HumpbackPlatform(LatticeICE40Platform): "d7_p": "R1", }), - # STM32 Connection Pins - Connector("stm32", "pin", { + # STM32 Nucleo/ Arduino Connector + Connector("stm32", "pins", { "PA0": "A2", "PA1": "P14", "PA2": "B8", @@ -179,6 +179,73 @@ class HumpbackPlatform(LatticeICE40Platform): "PG2": "K14", "PG3": "K15", }), + + # Beaglebone Black Connector + Connector("bb", "pins", { + "CLKOUT": "R9", + + "GPIO0_7": "R14", + + "GPIO1_16": "A16", + "GPIO1_17": "R3", + "GPIO1_29": "D11", + "GPIO1_31": "D14", + + "GPIO2_6": "D16", + "GPIO2_7": "C16", + "GPIO2_8": "E16", + "GPIO2_9": "D15", + "GPIO2_11": "F15", + "GPIO2_13": "F16", + "GPIO2_22": "C11", + "GPIO2_23": "C10", + "GPIO2_24": "E10", + "GPIO2_25": "D4", + + "GPIO3_19": "P4", + "GPIO3_21": "R4", + + "GPMC_A2": "T7", + "GPMC_A3": "T1", + "GPMC_A14": "F9", + "GPMC_A15": "B7", + "GPMC_AD0": "C12", + "GPMC_AD1": "E11", + "GPMC_AD2": "J12", + "GPMC_AD3": "J11", + "GPMC_AD4": "C13", + "GPMC_AD5": "C14", + "GPMC_AD6": "J14", + "GPMC_AD7": "J13", + "GPMC_AD8": "E13", + "GPMC_AD9": "G13", + "GPMC_AD10": "G14", + "GPMC_AD11": "G10", + "GPMC_AD12": "E14", + "GPMC_AD13": "H14", + "GPMC_AD14": "F14", + "GPMC_AD15": "F13", + "GPMC_ADVN": "H12", + "GPMC_BE0N": "G16", + "GPMC_CLK": "H11", + "GPMC_CSN1": "D13", + "GPMC_OEN": "H13", + "GPMC_WE1N": "G15", + }), + + # ESP32 Connector + Connector("esp32", "pins", { + "IO2": "D9", + "IO4": "D7", + "IO22": "C7", + "IO34": "E9", + "IO35": "C9", + }), + + # OrangePI Zero Connector + Connector("orange_pi", "pins", { + "PG06": "A15", + }), ] # tool chain setup, using default ICE40 HX8K evaluation code diff --git a/nmigen/pin_mapper.py b/nmigen/pin_mapper.py deleted file mode 100644 index c740522..0000000 --- a/nmigen/pin_mapper.py +++ /dev/null @@ -1,105 +0,0 @@ -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] -