Hexagon (target/hexagon) Use QEMU decodetree (16-bit instructions)

Section 10.3 of the Hexagon V73 Programmer's Reference Manual

A duplex is encoded as a 32-bit instruction with bits [15:14] set to 00.
The sub-instructions that comprise a duplex are encoded as 13-bit fields
in the duplex.

Create a decoder for each subinstruction class (a, l1, l2, s1, s2).

Extend gen_trans_funcs.py to handle all instructions rather than
filter by instruction class.

There is a g_assert_not_reached() in decode_insns() in decode.c to
verify we never try to use the old decoder on 16-bit instructions.

Signed-off-by: Taylor Simpson <ltaylorsimpson@gmail.com>
Reviewed-by: Brian Cain <bcain@quicinc.com>
Message-Id: <20240115221443.365287-3-ltaylorsimpson@gmail.com>
Signed-off-by: Brian Cain <bcain@quicinc.com>
This commit is contained in:
Taylor Simpson 2024-01-15 15:14:42 -07:00 committed by Brian Cain
parent 1547a2d339
commit f6c01009b5
5 changed files with 188 additions and 12 deletions

View file

@ -40,11 +40,6 @@ def ordered_unique(l):
return sorted(set(l), key=l.index)
def skip_tag(tag, classes):
enc_class = iset.iset[tag]["enc_class"]
return enc_class not in classes
def code_fmt(txt):
return textwrap.indent(textwrap.dedent(txt), " ")
@ -76,12 +71,9 @@ def mark_which_imm_extended(f, tag):
## return true;
## }
##
def gen_trans_funcs(f, classes):
def gen_trans_funcs(f):
f.write(f"/* DO NOT MODIFY - This file is generated by {sys.argv[0]} */\n\n")
for tag in sorted(encs.keys(), key=iset.tags.index):
if skip_tag(tag, classes):
continue
regs = ordered_unique(regre.findall(iset.iset[tag]["syntax"]))
imms = ordered_unique(immre.findall(iset.iset[tag]["syntax"]))
@ -129,4 +121,4 @@ def gen_trans_funcs(f, classes):
if __name__ == "__main__":
hex_common.read_semantics_file(sys.argv[1])
with open(sys.argv[2], "w") as f:
gen_trans_funcs(f, { "NORMAL", "EXT_mmvec" })
gen_trans_funcs(f)