Skip to content

Commit

Permalink
[util,otp] Make OTP Image MEM lines deterministic
Browse files Browse the repository at this point in the history
Sorts the set of word annotations for a MEM line in the OTP image, such
that the MEM line being read by Vivado is the same, but the word
annotations always appear in the same order, improving the determinism
of the builds.

Previously, usage of Python's sets meant that for MEM lines with multiple
word attributes, they could appear in different orders between builds,
causing slight differences in the output images (and thus potentially
requiring later actions to be re-run instead of cache hits due to
differences in the generated OTP image).

Signed-off-by: Alex Jones <[email protected]>
  • Loading branch information
AlexJones0 authored and jwnrt committed Jan 10, 2025
1 parent b3b2a19 commit 6f95ef2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion util/design/lib/OtpMemImg.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def _to_memfile_with_ecc(data, annotation, config,
# count ECC bits. In a comment, we also include any annotations
# associated with the word.
line = '@{:06x} {} // {}'.format(i_word, word_hex,
', '.join(word_annotations))
', '.join(sorted(word_annotations)))
mem_lines.append(line)

log.info('Done.')
Expand Down

0 comments on commit 6f95ef2

Please sign in to comment.