3

I am trying to write out MIPS binary code for machine instructions which have to do with floating-point registers. But while I can find the opcode for the floating-point instructions, I can't find out what numbers refer to which floating-point registers. My book and the Internet can tell me which number register I would use if I wanted to refer to $t1, but I can't find any information on how I would refer to $f1.

Jeffrey Bosboom
  • 13,313
  • 16
  • 79
  • 92
Jo.P
  • 1,139
  • 4
  • 15
  • 35

1 Answers1

3

There are 32 floating point registers: $f0..$f31. But every floating point operation is done (in early MIPS processors) in separate processing unit, FPU (Floating point unit), so you can't access floating point registers with ordinary (integer) command. FPU registers for FPU commands and CPU registers for CPU commands.

There is a picture and transparent description http://www.cim.mcgill.ca/~langer/273/12-coprocessors.pdf

All FPU commands are encoded as Coprocessor Instructions, for coprocessor 1 (CP1) Check first and last pages of http://www.cs.sunysb.edu/~lw/spim/MIPSinstHex.pdf

Fields ft(5) fs(5) fd(5) are codes of registers (all are 5 bit wide). $f0 will be coded as 0; $f31 as 31 (dec) or 0x1f (hex). For double-register values (64-bit double format), only number of first register from register pair is recorded (only even regnumber is allowed: 0,2 ..30).

Detailed tables of opcodes are here: http://www.math.unipd.it/~sperduti/ARCHITETTURE-1/mips32.pdf (page A-73)

osgx
  • 90,338
  • 53
  • 357
  • 513
  • thanks! Have I "accepted" this answer? I'm not sure how to d it, but I would like to.... – Jo.P Feb 17 '13 at 00:31