diff --git a/src/etnaviv/isa/enums.h.py b/src/etnaviv/isa/enums.h.py index 55558f128f7..01d6baf9399 100644 --- a/src/etnaviv/isa/enums.h.py +++ b/src/etnaviv/isa/enums.h.py @@ -52,6 +52,19 @@ def main(): enums[name] = e + opc = {} + + for instr in isa.instructions(): + pattern = instr.xml.findall('pattern') + bit05 = int(pattern[0].text, 2) + bit6 = int(pattern[1].text, 2) + num = bit05 | (bit6 << 6) + + opc[prefix.upper() + '_OPC_' + instr.name.upper()] = num + + opc = dict(sorted(opc.items(), key=lambda item: int(item[1]))) + enums['opc'] = opc + print(Template(template).render(prefix=prefix, enums=enums)) if __name__ == '__main__':