为什么 QtSPIM 告诉我“第二次定义标签"? [英] Why is QtSPIM telling me "Label is defined for the second time"?

查看:101
本文介绍了为什么 QtSPIM 告诉我“第二次定义标签"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是学习 MIPS 汇编代码的新手,我们得到了第一个编码任务.当我运行我的程序时出现错误(它应该是我们必须编写的另一个函数的测试器)说

I am brand new to learning MIPS assembly code, and we got our first coding assignment. I am getting an error when I run my program (which is supposed to be a tester for another function we have to write) saying

"spim: (parser) 标签在文件/home/jlr247/215_A2_work/jlr247-a2-A.s 的第 13 行第二次定义主要的:^"

"spim: (parser) Label is defined for the second time on line 13 of file /home/jlr247/215_A2_work/jlr247-a2-A.s main: ^"

我的代码是:

.data
.align 4
_arrA: .space 400
_arrB: .space 400

.text

main:
la $t0, _arrA       #load base address of array A
la $t1, _arrB       #load base address of array B

addi $t2, $zero, 0  #$t2 = i = 0

FILL_LOOP:  #initializes all A[] values to 5, all B[] values to 10
slti $t3, $t2, 100          #check i<100
beq $t3, $zero, LOOP_DONE   #end loop when i=100
sll $t3, $t3, 2             #multiply shift by 4
add $t4, $t3, $t0           #$t4 = address of A[i]
add $t5, $t3, $t1           #$t5 = address of B[i]
addi $t6, $zero, 5
sw $t6, 0($t4)              #A[i] = 5
addi $t6, $zero, 10
sw $t6, 0($t5)              #B[i] = 10
j FILL_LOOP

LOOP_DONE:

li $v0, 1   #get ready to print test values for A[0], A[396]
lw $a1, 0($t1)
lw $a2, 396($t1)
syscall     #should print 55

li $v0, 1   #get ready to print test values for B[0], B[396]
lw $a1, 0($t2)
lw $a2, 396($t2)
syscall     #should print 1010

EXIT:

有什么想法吗?我敢肯定,这是我还没有学会的一些基本和明显的东西.谢谢!

Any ideas? I'm sure it's something basic and obvious that I just haven't managed to learn yet. Thank you!

推荐答案

"spim: (parser) Label 在文件/home/jlr247/215_A2_work/jlr247-a2-A.s main 的第 13 行第二次定义:^"

"spim: (parser) Label is defined for the second time on line 13 of file /home/jlr247/215_A2_work/jlr247-a2-A.s main: ^"

如果您两次使用加载文件"命令而没有重新初始化模拟器,就会发生这种情况.

This can happen if you use the "Load File" command twice without reinitializing the simulator in between.

为避免这种情况,请使用模拟器"->重新初始化模拟器",然后使用文件"->加载文件",或文件"->重新初始化并加载文件".

To avoid this, either use "Simulator" -> "Reinitialize Simulator" followed by "File" -> "Load File", or "File" -> "Reinitialize and Load File".

这篇关于为什么 QtSPIM 告诉我“第二次定义标签"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆