i need your help regaring this code, which is in python and i need to convert it into mips??
register $s0 holds the base address of list my_data, $s1 holds the length of the list my_data,
register $s2 holds the base address of list my_data2 and $s3 holds the length of the list
sum = 0
for i in range (x):
sum += i
my_data = [1, 3, 6, 7]
my_data2 = [2, 1, 5]
for i in range( len( my_data ) ):
my_data[ i ] = sum_to_x( my_data[ i ] )
for i in range( len( my_data2 ) ):
my_data2[ i ] = sum_to_x( my_data2[ i ] )
and yeah btw here is what i have done on this code:
my_data: .word 1, 3, 6, 7
my_data2: .word 2, 1, 5
la $s0, my_data # based address of list A loaded into $s0
addi $s1, $zero, 4 # $s1 is set to the size of the my_data
la $s2, my_data2 # based address of list B loaded into $s2
addi $s3, $zero, 3 # $s3 is set to the size of the my_data2`
Can you reveal why that's not helpful? You didn't call out this is some homework or such. I deal with embedded computers all the time and we are always cross compiling. While I did write a lot of assembler code, for many reasons we move to cross compilers to make the systems maintainable.
As it stands maybe a loop and adding up the values is next but there is no clear link to your homework assignment or what we call the requirements. Maybe coding in python wasn't a good start if you were going to try to write in assembler.
Think of the python code as your translation from the requirements. Something possibly lost in translation.