CPUs and architecture

In microcontrollers and similar devices, which scheme assigns peripheral registers to the same address space as memory and operates them with ordinary memory read/write instructions?

  1. AVirtual memory
  2. BMemory-mapped I/O
  3. CCache coherence
Show answer and explanation

Answer: B. Memory-mapped I/O

Memory-mapped I/O assigns addresses to peripheral control registers, such as timers and UARTs, so ordinary load and store instructions control them. Compared with port-mapped I/O using dedicated instructions (like x86 IN/OUT), it keeps the instruction set simple and is standard on ARM and RISC-V microcontrollers. Peripheral registers must not be cached and must be accessed as volatile so the compiler does not optimize accesses away.

  • A. Virtual memory maps virtual addresses to physical addresses.
  • B. Correct. Peripherals are assigned to the memory space and operated through it.
  • C. Cache coherence keeps the contents of multiple caches consistent.