错误:乘以定义的符号,如何解决?

时间:2019-06-11 01:27:07

标签: assembly mips

尝试编译时,我的代码出错。有什么问题。

这是我的MIPS代码的错误。代码段如下:

/ home / fac / wrc / bin / rasm -l prime.asm> prime.lst

89 0048 012A582A
循环:slt $ t3,$ t1,$ t2#if($ t1 <$ t2)$ t3 = 1 错误:乘以定义的符号

150 00c4 01AE782A
循环:slt $ t7,$ t5,$ t6#if($ t2 <$ t3)$ t7 = 1 错误:乘以定义的符号

有2个致命错误 Makefile:20:目标“ prime.obj”的配方失败 make:*** [prime.obj]错误2

该怎么办才能解决此错误

MIPS汇编中的代码:

find_primes:
        addi    $sp,$sp,-40     # allocate stack frame (on doubleword boundary)
        sw      $ra, 32($sp)    # store the ra & s reg's on the stack
        sw      $s7, 28($sp)
        sw      $s6, 24($sp)
        sw      $s5, 20($sp)
        sw      $s4, 16($sp)
        sw      $s3, 12($sp)
        sw      $s2, 8($sp)
        sw      $s1, 4($sp)
        sw      $s0, 0($sp)

# ######################################
# ##### BEGIN STUDENT CODE BLOCK 1 #####

addi $t1, $zero, MIN # Insert minimum value MIN = 3 in register $t1

addi $t2, $zero, MAX # Insert maximum value MAX = 102 in register $t2

Loop:  slt $t3, $t1, $t2  # if ($t1 < $t2) $t3 = 1
             # else $t3 = 0

beq $t3, $zero, L2 # if ($t3 == $zero) go to L2
jal is_prime

add $t4, $zero, $v0

syscall

bne $t4, $zero, print_number

addi $t1, $t1, 1 # $t1 = $t1 + 1

j Loop # go to the Loop

L2:

# ###### END STUDENT CODE BLOCK 1 ######
# ######################################






is_prime:
        addi    $sp,$sp,-40     # allocate stackframe (doubleword aligned)
        sw      $ra, 32($sp)    # store the ra & s reg's on the stack
        sw      $s7, 28($sp)
        sw      $s6, 24($sp)
        sw      $s5, 20($sp)
        sw      $s4, 16($sp)
        sw      $s3, 12($sp)
        sw      $s2, 8($sp)
        sw      $s1, 4($sp)
        sw      $s0, 0($sp)

# ######################################
# ##### BEGIN STUDENT CODE BLOCK 2 #####

addi $t5, $zero, 2
add $t6, $zero, $a0

Loop:  slt $t7, $t5, $t6  # if ($t2 < $t3) $t7 = 1
                          # else $t7 = 0

beq $t7, $zero, Exit # if ($t7 == $zero) go to Exit

rem $t6, $a0, $t5

beq $t6, $zero, L1 # if ($t7 == $zero) go to L1 


addi $t5, $t5, 1 # $t5 = $t5 + 1

j Loop # go to the Loop

L1:
    addi $v0, $v0, 0  # The value of $v0 is zero

Exit:
    addi $v0, $v0, 1 # The value of $v0 is one

# ###### END STUDENT CODE BLOCK 2 ######
# ######################################


0 个答案:

没有答案