From 8f1237a0a6fa15526f68b3ddc2d077b9ce0fb8de Mon Sep 17 00:00:00 2001 From: occheung Date: Fri, 7 Aug 2020 13:39:43 +0800 Subject: [PATCH] nmigen: migrated --- nmigen/FPGA_pins.xlsx | Bin 0 -> 18249 bytes nmigen/fpga_config.py | 24 +++++++++ nmigen/humpback.py | 112 ++++++++++++++++++++++++++++++++++++++++++ nmigen/pin_mapper.py | 105 +++++++++++++++++++++++++++++++++++++++ nmigen/resources.py | 90 +++++++++++++++++++++++++++++++++ 5 files changed, 331 insertions(+) create mode 100644 nmigen/FPGA_pins.xlsx create mode 100644 nmigen/fpga_config.py create mode 100644 nmigen/humpback.py create mode 100644 nmigen/pin_mapper.py create mode 100644 nmigen/resources.py diff --git a/nmigen/FPGA_pins.xlsx b/nmigen/FPGA_pins.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..2ecf161a9eeb33f845a0070f3aefe62bfbc92f22 GIT binary patch literal 18249 zcmeIa1zQ|h_Bhwy3Oao_*|8UPwpTh!LZ$<)S4U&YIv~})u}6tbY(rS84A&e3Q^0R4b8$coWv#y%{+m`Y_ux|Z zx}4f73fFMS6!O+jwCPV4G@g2wTMUxmk))o>m@aw+3M3lJG)79z4i72P9gfsZ?`8~) zL06eW;@S~ceyl;Zc5o8PvfW{Oe>-5s`^5~?FiM&#HXyL#x*Jseq67nYr zn4AYFSVq=imb2Q7d-n=re3cnF`%b*_NU?#2-@Arq(vlS$XCjA9YE8dhFpwoC&&^32 z;8Qd>)Wp>#e{78JWmEVQY8(9h-7ESH%6`jbmk9Du7YVs{=<)jCKCkD|#Ey30$$9d= zFY5~=0Py+>22l8qX<4tzOm+p#H5uTng9A=WeFsx3M<&L%_y3!Y{}0c>znNYZFDu`} z3?FhT@f13EJF^mpEF$eHEYV7$;^QZ|j8q@}l^k!SlL{YM1vd~(+_&B5X?SUcFZy7R zGo? zsdKSv~ntmEPX z6gk(vT6JvaBbn~KoG?A5gJ(klkwnF-zz+4_lf;pnz)%+q0N92C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x2qf-K_>U3?A_*rtS>qLcc7_m^OzLqGBRr zUgqi$3-?Bt(v3|F%599DW&!66*S3~QgSokzF9s7d+!z>B+shOYGan0LU1CPIC1eoG}U(4-s9_}bF=-87?_)B{KR z@g;9-EstD?Lkm~=aZ(l%oK6PQ4I~)^+@2SnG~%UlZGhNoSEjr@R0xU-EEgdU1U}=a z__JXLyfwJ5$%e{v%?pFzfNT@k_i^U&&`<4wLF{|Ju#apCu^Gk=?L!VwK9SdZKh{KE zub8%8XD<&m@4s%VXO1R5Jq$enbMucgX%J8b;92wkerUI+lKetZ) z#mOE1-%9+~M#_J3`R4-IUtI2Ke{=cga@ao^{PSwvUksvIe>3>&+TA}%|9LUwFH#Hk zKS=+1Y2=?A{[][][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] + diff --git a/nmigen/resources.py b/nmigen/resources.py new file mode 100644 index 0000000..0eeb3bc --- /dev/null +++ b/nmigen/resources.py @@ -0,0 +1,90 @@ +from nmigen.build import * + + +__all__ = ["I2CResource", "GPIOResources", "DiffResources"] + + +def I2CResource(*args, sda, scl, conn=None, attrs=None, role="host"): + assert role in ("host", "device") + + io = [] + + # sda line: I/O port for the data line + io.append(Subsignal("sda", Pins(sda, dir="io", conn=conn, assert_width=1))) + + # sck line: I2C clock signal outputs from master to slave + if role == "host": + io.append(Subsignal("scl", Pins(scl, dir="o", conn=conn, assert_width=1))) + else: #device + io.append(Subsignal("scl", Pins(scl, dir="i", conn=conn, assert_width=1))) + + if attrs is not None: + io.append(attrs) + return Resource.family(*args, default_name="i2c", ios=io) + +# Auto create a resource list given a set of iCE40 pins and STM32 pin names (pins_dict) +def GPIOResources(*args, pins_dict, dir = "o", invert=False, conn=None, attrs=None): + + # Check data integrity: pins_dict must be a dict AND port must be from a to k + assert isinstance(pins_dict, dict) + + # Debug: dir == "o" + assert dir == "o" + + # List of resources to be returned + resources = [] + for STM32_pin, iCE40_pin in pins_dict.items(): + + # Set all gpio pins to be output only for the time being + + # TODO: Allow dir argument. + ios = [Pins(iCE40_pin, dir=dir, invert=invert, conn=conn)] + if attrs is not None: + ios.append(attrs) + + # Extract GPIO port and port number from STM32_pin + # Strip "P" from P + if STM32_pin.startswith('P'): + STM32_pin = STM32_pin[1:] + + # Acquire port from + port = STM32_pin[0].lower() + port_num = int(STM32_pin[1:]) + + # Insert gpio. into resources list + resources.append(Resource.family(*args, port_num, default_name=("gpio"+port), ios=ios)) + return resources + +# Auto create a resource list for differential I/O +def DiffResources(*args, eem_pins, invert=False, conn=None, attrs=None, dir): + # TODO: Everything + + # assert dimensionality + assert isinstance(eem_pins, list) + assert isinstance(eem_pins[0], list) + assert isinstance(eem_pins[0][0], list) + assert isinstance(eem_pins[0][0][0], str) + + # assert direction to be either input or output + # reject tristate or bidirectional pin + assert dir in ("i", "o") + + + + +if __name__ == "__main__": + + from pin_mapper import * + eem = diffMapping() + DiffResources(eem_pins = eem, dir = "o", + attrs=Attrs(IO_STANDARD="SB_LVCMOS") + ) + + + + + + + + +