In embedded systems and systems programming, the term register is used to refer to
Is there a reason or history behind the term 'register' being overloaded this way?
Functionally speaking, a register is an element (such as a multi-bit array of D-type flop flops or equivalent) where you can store a value.
In addition to the traditional CPU registers used to hold operands and results from ALU computations, there can be Special Function Registers (on-chip or off) dedicated to other purposes. For example, a UART peripheral implementing a serial port probably has a register to hold the divisor which derives the baud rate from its clock, one for the outgoing data, one for the received data, and one that is a bitmap of mode settings.
On a machine with Memory-mapped I/O special function register appear in memory space and are accessed with memory access instructions (though sometimes there are constraints, such as only a particular width of access being legal). In contrast, on an I/O mapped machine, there are special instructions just for accessing I/O port addresses, and (at least on a dual purpose external bus) a control signal which indicates if an access is to memory or I/O space.
Further confusing things, there are a few legacy processor designs like the 8051 where the CPU registers can also be accessed as ordinary memory locations. And in many other machines, while CPU registers are stored in a register file rather than memory, they functionally have "addresses" in a bitfield of the instruction word, which specifies which register is an operand or result - RISC architectures with their numbered registers make this particularly obvious.
I/O or special-function registers are typically memory mapped but they remain registers in the sense that they are not general-purpose memory, but rather I/O peripheral control and status registers.
Unlike memory-mapped random-access read/write or read-only memory, registers typically possess characteristics such as defined power-on/reset states, and may be r/w, r/o, or w/o at the individual bit level. Further their values may change independently of any value written to them as they are also writeable by the associated peripheral; this is most often reciprocal - the processor writes while the peripheral reads, or vice-versa; often at the bit level rather than the word level. It is even common that a single address can refer to two registers, one read-only, and the other write-only.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With