Electronic – AVR registers location

avrregister

There are four types of registers in AVR.

  1. \$r_0\$ – \$r_{15}\$ witch used for CPU's calculations.
  2. \$r_{16}\$ – \$r_{31}\$ witch used for user's temporary data storage.
  3. Registers for I/O statements.
  4. And control flags registers.

Are all of these Registers placed in SRAM?

P.N:I am learning AVR micro-controllers. In a learning video told that these registers are separated with SRAM. I thought that SRAM is a block that contains all registers. Because I think the nature of these registers are same. And can be packed in one register block.

Best Answer

No. The CPU registers and I/O registers are in their own set of locations independent of the on-board SRAM. They can be accessed via normal memory access instructions, but they do not take away from the size of available SRAM.

For illustration, here is the data memory map of the ATmega128A, a AVR device with a full complement of CPU registers, 224 I/O register locations, 4kiB of SRAM, and up to 64kiB of external memory space. Note that all 4kiB of the SRAM is both visible and accessible regardless of the number of registers.

ATmega128A memory map