* [PATCH 1/1] decodetree: Add support for 64-bit instructions
@ 2021-04-07 14:59 Luis Fernando Fujita Pires
2021-04-07 15:18 ` Richard Henderson
0 siblings, 1 reply; 2+ messages in thread
From: Luis Fernando Fujita Pires @ 2021-04-07 14:59 UTC (permalink / raw)
To: qemu-devel
Cc: richard.henderson, qemu-ppc, Matheus Kowalczuk Ferst,
Bruno Piazera Larsen
Allow '64' to be specified for the instruction width command line params
and use the appropriate insn/field data types, mask, extract and deposit
functions in that case.
This will be used to implement the new 64-bit Power ISA 3.1 instructions.
Signed-off-by: Luis Pires <luis.pires@eldorado.org.br>
---
docs/devel/decodetree.rst | 3 ---
scripts/decodetree.py | 25 ++++++++++++++++++++-----
2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/docs/devel/decodetree.rst b/docs/devel/decodetree.rst
index 74f66bf46e..505267234d 100644
--- a/docs/devel/decodetree.rst
+++ b/docs/devel/decodetree.rst
@@ -40,9 +40,6 @@ and returns an integral value extracted from there.
A field with no ``unnamed_fields`` and no ``!function`` is in error.
-FIXME: the fields of the structure into which this result will be stored
-is restricted to ``int``. Which means that we cannot expand 64-bit items.
-
Field examples:
+---------------------------+---------------------------------------------+
diff --git a/scripts/decodetree.py b/scripts/decodetree.py
index 4637b633e7..3450a2a08d 100644
--- a/scripts/decodetree.py
+++ b/scripts/decodetree.py
@@ -42,6 +42,10 @@
output_fd = None
insntype = 'uint32_t'
decode_function = 'decode'
+field_data_type = 'int'
+extract_function = 'extract32'
+sextract_function = 'sextract32'
+deposit_function = 'deposit32'
# An identifier for C.
re_C_ident = '[a-zA-Z][a-zA-Z0-9_]*'
@@ -185,9 +189,9 @@ def __str__(self):
def str_extract(self):
if self.sign:
- extr = 'sextract32'
+ extr = sextract_function
else:
- extr = 'extract32'
+ extr = extract_function
return '{0}(insn, {1}, {2})'.format(extr, self.pos, self.len)
def __eq__(self, other):
@@ -215,8 +219,8 @@ def str_extract(self):
if pos == 0:
ret = f.str_extract()
else:
- ret = 'deposit32({0}, {1}, {2}, {3})' \
- .format(ret, pos, 32 - pos, f.str_extract())
+ ret = '{4}({0}, {1}, {2}, {3})' \
+ .format(ret, pos, insnwidth - pos, f.str_extract(), deposit_function)
pos += f.len
return ret
@@ -311,7 +315,7 @@ def output_def(self):
if not self.extern:
output('typedef struct {\n')
for n in self.fields:
- output(' int ', n, ';\n')
+ output(' ', field_data_type, ' ', n, ';\n')
output('} ', self.struct_name(), ';\n\n')
# end Arguments
@@ -1264,6 +1268,10 @@ def main():
global insntype
global insnmask
global decode_function
+ global extract_function
+ global sextract_function
+ global deposit_function
+ global field_data_type
global variablewidth
global anyextern
@@ -1293,6 +1301,13 @@ def main():
if insnwidth == 16:
insntype = 'uint16_t'
insnmask = 0xffff
+ elif insnwidth == 64:
+ insntype = 'uint64_t'
+ insnmask = 0xffffffffffffffff
+ field_data_type = 'int64_t'
+ extract_function = 'extract64'
+ sextract_function = 'sextract64'
+ deposit_function = 'deposit64'
elif insnwidth != 32:
error(0, 'cannot handle insns of width', insnwidth)
else:
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] decodetree: Add support for 64-bit instructions
2021-04-07 14:59 [PATCH 1/1] decodetree: Add support for 64-bit instructions Luis Fernando Fujita Pires
@ 2021-04-07 15:18 ` Richard Henderson
0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2021-04-07 15:18 UTC (permalink / raw)
To: Luis Fernando Fujita Pires, qemu-devel
Cc: Matheus Kowalczuk Ferst, qemu-ppc, Bruno Piazera Larsen
On 4/7/21 7:59 AM, Luis Fernando Fujita Pires wrote:
> Allow '64' to be specified for the instruction width command line params
> and use the appropriate insn/field data types, mask, extract and deposit
> functions in that case.
>
> This will be used to implement the new 64-bit Power ISA 3.1 instructions.
>
> Signed-off-by: Luis Pires <luis.pires@eldorado.org.br>
> ---
> docs/devel/decodetree.rst | 3 ---
> scripts/decodetree.py | 25 ++++++++++++++++++++-----
> 2 files changed, 20 insertions(+), 8 deletions(-)
Looks good.
> --- a/docs/devel/decodetree.rst
> +++ b/docs/devel/decodetree.rst
> @@ -40,9 +40,6 @@ and returns an integral value extracted from there.
>
> A field with no ``unnamed_fields`` and no ``!function`` is in error.
>
> -FIXME: the fields of the structure into which this result will be stored
> -is restricted to ``int``. Which means that we cannot expand 64-bit items.
Let's replace this FIXME with a sentence or two documenting the type used.
r~
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-07 15:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 14:59 [PATCH 1/1] decodetree: Add support for 64-bit instructions Luis Fernando Fujita Pires
2021-04-07 15:18 ` Richard Henderson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.