5
$\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$
  • $\begingroup$ Stack machines? $\endgroup$ – Pseudonym Oct 17 '16 at 5:34
3
$\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

| cite | improve this answer | |
$\endgroup$
5
$\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.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Would this be an implicit consequence of state for computation? $\endgroup$ – CinchBlue Oct 16 '16 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$ – Yuval Filmus Oct 16 '16 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$ – Paul A. Clayton Oct 17 '16 at 0:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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