6.1. The Execution Environment
The architecture of a microprocessor consists of several modules that allow the execution of the instructions in its machine language. These circuits are too complex to be studied in detail. To give an idea about this complexity, the generic microprocessors used in personal computers in the year in 1974 had around 6000 transistors, and in 2004 they contained approximately 50 million transistors. These microprocessors are now designed over periods of several years and by large teams of designers. The following figure shows an image of an 8 bit microcontroller manufactured by Atmel Corporation similar to the one used in the Arduino platform.
By ZeptoBars CC-BY-3.0, via Wikimedia Commons
The chip of the previous figure has a size of 2855 x 2795µm, (one meter has 1,000,000 µm). That mean, in a square meter you can fit almost 125,000 of these circuits. The complexity of designing one of these circuits can be managed with the help of sophisticated technology that supports the whole cycle, from initial design to the required ultra-high level of component integration. The final product is a chip ready to be used in a circuit board as shown in the following figure.
The term architecture is used to denote a generic description of a set of microcontrollers that are capable of executing the same machine instructions but that may differ in some characteristics such as the size of the memory, speed, etc. The AVR architecture refers to a family of microcontrollers that process most of their data in sizes of 8 bits, and it has a reduced set of instructions with fixed format.
In this document we will describe the basic elements of what is known as the AVR architecture. An in-depth study of this architecture is required to design advanced applications that make use of this chip. In that case, the most important source of information is the known as the datasheet containing the description of all the aspects of the chip. You may check the Atmel 8-bit Microcontroller datasheet to see the type of information included in these documents. Section 7 of that document contains a block diagram of the CPU, the description of the register file, the stack, and how are the instructions executed.
In this section we will present a summary of this architecture to understand how the most common instructions are executed.
The execution environment of an AVR microcontroller refers to the elements used to execute instructions: type of data managed, data and status registers, available memory, etc. The units of information manipulated by a circuit are usually denoted by the following terms:
Name | Bits | Bytes |
---|---|---|
Byte | 8 bits | 1 byte |
Word | 16 bits | 2 bytes |
Doubleword | 32 bits | 4 bytes |
Quadword | 64 bits | 8 bytes |
Double Quadword | 128 bits | 16 bytes |
The following figure shows the relative sizes of these units of information and the nomenclature used to refer to their bytes. Bits are numbered starting at zero.
Information Sizes and Names
6.1.1. The Data-path
The main blocks of the AVR architecture are illustrated in the following figure.
Block Diagram of the AVR Architecture
You may download the Block Diagram of the AVR Architecture
.The blocks are all interconnected through an 8-bit data bus through which data can be exchanged between all the modules. The modules shown below the bus are in charge of executing the machine language, whereas those above the bus execute other tasks such as input/output, interruptions, timer events, etc.
6.1.2. Program and Data Memories
The AVR architecture contains two types of memory to store programs and data. Programs are stored in the Program Memory and the data that these programs manipulate is stored in