Merge pull request #619 from litghost/fix_frame_init_regression

Fix frame initialization regression.
This commit is contained in:
litghost 2019-02-06 23:13:22 -08:00 committed by GitHub
commit f3a8ee2bb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 15 deletions

View File

@ -99,11 +99,10 @@ class FasmAssembler(object):
def enable_feature(self, tile, feature, address, line):
gridinfo = self.grid.gridinfo_at_tilename(tile)
def update_segbit(bit):
def update_segbit(block_type, bit):
'''Set or clear a single bit in a segment at the given word column and word bit position'''
# TODO: How to determine if the feature targets BLOCK_RAM segment type?
bits = gridinfo.bits[grid.BlockType.CLB_IO_CLK]
bits = gridinfo.bits[block_type]
seg_baseaddr = bits.base_address
seg_word_base = bits.offset
@ -125,23 +124,23 @@ class FasmAssembler(object):
db_k = '%s.%s' % (gridinfo.tile_type, feature)
any_bits = False
any_bits = set()
try:
for bit in segbits.feature_to_bits(db_k, address):
any_bits = True
update_segbit(bit)
for block_type, bit in segbits.feature_to_bits(db_k, address):
any_bits.add(block_type)
update_segbit(block_type, bit)
except KeyError:
raise FasmLookupError(
"Segment DB %s, key %s not found from line '%s'" %
(gridinfo.tile_type, db_k, line))
if any_bits:
for block_type in any_bits:
# Mark all frames used by this tile as in use.
bits = gridinfo.bits[grid.BlockType.CLB_IO_CLK]
if tile not in self.seen_tile:
for frame in segbits.frames(bits):
self.frames_in_use.add(frame)
bits = gridinfo.bits[block_type]
for frame in range(bits.base_address,
bits.base_address + bits.frames):
self.frames_in_use.add(frame)
def parse_fasm_filename(self, filename):
missing_features = []

View File

@ -147,9 +147,9 @@ class TileSegbits(object):
for block_type in self.segbits:
if address == 0 and feature in self.segbits[block_type]:
for bit in self.segbits[block_type][feature]:
yield bit
yield block_type, bit
return
block_type, feature = self.feature_addresses[feature][address]
for bit in self.segbits[block_type][feature]:
yield bit
yield block_type, bit

View File

@ -43,7 +43,7 @@ def bits_to_fasm(db_root, bits_file, verbose, canonical):
db_k = '%s.%s' % (gridinfo.tile_type, feature)
segbits = db.get_tile_segbits(gridinfo.tile_type)
any_bits = False
for bit in segbits.feature_to_bits(db_k):
for block_type, bit in segbits.feature_to_bits(db_k):
if bit.isset:
any_bits = True