AVR
Enhanced RISC Microcontrollers
Alf-Egil Bogen
Vegard Wollan
ATMEL Corporation
ATMEL Development Center, Trondheim, Norway
High level languages (HLLs) are rapidly
becoming the standard programming
methodology for embedded microcontrollers
(MCUs), even for smaller 8-bit devices. The C
language is probably the most widely used HLL
in MCUs, but will in most applications give an
increased code size compared to assembly
programming. ATMEL identified the need of an
architecture developed specially for the C
language in order to reduce this overhead to a
minimum. The result is the ATMEL AVR MCU,
that in addition to the optimized code size, is a
true single cycle RISC (Reduced Instruction
Set Computer) machine with 32 general
purpose registers (accumulators) running 4-12
times faster than currently used MCUs.
1. Introduction
The initial AVR product offering is three 8-bit
base-line devices with enhanced 16-bit
hardware support. Atmel’s low-power non-
volatile memory technology is used for
program code and data. The on-chip program
Flash and data EEPROM are in-system
programmable. The three first AVR MCUs
have 1K, 2K and 8K bytes program Flash
organized as 16-bit wide instruction words.
The Atmel AVR Enhanced RISC
Microcontrollers offer an architecture concept
for high performance and low-power
consumption simultaneously. A full range of
AVR MCUs - from base-line to top end -
feature a RISC architecture and instruction set
optimized for efficient code density with built-in
support for high-level languages.
Please refer to [1] for more details.
2. Enhanced RISC
Many existing RISC architectures require
larger code size to perform a given task with
the traditional CISC (Complex Instruction Set
Computer) architectures. RISC MCU’s are
often chosen where a high speed is needed.
The reduced instruction set will be fast, but
reduced in complexity.
The
AVR
is designed to be a RISC MCU with a
larger number of instructions to reduce the
code size and to increase the speed further.
Ciscy-like instructions are introduced without
letting the RISC performance and low power
consumption features suffer. This first major
enhancement was made after thorough
analysis of several architectures and large
amounts of application code. Still, the regular
AVR
RISC architecture enables cost effective
implementations.
The second enhancement is achieved by
tuning the architecture for optimizing code
generation for the C language. This was done
with a large application oriented benchmark
suite, where the code was pseudo-compiled for
the different enhancement alternatives in the
architecture. Special tuning of the different
addressing modes was important, “need to
have” instead of “nice to have”.
Many MCU architectures have only a small
number of general registers or working
registers (accumulators) - typically 1-8
registers. This is a major drawback for the C
compiler design, where a lot of data moving is
necessary. The
AVR
has 32 general-purpose
working registers, that the C compiler fully
utilizes to achieve the highest code density.