From: Luke Kenneth Casson Leighton Date: Thu, 18 Aug 2022 20:48:58 +0000 (+0100) Subject: selectable_int: fix check on SI constructor X-Git-Tag: sv_maxu_works-initial~35 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=99565bb98a3e5e7b770efc529a5134699cab3c31;p=openpower-isa.git selectable_int: fix check on SI constructor Specifying the number of bits *is* allowed, it should mean "override the length". More unit tests need running to confirm. --- diff --git a/src/openpower/decoder/selectable_int.py b/src/openpower/decoder/selectable_int.py index 56ba07c3..22985014 100644 --- a/src/openpower/decoder/selectable_int.py +++ b/src/openpower/decoder/selectable_int.py @@ -221,7 +221,9 @@ class SelectableInt: def __init__(self, value, bits=None): if isinstance(value, SelectableInt): if bits is not None: - raise ValueError(value) + # check if the bitlength is different. TODO, allow override? + if bits != value.bits: + raise ValueError(value) bits = value.bits value = value.value elif isinstance(value, FieldSelectableInt):