From a51e269950de48277504baaf945aa8491f1efdae Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Sun, 9 Jan 2022 16:17:53 +0000 Subject: [PATCH] sv_binutils: calculate reserved bits --- src/openpower/sv/sv_binutils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/openpower/sv/sv_binutils.py b/src/openpower/sv/sv_binutils.py index 185d33dc..bd3faa2d 100644 --- a/src/openpower/sv/sv_binutils.py +++ b/src/openpower/sv/sv_binutils.py @@ -189,13 +189,18 @@ class Entry: @classmethod def c_decl(cls): + bits_all = 0 yield f"struct svp64_entry {{" for field in _dataclasses.fields(cls): if issubclass(field.type, Enum): bits = len(field.type).bit_length() yield from indent([f"uint64_t {field.name} : {bits};"]) + bits_all += bits else: yield from indent(field.type.c_var(name=field.name)) + bits_rsvd = (64 - (bits_all % 64)) + if bits_rsvd: + yield from indent([f"uint64_t : {bits_rsvd};"]) yield f"}};" def c_value(self, prefix="", suffix=""): -- 2.30.2