6
$\begingroup$

Is existence of registers in CPU an obligation, Or we just do it for performance?

Can we theoretically and practically have computer architectures that don't use registers? If yes, please name computer architecture and computer models that doesn't have register.

Update: Do stack machines use register? If yes, is it possible to have stack machines without registers?

$\endgroup$
1
  • $\begingroup$ Stack machines? $\endgroup$
    – Pseudonym
    Oct 17, 2016 at 5:34

2 Answers 2

5
$\begingroup$

Theoretically, the answer to your question is a resounding "yes". A Turing Machine, the very first definition of computability in terms of machine models, has no registers. Neither do stack machines (operations always act on the top elements of the stack). Register machines, of course, do.

Practically, the answer is "it depends on your definition of a CPU". At the very least you'll need a program counter, as Yuval pointed out

$\endgroup$
8
$\begingroup$

Every CPU has, at the very least, some internal registers: a program counter, a register storing flags, and in some architectures, an accumulator (though the latter isn't strictly required).

As you mention, registers are important for speed reasons. CPUs are designed with efficiency in mind. There are no drawbacks to having (external) registers, so I conjecture that all CPUs have them.

$\endgroup$
4
  • $\begingroup$ Would this be an implicit consequence of state for computation? $\endgroup$
    – CinchBlue
    Oct 16, 2016 at 15:02
  • $\begingroup$ Possibly. If you have a computing device that doesn't have an instruction counter, I will hesitate calling it a CPU. $\endgroup$ Oct 16, 2016 at 16:02
  • 1
    $\begingroup$ All of the mentioned state could be mapped into memory (probably with fixed addresses). The distinction between "register" and "memory" can be a bit fuzzy. At least one 8-bit ISA had a zero page providing fast access to 256 bytes; if one squints hard enough these might be considered "registers". $\endgroup$
    – user4577
    Oct 17, 2016 at 0:19
  • $\begingroup$ +1: I agree that every CPU has at least some internal registers. However, the "flags register" is actually not essential -- for example, MIPS does not have a flag register ( en.wikipedia.org/wiki/status_register ). $\endgroup$
    – David Cary
    Sep 14, 2020 at 21:30

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.