2

I will preface this that it is highly likely that I have misunderstood how Harvard architecture works, but I cannot understand how an 8-bit instruction set, say the ATmega128 for example, can contain 133 instructions along with the addresses to 32*8 registers inside a single 8-bit instruction.

If you had all 8 bits dedicated to the 133 instructions how do you then contain the operands for the expression? I don't really understand how the addressing mode work, does this reduce the amount of expressions used since you have fewer duplicate expressions? Is it because the operands are contained in a different instruction, if so surely this makes it a 16-bit processor?

toolic
  • 5,637
  • 5
  • 20
  • 33
  • Isn't it the register size that defines this? – Andy aka Dec 20 '22 at 12:52
  • 8
    The AVR has a 16 bit instruction but an 8bit data path. The ‘bitness’ of a processor usually refers to its datapath, not the instruction width. If you download the AVR instruction set manual, you’ll see how the instructions are encoded. – Kartman Dec 20 '22 at 12:52

1 Answers1

14

The AVR has mostly 16-bit instruction opcodes. Some are 32-bit.

And that does not make it a 16-bit or 32-bit CPU.

So it does not even have an 8-bit instruction set.

You can take a look at instruction set for further details how they work.

Instruction opcode length has no relation to being a 8-bit CPU, it is a completely orthogonal definition.

The opcodes mainly move 8-bit data quantities around an internal 8-bit data bus, and that is what makes it an 8-bit CPU.

Justme
  • 127,425
  • 3
  • 97
  • 261
  • 1
    right, thank you so much, my apologies for my ignorance, I knew there was something I had not quite understood – Lyndon Alcock Dec 20 '22 at 13:34
  • 2
    Just a comment observing that in Von Neumann (non-Harvard) architecture, the instructions do go on the same path as the ordinary data, and thus tend to be organised in lumps which match the main datapath. Z80, for example, has one-byte, 2-byte etc instructions. For the peak of separating the instruction-proper from the data encoding, see the VAX architecture, which requires a very elaborate bus. – jonathanjo Dec 20 '22 at 13:54
  • 1
    Right I believe this is what had me confused thank you. – Lyndon Alcock Dec 20 '22 at 15:48