-1

MIPS 32 uses instructions of 32 bits. But when almost all instructions are done, the CPU adds +4 to the PC. As far as I know, 4 words means 64 bits, so, how can this be possible? Am I forgetting something or does mips32 wastes 2 empty words every instruction?

Nathan Parker
  • 308
  • 2
  • 14

1 Answers1

3

MIPS is a Von Neumann architecture processes, and both instructions and data in it are addressed on byte and not word boundary. So the PC value is advanced by four bytes - the size of the instruction.

BTW, MIPS64 instructions are still 32-bit in size.

Igor Skochinsky
  • 24,629
  • 2
  • 72
  • 109
  • Thanks for your answer! And how long are addresses? I mean, if the first instruction goes on #0000, the next one would go on #0004? So, each address represents 1 Byte? – Nathan Parker Sep 19 '14 at 13:10
  • 2
    The addresses themselves are either 32 or 64 bits; but a unit of addressing is one byte. So yeah, each possible address value points at a specific byte in memory (the memory may not be physically there, but that's another issue). – Seva Alekseyev Sep 19 '14 at 15:16
  • Hi Seva, thank you very much for your answer! Could you answer me another one? Using 32bits addresses, how is all the data accessed? As far as I know, the mips32 structure for lw only allows 16 bits for the address to load, which I guess can let you load from 0x000 to 0xFFFF. How could the 0xFFFFFFFF address be loaded? – Nathan Parker Sep 19 '14 at 18:58
  • @SevaAlekseyev seva, in the last comment I forgot to place your name to notify you. If you know the answer and you could tell me, I would be very pleased to hear it! Thank you! – Nathan Parker Oct 04 '14 at 23:16
  • Igor's answer looks satisfactory to me. – Seva Alekseyev Oct 05 '14 at 01:24
  • @SevaAlekseyev I am refering to the question in the comment. – Nathan Parker Oct 09 '14 at 03:15
  • LW includes a base register and 16 bits of offset. The base register may contain the upper bits, 0xFFFF0000 in your example. – Seva Alekseyev Oct 09 '14 at 12:31