From afb0cc78da415898ad451cd2c9b8c0a4d43bd9e3 Mon Sep 17 00:00:00 2001 From: Karol Gugala Date: Wed, 5 Jun 2019 11:48:44 +0200 Subject: [PATCH] fuzzers: 007: add docstring and assert to line_fixup function Signed-off-by: Karol Gugala --- fuzzers/007-timing/bel/fixup_timings_txt.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/fuzzers/007-timing/bel/fixup_timings_txt.py b/fuzzers/007-timing/bel/fixup_timings_txt.py index b36cfe62..bfa28461 100644 --- a/fuzzers/007-timing/bel/fixup_timings_txt.py +++ b/fuzzers/007-timing/bel/fixup_timings_txt.py @@ -4,6 +4,27 @@ import argparse def fix_line(line, site, filetype): + """ + Squashes the entries for multilpe sites into one. + This is required when entries are defined for a different + site than they are reported. + Such situation happend e.g. + for BRAM_[LR]. All the entries are defined for RAMBFIFO36E1, + while they are reported for RAMB18E1 or FIFO18E1 + + Args: + line: raw dump file line + site: site to which all the entries will be squashed + filetype: entries type. One of [timings, pins, properties] + + Returns: + newline: line with squashed entries + """ + + assert filetype in [ + "timings", "pins", "properties" + ], "Unsupported filetype" + line = line.split() newline = list() sites_count = int(line[1])