0

这就是我要转换的代码的样子:

 # R = first number in input file - the upper bound on the rest of the
 #     numbers in the input file. If R = 100, then the rest of the
 #     input file must be non-negative integers < 100, and the last one < 0.
 # n = count of non-negative integers (except R) read from input.
 # n = size of arrays A and B, and R = size of array C.
 # for i = 0 to R-1
 #   C[i] = 0
 # end for

这些是我想使用的寄存器:

 # $a0 = base address of array A (1st input in file)
 # $a1 = base address of array B (2nd input in file)
 # $a2 = base address of array C
 # $a3 = n, size of arrays A and B
 # $s0 = size of array C - upper bound on numbers (R)

 # $t0 = i
 # $t1 = j
 # $t2 = adress of C[i]

这是我目前不确定如何格式化数组的地方:

 bucket:  li $t0,0        #set to 0/i
          li $t3,         #set to R
          sub  
          beq $t0,$t3,then#for loop
          add
          sll 
          sw $t2,
 then:    ...

我只是想知道我是否正在使用这段代码朝着正确的方向前进,还是应该重新开始。非常感谢任何提示或帮助,如果这很难理解,可以发布更多代码。

4

0 回答 0