mipsfpu

MIPS FPU programming - operand is of incorrect type


MIPS coding with the FPU coprocessor. I'd like to construct a for-loop and display strings repeatedly. However the error msg shows like this: Error in D:\Users\Administrator\Desktop\mips2.asm line 9 column 14: "end": operand is of incorrect type.

Both from and end are double float variables. I'm coding on MARS4.5.

.data
    from: .double 10.0
    end:  .double 100.0
    step: .double 20.0
    say: .asciiz "fooooo\n"
.text
    ldc1    $f0, from
loop:
    c.le.d  $f0, end
    bc1t exit
    # loopbody
    li $v0, 4
    la $a0, say
    syscall
    add.d   $f10, step
    j loop
exit:
    li $v0,10
    syscall

Solution

  • MIPS is a load/store architecture, which means that data memory can only be accessed via load or store instructions.  All other instructions require register operands (or register operands and immediate, for some integer operations).

    Error in ... mips2.asm line 9 column 14: "end": operand is of incorrect type.

    Here the compare instruction requires two floating point register operands, and, the add instruction requires three floating point register operands.  It is telling you that "end", a data label, cannot be used as an operand there.