2
\$\begingroup\$

I am currently studying the difference between microprocessors and microcontrollers and one of them says that:

Microprocessors have less number of registers, so more operations are memory based.

Microcontrollers have more number of registers and hence more operations are register based.

What I don't understand is, isn't memory and register the same ? I thought that register is just a memory location with a name.

\$\endgroup\$
3
  • \$\begingroup\$ Computer systems can be understood at many levels. The answer to whether "registers" and "memory locations" are basically the same things or fundamentally different things may depend upon the level at which you are trying to understand the system. \$\endgroup\$ Commented Jun 15, 2021 at 16:47
  • \$\begingroup\$ While both can store data, a flip flop is not a RAM location, for example. \$\endgroup\$ Commented Jun 15, 2021 at 17:06
  • \$\begingroup\$ The definitions you have are not very typical. A typical meaning for a microcontroller is that it is a microprocessor and a bunch of memory and peripherals in same package. And thus a microprocessor has usually no built in memory, just registers. And many microprocessors can have more registers than many microcontrollers do, so it depends on the architecture. A register is a storage space for something inside the CPU, memory is something that needs to be separately accessed and accessing it is slower. But I guess all of this depends on whom you ask so there may be no one true answer. \$\endgroup\$
    – Justme
    Commented Jun 15, 2021 at 17:25

3 Answers 3

4
\$\begingroup\$

Some differences:

  • In a lot of cases accessing registers is a lot faster than accessing memory.

  • The memory elements for registers is always found on the processor chip. Addressable memory can be external to the processor chip. It can also be found on the chip and you can have addressable memory both on the chip and external to it.

  • A memory address can be several bytes long (depending on the architeture). By comparison a register number is usually very small. So instructions which refer to memory addresses are generally longer than those which only refer to registers. Longer instructions take up more program memory and can take longer to process.

When you come across a statement like:

Microprocessors have less number of registers, so more operations are memory based. Microcontrollers have more number of registers and hence more operations are register based.

they are most likely referring the early 8-bit microprocessors. Modern CPUs (like the ones found in your laptop) have large register files available to them.

Memory itself in a computer system is very hierarchical. A good exposition of this is paper What Every Programmer Should Know About Memory - especially the section on caches.

\$\endgroup\$
2
  • 3
    \$\begingroup\$ Another thing that could be added is that most CPUs don't support operating on memory directly; instead, values from memory have to be loaded into registers within the CPU first. (x86 is an exception to this, although it also only supports one memory operand per instruction, the other operands have to be in registers.) \$\endgroup\$ Commented Jun 15, 2021 at 17:25
  • 1
    \$\begingroup\$ One (interesting? notable?) exception to your second point: The TMS9900 had a few registers internal to the CPU chip, but 16 general purpose registers were in RAM (and changed with context). They could be accessed by short instructions but were relatively slow. \$\endgroup\$
    – Theodore
    Commented Jun 15, 2021 at 21:25
1
\$\begingroup\$

Register is a special type of memory. A register is used to determine functions of an mcu, but a piece of memory holds just data. Register values can usually be accessed much faster than RAM or NVMemory. And if no DMA is used usually all the data goes throu registers. A register is a part of the cpu or mcu whereas memory is not (at least not part of a cpu).

\$\endgroup\$
1
\$\begingroup\$

The term "register" is vague, since there are two kinds of registers.

  • Those who reside inside the CPU core, also referred to as CPU registers, data registers, accumulators and similar. These do not have an address.
  • Memory-mapped hardware peripheral registers, used to control the various hardware built-in with the part. These have an address and are essentially a form of glorified RAM memory.

There aren't really any "microprocessors" as such nowadays, since pretty much every single part made is guaranteed to have lots of stuff on-chip. Interrupt/exception handling, MMU, oscillators, PLLs, cache memory, watch dogs, brown-out detection and so on.

The whole "microprocessor vs microcontroller" thing originates from the 1980s somewhere, when Motorola 68k was the hottest part out there. It isn't something you need to ponder nowadays. It rather seems like you found some outdated old book/teacher that stopped being accurate many decades ago.

\$\endgroup\$
2
  • \$\begingroup\$ Arguably today, microprocessors vs microcontrollers is about the type of stuff on chip. microcontrollers having stuff that can interact directly with things, GPIOs, ADC/DACs, and low bandwidth buses like I2C and SPI, whilst microprocessors have high bandwidth links like PCIe, displayport, HDMI or ethernet. \$\endgroup\$ Commented Jun 16, 2021 at 20:07
  • \$\begingroup\$ Which really is about intended design role. A microcontroller is a lower power processor designed specifically for use controlling hardware. A microprocessor is a processor designed for general purpose processing. \$\endgroup\$ Commented Jun 16, 2021 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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