@@ -941,7 +941,14 @@ def dat_fill_io_cfgs(db, dat, device, pindesc):
941941 #print(package_cfg, _io_cfg[cfg_code])
942942 db .io_cfg [io_name ] = _io_cfg [cfg_code ]
943943 elif cfg_code :
944- raise Exception (f"unknown pin configuration { cfg_code } at { io_name } " )
944+ if device == 'GW1N-2' :
945+ # GW1N-2 bring-up: a few special-function pin config codes
946+ # (e.g. 45) aren't in _io_cfg yet. Don't crash — record a
947+ # placeholder so the grid/IO build completes. TODO: map these.
948+ print (f"WARNING: unknown pin configuration { cfg_code } at { io_name } (GW1N-2 WIP)" )
949+ db .io_cfg [io_name ] = [f'UNKNOWN_CFG_{ cfg_code } ' ]
950+ else :
951+ raise Exception (f"unknown pin configuration { cfg_code } at { io_name } " )
945952 #print(io_name, db.io_cfg[io_name])
946953 return
947954
@@ -3299,6 +3306,10 @@ def fse_create_io16(dev, device):
32993306 ('OSC' , 'GW2A-18' ): ({'OSCOUT' : 'Q4' }, {}),
33003307 ('OSC' , 'GW2A-18C' ): ({'OSCOUT' : 'Q4' }, {}),
33013308 ('OSCA' , 'GW5A-25A' ): ({}, {'OSCOUT' : (19 , 91 , 'MPLL3CLKIN2' ), 'OSCEN' : (19 , 90 , 'SEL4' )}),
3309+ # GW1N-2 bring-up: the GW1N-2/GW1N-1P5 die exposes an 'OSCO' oscillator.
3310+ # Its port->wire aliases are not yet fuzzed; empty stub lets the grid/IO
3311+ # build proceed (the OSC is a hard block, mapped later). TODO: map OSCO.
3312+ ('OSCO' , 'GW1N-2' ): ({}, {}),
33023313 }
33033314
33043315# from logic to global clocks. An interesting piece of dat['CmuxIns'], it was
@@ -4070,7 +4081,7 @@ def add_attr_val(dev, logic_table, attrs, attr, val):
40704081 attrs .add (attrval )
40714082
40724083def get_pins (device ):
4073- if device not in {"GW1N-1" , "GW1NZ-1" , "GW1N-4" , "GW1N-9" , "GW1NR-9" , "GW1N-9C" , "GW1NR-9C" , "GW1NSR-4C" , "GW2A-18" , "GW2A-18C" , "GW2AR-18C" , "GW5A-25A" , "GW5AST-138C" }:
4084+ if device not in {"GW1N-1" , "GW1NZ-1" , "GW1N-4" , "GW1N-9" , "GW1NR-9" , "GW1N-9C" , "GW1NR-9C" , "GW1NSR-4C" , "GW1N-1P5C" , " GW2A-18" , "GW2A-18C" , "GW2AR-18C" , "GW5A-25A" , "GW5AST-138C" }:
40744085 raise Exception (f"unsupported device { device } " )
40754086 pkgs = pindef .all_packages (device )
40764087 res = {}
@@ -4172,10 +4183,19 @@ def json_pinout(device):
41724183 return (res , {
41734184 "GW5AST-138C" : pins ,
41744185 }, res_bank_pins )
4186+ elif device == "GW1N-2" :
4187+ # GW1N-2 uses the GW1N-1P5C vendor data (same die). Key the pinout under the
4188+ # vendor name (downstream dat_fill_io_cfgs/pindef expect params['device']),
4189+ # and also under GW1N-2 for nextpnr compatibility.
4190+ pkgs , pins , bank_pins = get_pins ("GW1N-1P5C" )
4191+ return (pkgs , {
4192+ "GW1N-1P5C" : pins ,
4193+ "GW1N-2" : pins ,
4194+ }, bank_pins )
41754195 else :
41764196 raise Exception ("unsupported device" )
41774197
4178- _adc_inputs = [(0 , 'CLK' ), (2 , 'VSENCTL0' ), (3 , 'VSENCTL1' ), (4 , 'VSENCTL2' ), (5 , 'ADCMODE' ),
4198+ _adc_inputs = [(0 , 'CLK' ), (2 , 'VSENCTL0' ), (3 , 'VSENCTL1' ), (4 , 'VSENCTL2' ), (5 , 'ADCMODE' ),
41794199 (6 , 'DRSTN' ), (7 , 'ADCREQI' ), (8 , 'MDRP_CLK' ), (10 , 'MDRP_WDATA0' ), (11 , 'MDRP_WDATA1' ),
41804200 (12 , 'MDRP_WDATA2' ), (13 , 'MDRP_WDATA3' ), (14 , 'MDRP_WDATA4' ), (15 , 'MDRP_WDATA5' ),
41814201 (16 , 'MDRP_WDATA6' ), (17 , 'MDRP_WDATA7' ), (18 , 'MDRP_A_INC' ), (20 , 'MDRP_OPCODE0' ),
0 commit comments