diff --git a/apycula/chipdb.py b/apycula/chipdb.py index d62b2351..cda44e10 100644 --- a/apycula/chipdb.py +++ b/apycula/chipdb.py @@ -83,7 +83,8 @@ class Device: grid: List[List[Tile]] = field(default_factory=list) timing: Dict[str, Dict[str, List[float]]] = field(default_factory=dict) packages: Dict[str, Tuple[str, str, str]] = field(default_factory=dict) - pinout: Dict[str, Dict[str, Dict[str, str]]] = field(default_factory=dict) + # {variant: {package: {pin#: (pin_name, [cfgs])}}} + pinout: Dict[str, Dict[str, Dict[str, Tuple[str, List[str]]]]] = field(default_factory=dict) pin_bank: Dict[str, int] = field(default_factory = dict) cmd_hdr: List[ByteString] = field(default_factory=list) cmd_ftr: List[ByteString] = field(default_factory=list) diff --git a/apycula/gowin_bba.py b/apycula/gowin_bba.py index d001e245..73eb94b3 100644 --- a/apycula/gowin_bba.py +++ b/apycula/gowin_bba.py @@ -179,9 +179,15 @@ def write_pinout(b, db): for pkg, pins in pkgs.items(): b.u32(id_string(pkg)) with b.block("pins") as pinblk: - for num, loc in pins.items(): + for num, loccfg in pins.items(): + loc, cfgs = loccfg b.u16(id_string(num)) b.u16(id_string(iob2bel(db, loc))) + with b.block("cfgs") as cfgblk: + for cfg in cfgs: + b.u32(id_string(cfg)) + b.u32(len(cfgs)) + b.ref(cfgblk) b.u32(len(pins)) b.ref(pinblk) b.u32(len(pkgs)) @@ -197,7 +203,7 @@ def write_chipdb(db, f, device): b.pre('NEXTPNR_NAMESPACE_BEGIN') with b.block(f'chipdb_{cdev}') as blk: b.str(device) - b.u32(1) # version + b.u32(2) # version b.u16(db.rows) b.u16(db.cols) write_grid(b, db.grid) diff --git a/apycula/pindef.py b/apycula/pindef.py index 8c2b059b..0b5bba6e 100644 --- a/apycula/pindef.py +++ b/apycula/pindef.py @@ -85,7 +85,10 @@ def get_pin_locs(device, package, special_pins=False): df = get_package(device, package, special_pins) res = {} for pin in df: - res[str(pin['INDEX'])] = pin['NAME'] + cfgs = [] + if 'CFG' in pin.keys(): + cfgs = pin['CFG'].split('/') + res[str(pin['INDEX'])] = (pin['NAME'], cfgs) return res def get_clock_locs(device, package):