Skip to content

Commit

Permalink
Merge pull request f4pga#619 from litghost/fix_frame_init_regression
Browse files Browse the repository at this point in the history
Fix frame initialization regression.
  • Loading branch information
litghost committed Feb 7, 2019
2 parents 4794fe5 + 8acbf97 commit f3a8ee2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
23 changes: 11 additions & 12 deletions prjxray/fasm_assembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,10 @@ def frame_clear(self, frame_addr, word_addr, bit_index, line):
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
Expand All @@ -125,23 +124,23 @@ def update_segbit(bit):

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 = []
Expand Down
4 changes: 2 additions & 2 deletions prjxray/tile_segbits.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ def feature_to_bits(self, feature, address=0):
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
2 changes: 1 addition & 1 deletion utils/bit2fasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def is_zero_feature(feature):
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

Expand Down

0 comments on commit f3a8ee2

Please sign in to comment.