1

I know that 32-bit MIPS instruction and memory registers are... well 32 bits... and that the PC calculates the address for that instruction in the instruction register.

My question is this: Are the 32-bit address appended to a 32-bit instruction?

Ignoring the fact that these are all zeros...

Is 0x00000000 (address) concatenated with 0x00000000 (instruction)?

For example, R-Type is

OP(6) RS(5) RT(5) RD(5) SHIFTAMMT(5) FUNCT(6) 
=> 32 bit instruction
=> 000000_00000_00000_00000_00000_000000

where the address for the above is 000000_00000_00000_00000_00000_000000

Are the two 32-bit numbers concatenated together so that PC spits out 32 bits which correspond to the upper half of a 64-bit value? I often see tables that have

Address     Instruction
0x00000000  0x00000000

Any help would be appreciated.

Charlie
  • 11
  • 3

2 Answers2

2

The tables you often see show the address of the instruction and the instruction itself. In memory, every word (byte) has an address that never changes. The address (the location the processor uses) and instruction (what's stored at the location) are independent.

qwr
  • 9,525
  • 5
  • 58
  • 102
0

As far as what you are asking, the instruction set is fixed length no more no less.

For some instructions addresses are contained in registers and it only takes a few bits of the 32 bit instruction to define that register.

If a register is not used as the source of an address, then a percentage of the bits in the instruction typically contain an offset, since all instructions are 32 bits the offset is most likely in units of instructions not in bytes, no point wasting those two bits. I dont remember if mips has any other encoding, if they do then it can only be a fraction of the address.

Some percentage of the bits of an instruction have to be reserved to define that instruction, based on that encoding the rest of the bits define the parameters for that instruction. There are numerous sources for these instruction encodings, in particular mips website.

(there is an exception to the 32 bit fixed length rule, they have a 16 bit instruction set, but that doesnt change how addresses are encoded, mips is not variable length like x86 or other cisc where you tack on many bytes as parameters)

old_timer
  • 69,149
  • 8
  • 89
  • 168
  • yes mips has 32 bit instructions AND 32 bit addresses. A single instruction simply cannot host a complete 32 bit address. – old_timer Apr 19 '16 at 02:22