From: Dmitry Selyutin Date: Sun, 9 Jan 2022 16:17:53 +0000 (+0000) Subject: sv_binutils: calculate reserved bits X-Git-Tag: sv_maxu_works-initial~575 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a51e269950de48277504baaf945aa8491f1efdae;p=openpower-isa.git sv_binutils: calculate reserved bits --- 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=""):