From: Andrey Miroshnikov Date: Mon, 10 Apr 2023 12:46:07 +0000 (+0000) Subject: ls012_optable.py: Added a header col replacement func. Not used yet X-Git-Tag: opf_rfc_ls012_v1~30 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8b670c6696e9eb0b2fae2a2e3ae643d6dda48956;p=libreriscv.git ls012_optable.py: Added a header col replacement func. Not used yet --- diff --git a/openpower/sv/rfc/ls012_optable.py b/openpower/sv/rfc/ls012_optable.py index f7ac4defd..4aeb831e0 100644 --- a/openpower/sv/rfc/ls012_optable.py +++ b/openpower/sv/rfc/ls012_optable.py @@ -77,6 +77,18 @@ def by_cost_then_priority_then_page(areas): costs[cost].append(row) return costs +# For prettier printing, replace short column heading +# names with full, consistent names. +# Expected input is a list of column strings +def column_header_replacement(header): + replacement_col = {'cost': 'XO Cost'} + new_header = header + for shortname in replacement_col.keys(): + # check if header contains any shortnames + if shortname in header: + index = header.index(shortname) + new_header[index] = replacement_col[shortname] + return new_header def print_table(title, header, areas, sortby): fname = title.lower().replace(" ", "_")