isaspec: Add bool_inv type to print inverted bools
Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com> Reviewed-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20144>
This commit is contained in:
parent
586c34b19c
commit
a8a33ac5ae
3 changed files with 12 additions and 1 deletions
|
|
@ -561,7 +561,7 @@ class ISA(object):
|
||||||
|
|
||||||
# Validate that all bitset fields have valid types, and in
|
# Validate that all bitset fields have valid types, and in
|
||||||
# the case of bitset type, the sizes match:
|
# the case of bitset type, the sizes match:
|
||||||
builtin_types = ['branch', 'absbranch', 'int', 'uint', 'hex', 'offset', 'uoffset', 'float', 'bool', 'enum', 'custom']
|
builtin_types = ['branch', 'absbranch', 'int', 'uint', 'hex', 'offset', 'uoffset', 'float', 'bool', 'bool_inv', 'enum', 'custom']
|
||||||
for bitset_name, bitset in self.bitsets.items():
|
for bitset_name, bitset in self.bitsets.items():
|
||||||
if bitset.extends is not None:
|
if bitset.extends is not None:
|
||||||
assert bitset.extends in self.bitsets, "{} extends invalid type: {}".format(
|
assert bitset.extends in self.bitsets, "{} extends invalid type: {}".format(
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@ struct isa_field {
|
||||||
TYPE_UOFFSET, /* Like UINT but formated with + or omitted if ==0 */
|
TYPE_UOFFSET, /* Like UINT but formated with + or omitted if ==0 */
|
||||||
TYPE_FLOAT,
|
TYPE_FLOAT,
|
||||||
TYPE_BOOL,
|
TYPE_BOOL,
|
||||||
|
TYPE_BOOL_INV, /* Like BOOL but inverted */
|
||||||
TYPE_ENUM,
|
TYPE_ENUM,
|
||||||
|
|
||||||
/* For fields that must be printed via a user-provided callback */
|
/* For fields that must be printed via a user-provided callback */
|
||||||
|
|
|
||||||
|
|
@ -686,6 +686,16 @@ display_field(struct decode_scope *scope, const char *field_name)
|
||||||
isa_print(print, "%u", (unsigned)val);
|
isa_print(print, "%u", (unsigned)val);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case TYPE_BOOL_INV: {
|
||||||
|
if (field->display) {
|
||||||
|
if (!val) {
|
||||||
|
isa_print(print, "%s", field->display);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
isa_print(print, "%u", (unsigned)!val);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case TYPE_ENUM:
|
case TYPE_ENUM:
|
||||||
display_enum_field(scope, field, v);
|
display_enum_field(scope, field, v);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue