From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Michael Rolnik <mrolnik@gmail.com>, qemu-devel@nongnu.org
Cc: thuth@redhat.com, Joaquin de Andres <me@xcancerberox.com.ar>,
richard.henderson@linaro.org, dovgaluk@ispras.ru,
imammedo@redhat.com, aleksandar.m.mail@gmail.com
Subject: Re: [PATCH v35 03/13] target/avr: Add instruction decoding
Date: Fri, 22 Nov 2019 12:46:23 +0100 [thread overview]
Message-ID: <2f750d23-2413-5596-0b6d-b91bc1adc521@redhat.com> (raw)
In-Reply-To: <20191029212430.20617-4-mrolnik@gmail.com>
On 10/29/19 10:24 PM, Michael Rolnik wrote:
> This includes:
> - encoding of all 16 bit instructions
> - encoding of all 32 bit instructions
>
> Signed-off-by: Michael Rolnik <mrolnik@gmail.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> target/avr/insn.decode | 175 +++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 175 insertions(+)
> create mode 100644 target/avr/insn.decode
>
> diff --git a/target/avr/insn.decode b/target/avr/insn.decode
> new file mode 100644
> index 0000000000..6b387762c6
> --- /dev/null
> +++ b/target/avr/insn.decode
> @@ -0,0 +1,175 @@
> +#
> +# A = [16 .. 31]
> +# B = [16 .. 23]
> +# C = [24, 26, 28, 30]
> +# D = [0, 2, 4, 6, 8, .. 30]
> +
> +%rd 4:5
> +%rr 9:1 0:4
> +
> +&rd_rr rd rr
> +&rd_imm rd imm
> +
> +@op_rd_rr .... .. . ..... .... &rd_rr rd=%rd rr=%rr
> +ADD 0000 11 . ..... .... @op_rd_rr
> +ADC 0001 11 . ..... .... @op_rd_rr
> +AND 0010 00 . ..... .... @op_rd_rr
> +CP 0001 01 . ..... .... @op_rd_rr
> +CPC 0000 01 . ..... .... @op_rd_rr
> +CPSE 0001 00 . ..... .... @op_rd_rr
> +EOR 0010 01 . ..... .... @op_rd_rr
> +MOV 0010 11 . ..... .... @op_rd_rr
> +MUL 1001 11 . ..... .... @op_rd_rr
> +OR 0010 10 . ..... .... @op_rd_rr
> +SBC 0000 10 . ..... .... @op_rd_rr
> +SUB 0001 10 . ..... .... @op_rd_rr
> +
> +
> +%rd_c 4:2 !function=to_C
> +%imm6 6:2 0:4
> +
> +@op_rd_imm6 .... .... .. .. .... &rd_imm rd=%rd_c imm=%imm6
> +ADIW 1001 0110 .. .. .... @op_rd_imm6
> +SBIW 1001 0111 .. .. .... @op_rd_imm6
> +
> +
> +%rd_a 4:4 !function=to_A
> +%rr_a 0:4 !function=to_A
> +%rd_d 4:4 !function=to_D
> +%rr_d 0:4 !function=to_D
> +%imm8 8:4 0:4
> +
> +@op_rd_imm8 .... .... .... .... &rd_imm rd=%rd_a imm=%imm8
> +ANDI 0111 .... .... .... @op_rd_imm8
> +CPI 0011 .... .... .... @op_rd_imm8
> +LDI 1110 .... .... .... @op_rd_imm8
> +ORI 0110 .... .... .... @op_rd_imm8
> +SBCI 0100 .... .... .... @op_rd_imm8
> +SUBI 0101 .... .... .... @op_rd_imm8
> +
> +
> +@op_rd .... ... rd:5 ....
> +ASR 1001 010 ..... 0101 @op_rd
> +COM 1001 010 ..... 0000 @op_rd
> +DEC 1001 010 ..... 1010 @op_rd
> +ELPM2 1001 000 ..... 0110 @op_rd
> +ELPMX 1001 000 ..... 0111 @op_rd
> +INC 1001 010 ..... 0011 @op_rd
> +LDX1 1001 000 ..... 1100 @op_rd
> +LDX2 1001 000 ..... 1101 @op_rd
> +LDX3 1001 000 ..... 1110 @op_rd
> +LDY2 1001 000 ..... 1001 @op_rd
> +LDY3 1001 000 ..... 1010 @op_rd
> +LDZ2 1001 000 ..... 0001 @op_rd
> +LDZ3 1001 000 ..... 0010 @op_rd
> +LPM2 1001 000 ..... 0100 @op_rd
> +LPMX 1001 000 ..... 0101 @op_rd
> +LSR 1001 010 ..... 0110 @op_rd
> +NEG 1001 010 ..... 0001 @op_rd
> +POP 1001 000 ..... 1111 @op_rd
> +PUSH 1001 001 ..... 1111 @op_rd
> +ROR 1001 010 ..... 0111 @op_rd
> +STY2 1001 001 ..... 1001 @op_rd
> +STY3 1001 001 ..... 1010 @op_rd
> +STZ2 1001 001 ..... 0001 @op_rd
> +STZ3 1001 001 ..... 0010 @op_rd
> +SWAP 1001 010 ..... 0010 @op_rd
> +
> +
> +@op_bit .... .... . bit:3 ....
> +BCLR 1001 0100 1 ... 1000 @op_bit
> +BSET 1001 0100 0 ... 1000 @op_bit
> +
> +
> +@op_rd_bit .... ... rd:5 . bit:3
> +BLD 1111 100 ..... 0 ... @op_rd_bit
> +BST 1111 101 ..... 0 ... @op_rd_bit
> +
> +
> +@op_bit_imm .... .. imm:s7 bit:3
> +BRBC 1111 01 ....... ... @op_bit_imm
> +BRBS 1111 00 ....... ... @op_bit_imm
> +
> +
> +BREAK 1001 0101 1001 1000
> +EICALL 1001 0101 0001 1001
> +EIJMP 1001 0100 0001 1001
> +ELPM1 1001 0101 1101 1000
> +ICALL 1001 0101 0000 1001
> +IJMP 1001 0100 0000 1001
> +LPM1 1001 0101 1100 1000
> +NOP 0000 0000 0000 0000
> +RET 1001 0101 0000 1000
> +RETI 1001 0101 0001 1000
> +SLEEP 1001 0101 1000 1000
> +SPM 1001 0101 1110 1000
> +SPMX 1001 0101 1111 1000
> +WDR 1001 0101 1010 1000
> +
> +
> +@op_reg_bit .... .... reg:5 bit:3
> +CBI 1001 1000 ..... ... @op_reg_bit
> +SBI 1001 1010 ..... ... @op_reg_bit
> +SBIC 1001 1001 ..... ... @op_reg_bit
> +SBIS 1001 1011 ..... ... @op_reg_bit
> +
> +
> +DES 1001 0100 imm:4 1011
> +
> +
> +%rd_b 4:3 !function=to_B
> +%rr_b 0:3 !function=to_B
> +@fmul .... .... . ... . ... &rd_rr rd=%rd_b rr=%rr_b
> +FMUL 0000 0011 0 ... 1 ... @fmul
> +FMULS 0000 0011 1 ... 0 ... @fmul
> +FMULSU 0000 0011 1 ... 1 ... @fmul
> +MULSU 0000 0011 0 ... 0 ... @fmul
> +
> +
> +%io_imm 9:2 0:4
> +@io_rd_imm .... . .. ..... .... &rd_imm rd=%rd imm=%io_imm
> +IN 1011 0 .. ..... .... @io_rd_imm
> +OUT 1011 1 .. ..... .... @io_rd_imm
> +
> +
> +XCH 1001 001 rd:5 0100
> +LAC 1001 001 rd:5 0110
> +LAS 1001 001 rd:5 0101
> +LAT 1001 001 rd:5 0111
> +STX1 1001 001 rr:5 1100
> +STX2 1001 001 rr:5 1101
> +STX3 1001 001 rr:5 1110
> +
> +
> +%ldst_d_imm 13:1 10:2 0:3
> +@ldst_d .. . . .. . rd:5 . ... &rd_imm imm=%ldst_d_imm
> +LDDY 10 . 0 .. 0 ..... 1 ... @ldst_d
> +LDDZ 10 . 0 .. 0 ..... 0 ... @ldst_d
> +STDY 10 . 0 .. 1 ..... 1 ... @ldst_d
> +STDZ 10 . 0 .. 1 ..... 0 ... @ldst_d
> +
> +
> +MOVW 0000 0001 .... .... &rd_rr rd=%rd_d rr=%rr_d
> +MULS 0000 0010 .... .... &rd_rr rd=%rd_a rr=%rr_a
> +
> +RCALL 1101 imm:s12
> +RJMP 1100 imm:s12
> +
> +SBRC 1111 110 rr:5 0 bit:3
> +SBRS 1111 111 rr:5 0 bit:3
> +
> +# The 22-bit immediate is partially in the opcode word,
> +# and partially in the next. Use append_16 to build the
> +# complete 22-bit value.
> +%imm_call 4:5 0:1 !function=append_16
> +CALL 1001 010 ..... 111 . imm=%imm_call
> +JMP 1001 010 ..... 110 . imm=%imm_call
> +
> +
> +# The 16-bit immediate is completely in the next word.
> +# Fields cannot be defined with no bits, so we cannot play
> +# the same trick and append to a zero-bit value.
> +# Defer reading the immediate until trans_{LDS,STS}.
> +@ldst_s .... ... rd:5 .... imm=0
> +LDS 1001 000 ..... 0000 @ldst_s
> +STS 1001 001 ..... 0000 @ldst_s
>
next prev parent reply other threads:[~2019-11-22 11:49 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-29 21:24 [PATCH v35 00/13] QEMU AVR 8 bit cores Michael Rolnik
2019-10-29 21:24 ` [PATCH v35 01/13] target/avr: Add outward facing interfaces and core CPU logic Michael Rolnik
2019-11-21 18:55 ` Philippe Mathieu-Daudé
2019-11-21 19:44 ` Michael Rolnik
2019-11-21 19:53 ` Michael Rolnik
2019-11-22 7:46 ` Richard Henderson
2019-11-22 8:43 ` Aleksandar Markovic
2019-11-22 10:46 ` Philippe Mathieu-Daudé
2019-11-22 10:54 ` Michael Rolnik
2019-11-22 11:12 ` Philippe Mathieu-Daudé
2019-11-21 20:55 ` Aleksandar Markovic
2019-11-22 5:33 ` Pavel Dovgalyuk
2019-11-22 7:47 ` Richard Henderson
2019-11-22 10:40 ` Philippe Mathieu-Daudé
2019-11-22 11:04 ` Aleksandar Markovic
2019-11-22 16:58 ` Aleksandar Markovic
2019-11-22 17:11 ` Aleksandar Markovic
2019-11-23 22:42 ` Michael Rolnik
2019-11-30 16:22 ` Aleksandar Markovic
2019-11-30 17:03 ` Michael Rolnik
2019-12-01 0:50 ` Aleksandar Markovic
2019-11-22 17:28 ` Aleksandar Markovic
2019-11-23 15:58 ` Michael Rolnik
2019-10-29 21:24 ` [PATCH v35 02/13] target/avr: Add instruction helpers Michael Rolnik
2019-11-22 11:46 ` Philippe Mathieu-Daudé
2019-10-29 21:24 ` [PATCH v35 03/13] target/avr: Add instruction decoding Michael Rolnik
2019-11-22 11:46 ` Philippe Mathieu-Daudé [this message]
2019-10-29 21:24 ` [PATCH v35 04/13] target/avr: Add instruction translation - Registers definition Michael Rolnik
2019-10-29 21:24 ` [PATCH v35 05/13] target/avr: Add instruction translation - Arithmetic and Logic Instructions Michael Rolnik
2019-11-05 8:39 ` Aleksandar Markovic
2019-11-05 9:46 ` Aleksandar Markovic
2019-11-05 13:23 ` Richard Henderson
2019-11-05 14:37 ` Aleksandar Markovic
2019-11-19 20:09 ` Michael Rolnik
2019-11-19 21:18 ` Aleksandar Markovic
2019-11-19 21:19 ` Michael Rolnik
2019-10-29 21:24 ` [PATCH v35 06/13] target/avr: Add instruction translation - Branch Instructions Michael Rolnik
2019-10-29 21:24 ` [PATCH v35 07/13] target/avr: Add instruction translation - Bit and Bit-test Instructions Michael Rolnik
2019-10-29 21:24 ` [PATCH v35 08/13] target/avr: Add instruction translation - MCU Control Instructions Michael Rolnik
2019-10-29 21:24 ` [PATCH v35 09/13] target/avr: Add instruction translation - CPU main translation function Michael Rolnik
2019-11-22 11:48 ` Philippe Mathieu-Daudé
2019-10-29 21:24 ` [PATCH v35 10/13] target/avr: Add limited support for USART and 16 bit timer peripherals Michael Rolnik
2019-11-22 12:02 ` Philippe Mathieu-Daudé
2019-11-22 14:41 ` Aleksandar Markovic
2019-11-22 15:41 ` Philippe Mathieu-Daudé
2019-11-25 15:07 ` Sarah Harris
2019-11-25 18:22 ` Aleksandar Markovic
2019-11-22 15:10 ` Aleksandar Markovic
2019-11-25 15:57 ` Sarah Harris
2019-11-25 18:57 ` Aleksandar Markovic
2019-11-28 9:31 ` Sarah Harris
2019-11-28 10:55 ` Aleksandar Markovic
2019-11-28 11:02 ` Aleksandar Markovic
2019-11-29 9:23 ` Sarah Harris
2019-11-22 16:48 ` Aleksandar Markovic
2019-11-23 15:37 ` Michael Rolnik
2019-11-25 15:56 ` Sarah Harris
2019-11-25 18:34 ` Aleksandar Markovic
2019-12-05 18:45 ` Aleksandar Markovic
2019-12-05 19:46 ` Michael Rolnik
2019-10-29 21:24 ` [PATCH v35 11/13] target/avr: Add example board configuration Michael Rolnik
2019-10-29 21:24 ` [PATCH v35 12/13] target/avr: Register AVR support with the rest of QEMU, the build system, and the WMAINTAINERS file Michael Rolnik
2019-11-22 12:04 ` Philippe Mathieu-Daudé
2019-11-22 13:55 ` Eric Blake
2019-11-24 1:14 ` Aleksandar Markovic
2019-10-29 21:24 ` [PATCH v35 13/13] target/avr: Add tests Michael Rolnik
2019-11-24 0:37 ` Aleksandar Markovic
2019-10-29 21:43 ` [PATCH v35 00/13] QEMU AVR 8 bit cores Aleksandar Markovic
2019-10-29 21:58 ` Michael Rolnik
2019-11-18 17:13 ` Philippe Mathieu-Daudé
2019-11-22 17:40 ` Aleksandar Markovic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2f750d23-2413-5596-0b6d-b91bc1adc521@redhat.com \
--to=philmd@redhat.com \
--cc=aleksandar.m.mail@gmail.com \
--cc=dovgaluk@ispras.ru \
--cc=imammedo@redhat.com \
--cc=me@xcancerberox.com.ar \
--cc=mrolnik@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).