Skip to content

Commit 074c4af

Browse files
authored
Merge pull request #352 from yrabbit/tlvds
Remove the current setting for True LVDS.
2 parents fe79fc0 + 87f421a commit 074c4af

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

apycula/gowin_pack.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2697,6 +2697,7 @@ def place(db, tilemap, bels, cst, args):
26972697

26982698
# second IO pass
26992699
for bank, ios in _io_bels.items():
2700+
in_bank_attrs = {}
27002701
# check IO standard
27012702
vccio = None
27022703
iostd = None
@@ -2711,6 +2712,9 @@ def place(db, tilemap, bels, cst, args):
27112712
if iob.attrs.get('SINGLERESISTOR', 'OFF') != 'OFF':
27122713
iob.attrs['DDR_DYNTERM'] = 'ON'
27132714
if iob.flags['mode'] in {'OBUF', 'IOBUF', 'TLVDS_OBUF', 'TLVDS_IOBUF', 'TLVDS_TBUF', 'TLVDS_TBUF', 'ELVDS_OBUF', 'ELVDS_IOBUF'}:
2715+
if iob.flags['mode'] in {'ELVDS_OBUF', 'ELVDS_IOBUF'}:
2716+
in_bank_attrs['BANK_VCCIO'] = '1.2'
2717+
27142718
if 'BANK_VCCIO' in iob.attrs:
27152719
if iob.attrs['BANK_VCCIO'] != _vcc_ios[iob.attrs['IO_TYPE']]:
27162720
raise Exception(f"Conflict bank VCC at {iob_name}.")
@@ -2727,8 +2731,8 @@ def place(db, tilemap, bels, cst, args):
27272731
if not vccio:
27282732
iostd = 'LVCMOS12'
27292733

2730-
in_bank_attrs = {}
2731-
in_bank_attrs['BANK_VCCIO'] = _vcc_ios[iostd]
2734+
if 'BANK_VCCIO' not in in_bank_attrs:
2735+
in_bank_attrs['BANK_VCCIO'] = _vcc_ios[iostd]
27322736

27332737
# set io bits
27342738
for name, iob in ios.items():
@@ -2767,10 +2771,10 @@ def place(db, tilemap, bels, cst, args):
27672771
# lvds
27682772
if iob.flags['mode'] in {'TLVDS_OBUF', 'TLVDS_TBUF', 'TLVDS_IOBUF'}:
27692773
in_iob_attrs.update({'LVDS_OUT': 'ON', 'ODMUX_1': 'UNKNOWN', 'ODMUX': 'TRIMUX',
2770-
'SLEWRATE': 'FAST', 'PERSISTENT': 'OFF'})
2774+
'SLEWRATE': 'FAST', 'PERSISTENT': 'OFF', 'DRIVE': '0', 'DIFFRESISTOR': 'OFF'})
27712775
elif iob.flags['mode'] in {'ELVDS_OBUF', 'ELVDS_TBUF', 'ELVDS_IOBUF'}:
27722776
in_iob_attrs.update({'ODMUX_1': 'UNKNOWN', 'ODMUX': 'TRIMUX',
2773-
'PERSISTENT': 'OFF'})
2777+
'PERSISTENT': 'OFF', 'DIFFRESISTOR': 'OFF'})
27742778
in_iob_attrs['IO_TYPE'] = get_iostd_alias(in_iob_attrs['IO_TYPE'])
27752779
if iob.flags['mode'] in {'TLVDS_IBUF', 'ELVDS_IBUF'}:
27762780
in_iob_attrs['ODMUX_1'] = 'UNKNOWN'
@@ -2835,7 +2839,7 @@ def place(db, tilemap, bels, cst, args):
28352839
if k == 'IO_TYPE' and k in in_bank_attrs and in_bank_attrs[k].startswith('LVDS'):
28362840
continue
28372841
in_bank_attrs[k] = val
2838-
#print(row, col, atr)
2842+
#print(f"io{idx}:({row}, {col}):{sorted(iob_attrs)}")
28392843
bits = get_longval_fuses(db, tiledata.ttyp, iob_attrs, f'IOB{iob_idx}')
28402844
tile = tilemap[(row, col)]
28412845
for row_, col_ in bits:
@@ -2852,8 +2856,10 @@ def place(db, tilemap, bels, cst, args):
28522856
if k not in attrids.iob_attrids:
28532857
print(f'XXX BANK: add {k} key handle')
28542858
else:
2855-
if k in {'BANK_VCCIO', 'IO_TYPE'}:
2859+
if k in {'BANK_VCCIO', 'IO_TYPE', 'LVDS_OUT', 'DRIVE'}:
28562860
add_attr_val(db, 'IOB', bank_attrs, attrids.iob_attrids[k], attrids.iob_attrvals[val])
2861+
2862+
#print(f"bank{int(bank)}:({brow}, {bcol}):{sorted(bank_attrs)}")
28572863
bits = get_bank_fuses(db, tiledata.ttyp, bank_attrs, 'BANK', int(bank))
28582864
btile = tilemap[(brow, bcol)]
28592865
for row, col in bits:

apycula/gowin_unpack.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ def parse_tile_(db, row, col, tile, default=True, noiostd = True):
465465
if name.startswith("IOB"):
466466
idx = name[-1]
467467
attrvals = parse_attrvals(tile, db.logicinfo['IOB'], db.longval[tiledata.ttyp][f'IOB{idx}'], attrids.iob_attrids, "IOB")
468-
#print(row, col, attrvals)
468+
#print(name, row, col, attrvals)
469469
try: # we can ask for invalid pin here because the IOBs share some stuff
470470
bank = chipdb.loc2bank(db, row, col)
471471
except KeyError:
@@ -506,7 +506,7 @@ def parse_tile_(db, row, col, tile, default=True, noiostd = True):
506506
bels.setdefault(name, set()).add(mode)
507507
if name.startswith("BANK"):
508508
attrvals = parse_attrvals(tile, db.logicinfo['IOB'], _bank_fuse_tables[tiledata.ttyp][name], attrids.iob_attrids, "IOB")
509-
#print('bank', row, col, attrvals)
509+
#print(name, row, col, attrvals)
510510

511511
for a, v in attrvals.items():
512512
bels.setdefault(name, set()).add(f'{a}={attrids.iob_num2val[v]}')

0 commit comments

Comments
 (0)