roi_harness: Adjust bit word settings to fix bit2fasm Signed-off-by: Tomasz Michalak <tmichalak@antmicro.com>
diff --git a/utils/bitstream.py b/utils/bitstream.py index 832e46d..2dbb8c4 100644 --- a/utils/bitstream.py +++ b/utils/bitstream.py
@@ -3,13 +3,8 @@ from utils import util # Break frames into WORD_SIZE bit words. -WORD_SIZE_BITS = 32 - -# How many 32-bit words for frame in a 7-series bitstream? -FRAME_WORD_COUNT = 101 - -# What alignment is expect for columns. -FRAME_ALIGNMENT = 0x80 +WORD_SIZE_BITS = 16 +FRAME_ALIGNMENT = 0x100 ''' Sample: bit_0002000f_079_06 @@ -28,7 +23,7 @@ bitdata is a map of of two sets. The map key is the frame address. The first sets are the word columns that have any bits set. - Word columsn are WORD_SIZE_BITS wide. + Word columns are WORD_SIZE_BITS wide. The second sets are bit index within the frame and word if it is set. """ bitdata = dict() @@ -36,8 +31,8 @@ for line in f: line = line.split("_") frame = int(line[1], 16) - wordidx = int(line[2], 10) - bitidx = int(line[3], 10) + wordidx = int(line[2], 10) * (32 / WORD_SIZE_BITS) + int(line[3], 10) // WORD_SIZE_BITS + bitidx = int(line[3], 10) % WORD_SIZE_BITS if frame not in bitdata: bitdata[frame] = set(), set()
diff --git a/utils/fasm_disassembler.py b/utils/fasm_disassembler.py index 44415ef..97609c5 100644 --- a/utils/fasm_disassembler.py +++ b/utils/fasm_disassembler.py
@@ -142,13 +142,13 @@ for bit in remaining_bits: frame_offset = frame % bitstream.FRAME_ALIGNMENT aligned_frame = frame - frame_offset - wordidx = bit // bitstream.WORD_SIZE_BITS - bitidx = bit % bitstream.WORD_SIZE_BITS + wordidx = int(bit // bitstream.WORD_SIZE_BITS) + bitidx = int(bit % bitstream.WORD_SIZE_BITS) annotations = [] annotations.append( fasm.Annotation( - 'unknown_bit', '{:08x}_{}_{}'.format( + 'unknown_bit', '{:08x}_{:03d}_{:02d}'.format( frame, wordidx, bitidx))) annotations.append( fasm.Annotation( @@ -157,7 +157,7 @@ annotations.append( fasm.Annotation( 'unknown_segbit', '{:02d}_{:02d}'.format( - frame_offset, bit))) + frame_offset, int(bit)))) yield fasm.FasmLine( set_feature=None, annotations=tuple(annotations),