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.

  • 1
    \$\begingroup\$ Why did you ask it? What is the usage of this question? is it matter? \$\endgroup\$ – Roh Nov 14 '13 at 8:33
  • 1
    \$\begingroup\$ It is quite possible that these registers are implemented in an sram in the part. but that doesnt mean that sram or other srams in the part are on the memory bus. It is just cheaper sometimes to implement a good sized quantity of flip flops in an sram rather than discrete transistors or flip flops... \$\endgroup\$ – old_timer Nov 16 '13 at 14:21

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

  • \$\begingroup\$ I think all of registers are located in one block named data memory? yes? Is it specified that all of these registers packed in one block memory? Or these registers can be placed in different places. For example a r0 and r1 can be placed very near to the ALU. Another possibility is that the priority of all these registers are same and can be packed in one pack of registers. of course this is an additional information to the answer. I got the answer of my question. \$\endgroup\$ – Mohammad Etemaddar Nov 14 '13 at 9:51
  • 1
    \$\begingroup\$ @MohammadEtemaddar: In order to know where the registers are located physically you'd probably have to depot the IC and inspect it under a microscope. But all the CPU registers should be in one block and the internal SRAM in another, whereas the I/O registers would be scattered around on the die. \$\endgroup\$ – Ignacio Vazquez-Abrams Nov 14 '13 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.