All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Michael Rolnik <mrolnik@gmail.com>,
	Joaquin de Andres <me@xcancerberox.com.ar>,
	Richard Henderson <richard.henderson@linaro.org>
Cc: "Laurent Vivier" <lvivier@redhat.com>,
	"Fam Zheng" <fam@euphon.net>,
	"Sarah Harris" <S.E.Harris@kent.ac.uk>,
	qemu-riscv@nongnu.org, "Eduardo Habkost" <ehabkost@redhat.com>,
	"Sagar Karandikar" <sagark@eecs.berkeley.edu>,
	"Bastian Koppelmann" <kbastian@mail.uni-paderborn.de>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Pavel Dovgalyuk" <dovgaluk@ispras.ru>,
	"Aleksandar Markovic" <aleksandar.m.mail@gmail.com>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Alistair Francis" <Alistair.Francis@wdc.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Markus Armbruster" <armbru@redhat.com>
Subject: Re: [PATCH rc2 01/25] target/avr: Add outward facing interfaces and core CPU logic
Date: Fri, 31 Jan 2020 02:22:00 +0100	[thread overview]
Message-ID: <a871537b-f7cd-66f0-8433-8cce8d721ba4@redhat.com> (raw)
In-Reply-To: <CAK4993jHOZWcujAwD+mpir8UCAnbswaNjtRC2HxXCL0gSWMhBg@mail.gmail.com>

Hi Richard,

On 1/27/20 2:38 PM, Michael Rolnik wrote:
> Hi Joaquin.
> 
> I looks like that the CPU families are not well defined. There are some 
> small variations within the families themselves i.e. some MCUs do not 
> support all the features of their families.
> To get the features I looked at this file in gcc 
> https://github.com/gcc-mirror/gcc/blob/master/gcc/config/avr/avr-devices.c
> Have a look here 
> https://github.com/gcc-mirror/gcc/blob/master/gcc/config/avr/avr-mcus.def. 
> you can see that not all xmega support RMW instructions. so whenever 
> QEMU has atxmega128d4 implemented, atxmega128d4 modelit will have to 
> remove RMW feature.

What source should we trust here? The various datasheets or GCC?
GCC is eventually tested more thoroughly...

> Regards,
> Michael Rolnik
> 
> On Mon, Jan 27, 2020 at 3:27 PM Joaquin de Andres 
> <me@xcancerberox.com.ar <mailto:me@xcancerberox.com.ar>> wrote:
> 
>     On 1/24/20 1:51 AM, Philippe Mathieu-Daudé wrote:
>      > From: Michael Rolnik <mrolnik@gmail.com <mailto:mrolnik@gmail.com>>
>      >
>      > This includes:
>      > - CPU data structures
>      > - object model classes and functions
>      > - migration functions
>      > - GDB hooks
>      >
>      > Co-developed-by: Michael Rolnik <mrolnik@gmail.com
>     <mailto:mrolnik@gmail.com>>
>      > Co-developed-by: Sarah Harris <S.E.Harris@kent.ac.uk
>     <mailto:S.E.Harris@kent.ac.uk>>
>      > Signed-off-by: Michael Rolnik <mrolnik@gmail.com
>     <mailto:mrolnik@gmail.com>>
>      > Signed-off-by: Sarah Harris <S.E.Harris@kent.ac.uk
>     <mailto:S.E.Harris@kent.ac.uk>>
>      > Signed-off-by: Michael Rolnik <mrolnik@gmail.com
>     <mailto:mrolnik@gmail.com>>
>      > Acked-by: Igor Mammedov <imammedo@redhat.com
>     <mailto:imammedo@redhat.com>>
>      > Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com
>     <mailto:philmd@redhat.com>>
>      > Message-Id: <20200118191416.19934-2-mrolnik@gmail.com
>     <mailto:20200118191416.19934-2-mrolnik@gmail.com>>
>      > Signed-off-by: Richard Henderson <richard.henderson@linaro.org
>     <mailto:richard.henderson@linaro.org>>
>      > ---
>      > ...
>      > diff --git a/target/avr/cpu.c b/target/avr/cpu.c
>      > new file mode 100644
>      > index 0000000000..c74c5106fe
>      > --- /dev/null
>      > +++ b/target/avr/cpu.c
>      > @@ -0,0 +1,826 @@
>      > ...
>      > +/*
>      > + * Setting features of AVR core type avr1
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * at90s1200, attiny11, attiny12, attiny15, attiny28
>      > + */
>      > +static void avr_avr1_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +> +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Hi! According to the datasheets the at90s1200 is an special case and the
>     LPM instruction is not present.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
> 
>     Ok. Checked with at90s1200 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type avr2
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * at90s2313, at90s2323, at90s2333, at90s2343, attiny22,
>     attiny26, at90s4414,
>      > + * at90s4433, at90s4434, at90s8515, at90c8534, at90s8535
>      > + */
>      > +static void avr_avr2_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with at90s2313 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with at90s2313 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with at90s2313 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with at90s2313 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
> 
>     Ok. Checked with at90s2313 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type avr25
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * ata5272, ata6616c, attiny13, attiny13a, attiny2313,
>     attiny2313a, attiny24,
>      > + * attiny24a, attiny4313, attiny44, attiny44a, attiny441,
>     attiny84, attiny84a,
>      > + * attiny25, attiny45, attiny85, attiny261, attiny261a,
>     attiny461, attiny461a,
>      > + * attiny861, attiny861a, attiny43u, attiny87, attiny48,
>     attiny88, attiny828,
>      > + * attiny841, at86rf401
>      > + */
>      > +static void avr_avr25_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with attiny13 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with attiny13 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with attiny13 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with attiny13 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
> 
>     Ok. Checked with attiny13 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);> +   
>     avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with attiny13 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type avr3
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * at43usb355, at76c711
>      > + */
>      > +static void avr_avr3_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with at43usb355 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);> +   
>     avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with at43usb355 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
> 
>     Ok. Checked with at43usb355 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
>      > +}
> 
>     I couldn't find the full instruction set for this microcontrollers, but
>     according with this [1] (not a certainty at all) wikipedia page, all the
>     instructions in the features are part of the instruction set (BREAK,
>     ICALL, IJMP, JMP, CALL, ADIW, SBIW).
> 
>      > +
>      > +/*
>      > + * Setting features of AVR core type avr31
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * atmega103, at43usb320
>      > + */
>      > +static void avr_avr31_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atmega103 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atmega103 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with atmega103 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with atmega103 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPZ);
> 
>     Ok. Checked with atmega103 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ELPM);
> 
>     Ok. Checked with atmega103 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with atmega103 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type avr35
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * ata5505, ata6617c, ata664251, at90usb82, at90usb162,
>     atmega8u2, atmega16u2,
>      > + * atmega32u2, attiny167, attiny1634
>      > + */
>      > +static void avr_avr35_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atmega8u2/16u2/32u2 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atmega8u2/16u2/32u2 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with atmega8u2/16u2/32u2 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with atmega8u2/16u2/32u2 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with atmega8u2/16u2/32u2 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
> 
>     Ok. Checked with atmega8u2/16u2/32u2 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with atmega8u2/16u2/32u2 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with atmega8u2/16u2/32u2 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type avr4
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * ata6285, ata6286, ata6289, ata6612c, atmega8, atmega8a,
>     atmega48, atmega48a,
>      > + * atmega48p, atmega48pa, atmega48pb, atmega88, atmega88a,
>     atmega88p,
>      > + * atmega88pa, atmega88pb, atmega8515, atmega8535, atmega8hva,
>     at90pwm1,
>      > + * at90pwm2, at90pwm2b, at90pwm3, at90pwm3b, at90pwm81
>      > + */
>      > +static void avr_avr4_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_MUL);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type avr5
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * ata5702m322, ata5782, ata5790, ata5790n, ata5791, ata5795,
>     ata5831, ata6613c,
>      > + * ata6614q, ata8210, ata8510, atmega16, atmega16a, atmega161,
>     atmega162,
>      > + * atmega163, atmega164a, atmega164p, atmega164pa, atmega165,
>     atmega165a,
>      > + * atmega165p, atmega165pa, atmega168, atmega168a, atmega168p,
>     atmega168pa,
>      > + * atmega168pb, atmega169, atmega169a, atmega169p, atmega169pa,
>     atmega16hvb,
>      > + * atmega16hvbrevb, atmega16m1, atmega16u4, atmega32a, atmega32,
>     atmega323,
>      > + * atmega324a, atmega324p, atmega324pa, atmega325, atmega325a,
>     atmega325p,
>      > + * atmega325pa, atmega3250, atmega3250a, atmega3250p,
>     atmega3250pa, atmega328,
>      > + * atmega328p, atmega328pb, atmega329, atmega329a, atmega329p,
>     atmega329pa,
>      > + * atmega3290, atmega3290a, atmega3290p, atmega3290pa,
>     atmega32c1, atmega32m1,
>      > + * atmega32u4, atmega32u6, atmega406, atmega64, atmega64a,
>     atmega640, atmega644,
>      > + * atmega644a, atmega644p, atmega644pa, atmega645, atmega645a,
>     atmega645p,
>      > + * atmega6450, atmega6450a, atmega6450p, atmega649, atmega649a,
>     atmega649p,
>      > + * atmega6490, atmega16hva, atmega16hva2, atmega32hvb,
>     atmega6490a, atmega6490p,
>      > + * atmega64c1, atmega64m1, atmega64hve, atmega64hve2, atmega64rfr2,
>      > + * atmega644rfr2, atmega32hvbrevb, at90can32, at90can64,
>     at90pwm161, at90pwm216,
>      > + * at90pwm316, at90scr100, at90usb646, at90usb647, at94k, m3000
>      > + */
>      > +static void avr_avr5_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atmega640 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);> +   
>     avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_MUL);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type avr51
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * atmega128, atmega128a, atmega1280, atmega1281, atmega1284,
>     atmega1284p,
>      > + * atmega128rfa1, atmega128rfr2, atmega1284rfr2, at90can128,
>     at90usb1286,
>      > + * at90usb1287
>      > + */
>      > +static void avr_avr51_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPZ);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ELPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_ELPM);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_MUL);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type avr6
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * atmega2560, atmega2561, atmega256rfr2, atmega2564rfr2
>      > + */
>      > +static void avr_avr6_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_3_BYTE_PC);
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPZ);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_EIJMP_EICALL);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ELPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_ELPM);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_MUL);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type avrtiny
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * attiny4, attiny5, attiny9, attiny10, attiny20, attiny40
>      > + */
>      > +static void avr_avrtiny_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     According with the attiny4/5/9/10 datasheet there is no LPM instruction.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with attiny4/5/9/10 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with attiny4/5/9/10 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
> 
>     Ok. Checked with attiny4/5/9/10 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_1_BYTE_SP);
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type xmega2
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * atxmega8e5, atxmega16a4, atxmega16d4, atxmega16e5,
>     atxmega32a4, atxmega32c3,
>      > + * atxmega32d3, atxmega32d4, atxmega16a4u, atxmega16c4,
>     atxmega32a4u,
>      > + * atxmega32c4, atxmega32e5
>      > + */
>      > +static void avr_xmega2_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atxmega8e5/16e5/32e5 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atxmega8e5/16e5/32e5 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with atxmega8e5/16e5/32e5 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with atxmega8e5/16e5/32e5 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with atxmega8e5/16e5/32e5 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_MUL);
> 
>     Ok. Checked with atxmega8e5/16e5/32e5 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_RMW);
> 
>     Ok. Checked with atxmega8e5/16e5/32e5 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type xmega3
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * attiny212, attiny214, attiny412, attiny414, attiny416,
>     attiny417, attiny814,
>      > + * attiny816, attiny817, attiny1614, attiny1616, attiny1617,
>     attiny3214,
>      > + * attiny3216, attiny3217, atmega808, atmega809, atmega1608,
>     atmega1609,
>      > + * atmega3208, atmega3209, atmega4808, atmega4809
>      > + */
>      > +static void avr_xmega3_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with attiny212 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with attiny212 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with attiny212 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with attiny212 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with attiny212 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
> 
>     Ok. Checked with attiny212 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with attiny212 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with attiny212 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_MUL);
> 
>     Ok. Checked with attiny212 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_RMW);
> 
>     Ok. Checked with attiny212 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type xmega4
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * atxmega64a3, atxmega64d3, atxmega64a3u, atxmega64a4u,
>     atxmega64b1,
>      > + * atxmega64b3, atxmega64c3, atxmega64d4
>      > + */
>      > +static void avr_xmega4_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atxmega64a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atxmega64a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with atxmega64a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with atxmega64a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with atxmega64a3 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_ELPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_ELPM);
> 
>     Ok. Checked with atxmega64a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with atxmega64a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with atxmega64a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_MUL);
> 
>     Ok. Checked with atxmega64a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_RMW);
> 
>     Ok. Checked with atxmega64a3 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type xmega5
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * atxmega64a1, atxmega64a1u
>      > + */
>      > +static void avr_xmega5_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atxmega64a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atxmega64a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with atxmega64a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with atxmega64a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with atxmega64a1 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPD);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPX);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPY);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPZ);
>      > +    avr_set_feature(env, AVR_FEATURE_ELPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_ELPM);
> 
>     Ok. Checked with atxmega64a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with atxmega64a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with atxmega64a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_MUL);
> 
>     Ok. Checked with atxmega64a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_RMW);
> 
>     Ok. Checked with atxmega64a1 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type xmega6
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * atxmega128a3, atxmega128d3, atxmega192a3, atxmega192d3,
>     atxmega256a3,
>      > + * atxmega256a3b, atxmega256a3bu, atxmega256d3, atxmega128a3u,
>     atxmega128b1,
>      > + * atxmega128b3, atxmega128c3, atxmega128d4, atxmega192a3u,
>     atxmega192c3,
>      > + * atxmega256a3u, atxmega256c3, atxmega384c3, atxmega384d3
>      > + */
>      > +static void avr_xmega6_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atxmega128a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atxmega128a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with atxmega128a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with atxmega128a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with atxmega128a3 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_3_BYTE_PC);
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPZ);
>      > +    avr_set_feature(env, AVR_FEATURE_EIJMP_EICALL);
> 
>     Ok. Checked with atxmega128a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ELPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_ELPM);
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with atxmega128a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with atxmega128a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_MUL);
> 
>     Ok. Checked with atxmega128a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_RMW);
> 
>     Ok. Checked with atxmega128a3 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type xmega7
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * atxmega128a1, atxmega128a1u, atxmega128a4u
>      > + */
>      > +static void avr_xmega7_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_3_BYTE_PC);
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPD);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPX);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPY);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPZ);
>      > +    avr_set_feature(env, AVR_FEATURE_EIJMP_EICALL);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ELPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_ELPM);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_MUL);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_RMW);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +}
>      > ...
> 
> 
>     I hope this cross check is useful. The features that I didn't comment on
>     is because I'm not sure.
> 
>     Really nice to have this in qemu :). Thanks!
> 
>     --joa
> 
>     [1] https://en.wikipedia.org/wiki/Atmel_AVR_instruction_set
> 
> 
> 
> -- 
> Best Regards,
> Michael Rolnik



WARNING: multiple messages have this Message-ID (diff)
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Michael Rolnik <mrolnik@gmail.com>,
	Joaquin de Andres <me@xcancerberox.com.ar>,
	Richard Henderson <richard.henderson@linaro.org>
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Laurent Vivier" <lvivier@redhat.com>,
	"Fam Zheng" <fam@euphon.net>,
	"Sarah Harris" <S.E.Harris@kent.ac.uk>,
	qemu-riscv@nongnu.org, "Eduardo Habkost" <ehabkost@redhat.com>,
	"Sagar Karandikar" <sagark@eecs.berkeley.edu>,
	"Pavel Dovgalyuk" <dovgaluk@ispras.ru>,
	"Bastian Koppelmann" <kbastian@mail.uni-paderborn.de>,
	"Thomas Huth" <thuth@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Alistair Francis" <Alistair.Francis@wdc.com>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Aleksandar Markovic" <aleksandar.m.mail@gmail.com>
Subject: Re: [PATCH rc2 01/25] target/avr: Add outward facing interfaces and core CPU logic
Date: Fri, 31 Jan 2020 02:22:00 +0100	[thread overview]
Message-ID: <a871537b-f7cd-66f0-8433-8cce8d721ba4@redhat.com> (raw)
In-Reply-To: <CAK4993jHOZWcujAwD+mpir8UCAnbswaNjtRC2HxXCL0gSWMhBg@mail.gmail.com>

Hi Richard,

On 1/27/20 2:38 PM, Michael Rolnik wrote:
> Hi Joaquin.
> 
> I looks like that the CPU families are not well defined. There are some 
> small variations within the families themselves i.e. some MCUs do not 
> support all the features of their families.
> To get the features I looked at this file in gcc 
> https://github.com/gcc-mirror/gcc/blob/master/gcc/config/avr/avr-devices.c
> Have a look here 
> https://github.com/gcc-mirror/gcc/blob/master/gcc/config/avr/avr-mcus.def. 
> you can see that not all xmega support RMW instructions. so whenever 
> QEMU has atxmega128d4 implemented, atxmega128d4 modelit will have to 
> remove RMW feature.

What source should we trust here? The various datasheets or GCC?
GCC is eventually tested more thoroughly...

> Regards,
> Michael Rolnik
> 
> On Mon, Jan 27, 2020 at 3:27 PM Joaquin de Andres 
> <me@xcancerberox.com.ar <mailto:me@xcancerberox.com.ar>> wrote:
> 
>     On 1/24/20 1:51 AM, Philippe Mathieu-Daudé wrote:
>      > From: Michael Rolnik <mrolnik@gmail.com <mailto:mrolnik@gmail.com>>
>      >
>      > This includes:
>      > - CPU data structures
>      > - object model classes and functions
>      > - migration functions
>      > - GDB hooks
>      >
>      > Co-developed-by: Michael Rolnik <mrolnik@gmail.com
>     <mailto:mrolnik@gmail.com>>
>      > Co-developed-by: Sarah Harris <S.E.Harris@kent.ac.uk
>     <mailto:S.E.Harris@kent.ac.uk>>
>      > Signed-off-by: Michael Rolnik <mrolnik@gmail.com
>     <mailto:mrolnik@gmail.com>>
>      > Signed-off-by: Sarah Harris <S.E.Harris@kent.ac.uk
>     <mailto:S.E.Harris@kent.ac.uk>>
>      > Signed-off-by: Michael Rolnik <mrolnik@gmail.com
>     <mailto:mrolnik@gmail.com>>
>      > Acked-by: Igor Mammedov <imammedo@redhat.com
>     <mailto:imammedo@redhat.com>>
>      > Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com
>     <mailto:philmd@redhat.com>>
>      > Message-Id: <20200118191416.19934-2-mrolnik@gmail.com
>     <mailto:20200118191416.19934-2-mrolnik@gmail.com>>
>      > Signed-off-by: Richard Henderson <richard.henderson@linaro.org
>     <mailto:richard.henderson@linaro.org>>
>      > ---
>      > ...
>      > diff --git a/target/avr/cpu.c b/target/avr/cpu.c
>      > new file mode 100644
>      > index 0000000000..c74c5106fe
>      > --- /dev/null
>      > +++ b/target/avr/cpu.c
>      > @@ -0,0 +1,826 @@
>      > ...
>      > +/*
>      > + * Setting features of AVR core type avr1
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * at90s1200, attiny11, attiny12, attiny15, attiny28
>      > + */
>      > +static void avr_avr1_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +> +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Hi! According to the datasheets the at90s1200 is an special case and the
>     LPM instruction is not present.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
> 
>     Ok. Checked with at90s1200 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type avr2
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * at90s2313, at90s2323, at90s2333, at90s2343, attiny22,
>     attiny26, at90s4414,
>      > + * at90s4433, at90s4434, at90s8515, at90c8534, at90s8535
>      > + */
>      > +static void avr_avr2_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with at90s2313 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with at90s2313 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with at90s2313 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with at90s2313 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
> 
>     Ok. Checked with at90s2313 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type avr25
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * ata5272, ata6616c, attiny13, attiny13a, attiny2313,
>     attiny2313a, attiny24,
>      > + * attiny24a, attiny4313, attiny44, attiny44a, attiny441,
>     attiny84, attiny84a,
>      > + * attiny25, attiny45, attiny85, attiny261, attiny261a,
>     attiny461, attiny461a,
>      > + * attiny861, attiny861a, attiny43u, attiny87, attiny48,
>     attiny88, attiny828,
>      > + * attiny841, at86rf401
>      > + */
>      > +static void avr_avr25_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with attiny13 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with attiny13 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with attiny13 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with attiny13 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
> 
>     Ok. Checked with attiny13 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);> +   
>     avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with attiny13 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type avr3
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * at43usb355, at76c711
>      > + */
>      > +static void avr_avr3_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with at43usb355 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);> +   
>     avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with at43usb355 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
> 
>     Ok. Checked with at43usb355 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
>      > +}
> 
>     I couldn't find the full instruction set for this microcontrollers, but
>     according with this [1] (not a certainty at all) wikipedia page, all the
>     instructions in the features are part of the instruction set (BREAK,
>     ICALL, IJMP, JMP, CALL, ADIW, SBIW).
> 
>      > +
>      > +/*
>      > + * Setting features of AVR core type avr31
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * atmega103, at43usb320
>      > + */
>      > +static void avr_avr31_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atmega103 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atmega103 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with atmega103 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with atmega103 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPZ);
> 
>     Ok. Checked with atmega103 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ELPM);
> 
>     Ok. Checked with atmega103 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with atmega103 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type avr35
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * ata5505, ata6617c, ata664251, at90usb82, at90usb162,
>     atmega8u2, atmega16u2,
>      > + * atmega32u2, attiny167, attiny1634
>      > + */
>      > +static void avr_avr35_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atmega8u2/16u2/32u2 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atmega8u2/16u2/32u2 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with atmega8u2/16u2/32u2 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with atmega8u2/16u2/32u2 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with atmega8u2/16u2/32u2 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
> 
>     Ok. Checked with atmega8u2/16u2/32u2 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with atmega8u2/16u2/32u2 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with atmega8u2/16u2/32u2 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type avr4
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * ata6285, ata6286, ata6289, ata6612c, atmega8, atmega8a,
>     atmega48, atmega48a,
>      > + * atmega48p, atmega48pa, atmega48pb, atmega88, atmega88a,
>     atmega88p,
>      > + * atmega88pa, atmega88pb, atmega8515, atmega8535, atmega8hva,
>     at90pwm1,
>      > + * at90pwm2, at90pwm2b, at90pwm3, at90pwm3b, at90pwm81
>      > + */
>      > +static void avr_avr4_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_MUL);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type avr5
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * ata5702m322, ata5782, ata5790, ata5790n, ata5791, ata5795,
>     ata5831, ata6613c,
>      > + * ata6614q, ata8210, ata8510, atmega16, atmega16a, atmega161,
>     atmega162,
>      > + * atmega163, atmega164a, atmega164p, atmega164pa, atmega165,
>     atmega165a,
>      > + * atmega165p, atmega165pa, atmega168, atmega168a, atmega168p,
>     atmega168pa,
>      > + * atmega168pb, atmega169, atmega169a, atmega169p, atmega169pa,
>     atmega16hvb,
>      > + * atmega16hvbrevb, atmega16m1, atmega16u4, atmega32a, atmega32,
>     atmega323,
>      > + * atmega324a, atmega324p, atmega324pa, atmega325, atmega325a,
>     atmega325p,
>      > + * atmega325pa, atmega3250, atmega3250a, atmega3250p,
>     atmega3250pa, atmega328,
>      > + * atmega328p, atmega328pb, atmega329, atmega329a, atmega329p,
>     atmega329pa,
>      > + * atmega3290, atmega3290a, atmega3290p, atmega3290pa,
>     atmega32c1, atmega32m1,
>      > + * atmega32u4, atmega32u6, atmega406, atmega64, atmega64a,
>     atmega640, atmega644,
>      > + * atmega644a, atmega644p, atmega644pa, atmega645, atmega645a,
>     atmega645p,
>      > + * atmega6450, atmega6450a, atmega6450p, atmega649, atmega649a,
>     atmega649p,
>      > + * atmega6490, atmega16hva, atmega16hva2, atmega32hvb,
>     atmega6490a, atmega6490p,
>      > + * atmega64c1, atmega64m1, atmega64hve, atmega64hve2, atmega64rfr2,
>      > + * atmega644rfr2, atmega32hvbrevb, at90can32, at90can64,
>     at90pwm161, at90pwm216,
>      > + * at90pwm316, at90scr100, at90usb646, at90usb647, at94k, m3000
>      > + */
>      > +static void avr_avr5_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atmega640 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);> +   
>     avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_MUL);
> 
>     Ok. Checked with atmega8 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type avr51
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * atmega128, atmega128a, atmega1280, atmega1281, atmega1284,
>     atmega1284p,
>      > + * atmega128rfa1, atmega128rfr2, atmega1284rfr2, at90can128,
>     at90usb1286,
>      > + * at90usb1287
>      > + */
>      > +static void avr_avr51_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPZ);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ELPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_ELPM);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_MUL);
> 
>     Ok. Checked with atmega128 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type avr6
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * atmega2560, atmega2561, atmega256rfr2, atmega2564rfr2
>      > + */
>      > +static void avr_avr6_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_3_BYTE_PC);
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPZ);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_EIJMP_EICALL);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ELPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_ELPM);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_MUL);
> 
>     Ok. Checked with atmega2560 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type avrtiny
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * attiny4, attiny5, attiny9, attiny10, attiny20, attiny40
>      > + */
>      > +static void avr_avrtiny_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     According with the attiny4/5/9/10 datasheet there is no LPM instruction.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with attiny4/5/9/10 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with attiny4/5/9/10 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
> 
>     Ok. Checked with attiny4/5/9/10 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_1_BYTE_SP);
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type xmega2
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * atxmega8e5, atxmega16a4, atxmega16d4, atxmega16e5,
>     atxmega32a4, atxmega32c3,
>      > + * atxmega32d3, atxmega32d4, atxmega16a4u, atxmega16c4,
>     atxmega32a4u,
>      > + * atxmega32c4, atxmega32e5
>      > + */
>      > +static void avr_xmega2_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atxmega8e5/16e5/32e5 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atxmega8e5/16e5/32e5 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with atxmega8e5/16e5/32e5 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with atxmega8e5/16e5/32e5 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with atxmega8e5/16e5/32e5 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_MUL);
> 
>     Ok. Checked with atxmega8e5/16e5/32e5 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_RMW);
> 
>     Ok. Checked with atxmega8e5/16e5/32e5 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type xmega3
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * attiny212, attiny214, attiny412, attiny414, attiny416,
>     attiny417, attiny814,
>      > + * attiny816, attiny817, attiny1614, attiny1616, attiny1617,
>     attiny3214,
>      > + * attiny3216, attiny3217, atmega808, atmega809, atmega1608,
>     atmega1609,
>      > + * atmega3208, atmega3209, atmega4808, atmega4809
>      > + */
>      > +static void avr_xmega3_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with attiny212 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with attiny212 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with attiny212 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with attiny212 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with attiny212 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
> 
>     Ok. Checked with attiny212 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with attiny212 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with attiny212 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_MUL);
> 
>     Ok. Checked with attiny212 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_RMW);
> 
>     Ok. Checked with attiny212 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type xmega4
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * atxmega64a3, atxmega64d3, atxmega64a3u, atxmega64a4u,
>     atxmega64b1,
>      > + * atxmega64b3, atxmega64c3, atxmega64d4
>      > + */
>      > +static void avr_xmega4_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atxmega64a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atxmega64a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with atxmega64a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with atxmega64a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with atxmega64a3 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_ELPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_ELPM);
> 
>     Ok. Checked with atxmega64a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with atxmega64a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with atxmega64a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_MUL);
> 
>     Ok. Checked with atxmega64a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_RMW);
> 
>     Ok. Checked with atxmega64a3 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type xmega5
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * atxmega64a1, atxmega64a1u
>      > + */
>      > +static void avr_xmega5_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atxmega64a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atxmega64a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with atxmega64a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with atxmega64a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with atxmega64a1 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_PC);
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPD);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPX);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPY);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPZ);
>      > +    avr_set_feature(env, AVR_FEATURE_ELPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_ELPM);
> 
>     Ok. Checked with atxmega64a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with atxmega64a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with atxmega64a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_MUL);
> 
>     Ok. Checked with atxmega64a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_RMW);
> 
>     Ok. Checked with atxmega64a1 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type xmega6
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * atxmega128a3, atxmega128d3, atxmega192a3, atxmega192d3,
>     atxmega256a3,
>      > + * atxmega256a3b, atxmega256a3bu, atxmega256d3, atxmega128a3u,
>     atxmega128b1,
>      > + * atxmega128b3, atxmega128c3, atxmega128d4, atxmega192a3u,
>     atxmega192c3,
>      > + * atxmega256a3u, atxmega256c3, atxmega384c3, atxmega384d3
>      > + */
>      > +static void avr_xmega6_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atxmega128a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atxmega128a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with atxmega128a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with atxmega128a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with atxmega128a3 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_3_BYTE_PC);
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPZ);
>      > +    avr_set_feature(env, AVR_FEATURE_EIJMP_EICALL);
> 
>     Ok. Checked with atxmega128a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ELPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_ELPM);
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with atxmega128a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with atxmega128a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_MUL);
> 
>     Ok. Checked with atxmega128a3 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_RMW);
> 
>     Ok. Checked with atxmega128a3 datasheet.
> 
>      > +}
>      > +
>      > +/*
>      > + * Setting features of AVR core type xmega7
>      > + * --------------------------------------
>      > + *
>      > + * This type of AVR core is present in the following AVR MCUs:
>      > + *
>      > + * atxmega128a1, atxmega128a1u, atxmega128a4u
>      > + */
>      > +static void avr_xmega7_initfn(Object *obj)
>      > +{
>      > +    AVRCPU *cpu = AVR_CPU(obj);
>      > +    CPUAVRState *env = &cpu->env;
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_LPM);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_IJMP_ICALL);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ADIW_SBIW);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_SRAM);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_BREAK);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +
>      > +    avr_set_feature(env, AVR_FEATURE_3_BYTE_PC);
>      > +    avr_set_feature(env, AVR_FEATURE_2_BYTE_SP);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPD);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPX);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPY);
>      > +    avr_set_feature(env, AVR_FEATURE_RAMPZ);
>      > +    avr_set_feature(env, AVR_FEATURE_EIJMP_EICALL);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_ELPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_ELPM);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_JMP_CALL);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_LPMX);
>      > +    avr_set_feature(env, AVR_FEATURE_MOVW);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_MUL);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +    avr_set_feature(env, AVR_FEATURE_RMW);
> 
>     Ok. Checked with atxmega128a1 datasheet.
> 
>      > +}
>      > ...
> 
> 
>     I hope this cross check is useful. The features that I didn't comment on
>     is because I'm not sure.
> 
>     Really nice to have this in qemu :). Thanks!
> 
>     --joa
> 
>     [1] https://en.wikipedia.org/wiki/Atmel_AVR_instruction_set
> 
> 
> 
> -- 
> Best Regards,
> Michael Rolnik



  reply	other threads:[~2020-01-31  1:38 UTC|newest]

Thread overview: 116+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-24  0:51 [PATCH rc2 00/25] target/avr merger Philippe Mathieu-Daudé
2020-01-24  0:51 ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 01/25] target/avr: Add outward facing interfaces and core CPU logic Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-25 10:48   ` Aleksandar Markovic
2020-01-25 10:48     ` Aleksandar Markovic
2020-01-25 17:08     ` Thomas Huth
2020-01-25 17:08       ` Thomas Huth
2020-01-26 12:15   ` Joaquin de Andres
2020-01-26 12:15     ` Joaquin de Andres
2020-01-27  2:25     ` Aleksandar Markovic
2020-01-27  2:25       ` Aleksandar Markovic
2020-01-27  8:53     ` Michael Rolnik
2020-01-27  8:53       ` Michael Rolnik
2020-01-27  9:24       ` Joaquin de Andres
2020-01-27  9:24         ` Joaquin de Andres
2020-01-27  9:48         ` Michael Rolnik
2020-01-27  9:48           ` Michael Rolnik
2020-01-27 10:39           ` Joaquin de Andres
2020-01-27 10:39             ` Joaquin de Andres
2020-01-27 13:27   ` Joaquin de Andres
2020-01-27 13:27     ` Joaquin de Andres
2020-01-27 13:38     ` Michael Rolnik
2020-01-27 13:38       ` Michael Rolnik
2020-01-31  1:22       ` Philippe Mathieu-Daudé [this message]
2020-01-31  1:22         ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 02/25] target/avr: Add instruction helpers Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 03/25] target/avr: Add instruction translation - Registers definition Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 04/25] target/avr: Add instruction translation - Arithmetic and Logic Instructions Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 05/25] target/avr: Add instruction translation - Branch Instructions Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 06/25] target/avr: Add instruction translation - Data Transfer Instructions Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 07/25] target/avr: Add instruction translation - Bit and Bit-test Instructions Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 08/25] target/avr: Add instruction translation - MCU Control Instructions Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 09/25] target/avr: Add instruction translation - CPU main translation function Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 10/25] target/avr: Add instruction disassembly function Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 11/25] hw/char: Add limited support for Atmel USART peripheral Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 12/25] hw/timer: Add limited support for Atmel 16 bit timer peripheral Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  8:16   ` Thomas Huth
2020-01-24  8:16     ` Thomas Huth
2020-01-24 12:50     ` Philippe Mathieu-Daudé
2020-01-24 12:50       ` Philippe Mathieu-Daudé
2020-01-30 22:45     ` Aleksandar Markovic
2020-01-30 22:45       ` Aleksandar Markovic
2020-01-24 10:42   ` Alex Bennée
2020-01-24 10:42     ` Alex Bennée
2020-01-24 10:51     ` Philippe Mathieu-Daudé
2020-01-24 10:51       ` Philippe Mathieu-Daudé
2020-01-24 12:07       ` Sarah Harris
2020-01-24 12:07         ` Sarah Harris
2020-01-30 22:44         ` Aleksandar Markovic
2020-01-30 22:44           ` Aleksandar Markovic
2020-01-31 11:20           ` Philippe Mathieu-Daudé
2020-01-31 11:20             ` Philippe Mathieu-Daudé
2020-01-24 12:52     ` Philippe Mathieu-Daudé
2020-01-24 12:52       ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 13/25] hw/misc: Add Atmel power device Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 14/25] target/avr: Add section about AVR into QEMU documentation Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  7:14   ` Thomas Huth
2020-01-24  7:14     ` Thomas Huth
2020-01-24 11:50     ` Michael Rolnik
2020-01-24 11:50       ` Michael Rolnik
2020-01-24  0:51 ` [PATCH rc2 15/25] target/avr: Register AVR support with the rest of QEMU Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 16/25] target/avr: Add machine none test Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 17/25] target/avr: Update MAINTAINERS file Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 18/25] hw/core/loader: Let load_elf populate the processor-specific flags Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 19/25] hw/avr: Add helper to load raw/ELF firmware binaries Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 20/25] hw/avr: Add some ATmega microcontrollers Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-26 14:46   ` Aleksandar Markovic
2020-01-26 14:46     ` Aleksandar Markovic
2020-01-27  7:59     ` Philippe Mathieu-Daudé
2020-01-27  7:59       ` Philippe Mathieu-Daudé
2020-01-27  8:04       ` Aleksandar Markovic
2020-01-27  8:04         ` Aleksandar Markovic
2020-01-24  0:51 ` [PATCH rc2 21/25] hw/avr: Add some Arduino boards Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-25  9:32   ` Joaquin de Andres
2020-01-25  9:32     ` Joaquin de Andres
2020-01-24  0:51 ` [PATCH rc2 22/25] target/avr: Update build system Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24 10:59   ` Alex Bennée
2020-01-24 10:59     ` Alex Bennée
2020-01-24  0:51 ` [PATCH rc2 23/25] tests/boot-serial-test: Test some Arduino boards (AVR based) Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 24/25] tests/acceptance: Test the Arduino MEGA2560 board Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  0:51 ` [PATCH rc2 25/25] .travis.yml: Run the AVR acceptance tests Philippe Mathieu-Daudé
2020-01-24  0:51   ` Philippe Mathieu-Daudé
2020-01-24  1:02 ` [PATCH rc2 00/25] target/avr merger Philippe Mathieu-Daudé
2020-01-24  1:02   ` Philippe Mathieu-Daudé
2020-01-24  7:12 ` Thomas Huth
2020-01-24  7:12   ` Thomas Huth
2020-01-24 11:41 ` Michael Rolnik
2020-01-24 11:41   ` Michael Rolnik
2020-01-24 12:49   ` Philippe Mathieu-Daudé
2020-01-24 12:49     ` Philippe Mathieu-Daudé
2020-01-24 14:11     ` Michael Rolnik
2020-01-24 14:11       ` Michael Rolnik

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=a871537b-f7cd-66f0-8433-8cce8d721ba4@redhat.com \
    --to=philmd@redhat.com \
    --cc=Alistair.Francis@wdc.com \
    --cc=S.E.Harris@kent.ac.uk \
    --cc=aleksandar.m.mail@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=dovgaluk@ispras.ru \
    --cc=ehabkost@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=fam@euphon.net \
    --cc=imammedo@redhat.com \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=lvivier@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=me@xcancerberox.com.ar \
    --cc=mrolnik@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=sagark@eecs.berkeley.edu \
    --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 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.