Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are CPU general purpose registers usually memory mapped?

I am confused about Memory Map and Memory mapped I/O. Do general purpose registers, for example in ARM Architecture r0, r1, etc., are generally memory mapped?

like image 500
Jisung Kim Avatar asked Dec 14 '22 14:12

Jisung Kim


1 Answers

No, those registers are inside the actual CPU (or CPU core for multi-core CPUs). You can not access them through loads or stores to any memory address.

A memory-mapped register is something which you access through an address or a pointer (in languages that have pointers). I/O devices often have memory-mapped registers, where you write to or read from a specific address to set or get information or data. In other words, they are accessed just like any other memory (e.g. RAM).


As mentioned in comments, there do exist CPUs with memory-mapped CPU registers. They were almost all designed in the 1970's and are part of history now. The chances you would encounter a mainstream CPU (not microcontroller) with memory-mapped registers these days are slim to none.

Some microcontroller architectures do still use memory-mapped registers, including old designs like 8051, and even some more recent designs like PIC microcontrolers and AVR (an 8-bit RISC with thirty-two 8-bit registers). AVR MCUs come with at least 128 bytes of internal SRAM, the low 32 of which is also the register file.

Specifically for ARM, the ARM architecture does not have memory-mapped CPU registers. Peripherals, including those on the same SoC as the CPU's, are a different matter though: I/O registers are not at all the same thing because they're not also accessible via register-numbers as operands for instructions other than load or store. (And aren't even inside the core running your instructions.)

like image 165
Some programmer dude Avatar answered Jan 22 '23 19:01

Some programmer dude