2019-09-17 13:22:17 +02:00
|
|
|
|
|
|
|
|
template = """\
|
2022-05-25 10:41:28 +02:00
|
|
|
/*
|
2019-09-17 13:22:17 +02:00
|
|
|
* Copyright (c) 2018 Valve Corporation
|
|
|
|
|
*
|
2024-04-08 09:02:30 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2019-09-17 13:22:17 +02:00
|
|
|
*
|
2021-06-09 17:54:53 +02:00
|
|
|
* This file was generated by aco_opcodes_h.py
|
2019-09-17 13:22:17 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef _ACO_OPCODES_
|
|
|
|
|
#define _ACO_OPCODES_
|
|
|
|
|
|
2023-10-28 14:29:23 +02:00
|
|
|
#include <stdint.h>
|
2021-06-09 15:40:03 +02:00
|
|
|
|
2023-10-28 12:33:21 +02:00
|
|
|
namespace aco {
|
|
|
|
|
|
2023-10-28 12:53:00 +02:00
|
|
|
enum class Format : uint16_t {
|
|
|
|
|
% for e in Format:
|
|
|
|
|
${e.name} = ${hex(e.value)},
|
|
|
|
|
% endfor
|
|
|
|
|
};
|
|
|
|
|
|
2023-10-28 12:30:15 +02:00
|
|
|
enum class instr_class : uint8_t {
|
|
|
|
|
% for name in InstrClass:
|
|
|
|
|
${name.value},
|
|
|
|
|
% endfor
|
|
|
|
|
count,
|
|
|
|
|
};
|
|
|
|
|
|
2024-03-05 14:43:12 +00:00
|
|
|
<% opcode_names = sorted(instructions.keys()) %>
|
2019-09-17 13:22:17 +02:00
|
|
|
|
2023-10-28 14:29:23 +02:00
|
|
|
enum class aco_opcode : uint16_t {
|
2019-09-17 13:22:17 +02:00
|
|
|
% for name in opcode_names:
|
|
|
|
|
${name},
|
|
|
|
|
% endfor
|
|
|
|
|
last_opcode = ${opcode_names[-1]},
|
|
|
|
|
num_opcodes = last_opcode + 1
|
|
|
|
|
};
|
|
|
|
|
|
2023-10-28 12:33:21 +02:00
|
|
|
}
|
2019-09-17 13:22:17 +02:00
|
|
|
#endif /* _ACO_OPCODES_ */"""
|
|
|
|
|
|
2024-03-05 14:43:12 +00:00
|
|
|
from aco_opcodes import instructions, InstrClass, Format
|
2019-09-17 13:22:17 +02:00
|
|
|
from mako.template import Template
|
|
|
|
|
|
2024-03-05 14:43:12 +00:00
|
|
|
print(Template(template).render(instructions=instructions, InstrClass=InstrClass, Format=Format))
|