diff --git a/prjxray/fasm_assembler.py b/prjxray/fasm_assembler.py index ca0597e1..c756212f 100644 --- a/prjxray/fasm_assembler.py +++ b/prjxray/fasm_assembler.py @@ -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 = [] diff --git a/prjxray/tile_segbits.py b/prjxray/tile_segbits.py index 69ab8318..cb6b8856 100644 --- a/prjxray/tile_segbits.py +++ b/prjxray/tile_segbits.py @@ -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 diff --git a/utils/bit2fasm.py b/utils/bit2fasm.py index 74caeb69..553a2973 100755 --- a/utils/bit2fasm.py +++ b/utils/bit2fasm.py @@ -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