Some help with MIPS assembly code

  • Thread starter XodoX
  • Start date
  • #1
203
0

Main Question or Discussion Point

Hey guys. I'm trying to practice some basic MIPS, but I can't seem to get this right. You just plug in the number and then you follow the code and you'll get obviously the end result. I can't get the result for these here. Does anybody know? I'd really appreciate help. Thank you!

1. $t0 = 0x55555555
$t1= 0x12345678

And $t2, $t0, $t1
Bgtz $t2, add 1
J end
Add0: addi $t0, $t0, 0
Add1: addi $t1, $t1, 1
Add2 : addi $t2, $t2, 2

End:


Value of $t2 is needed
 

Answers and Replies

  • #2
33,631
5,288
What is this code supposed to do?

Not being familiar with MIPS programming I have a couple of questions:
1. What is the "1." doing in the first line?
2. Is it valid to have "add 1" in the Bgtz instruction?
 
  • #3
203
0
Just means #1 as in problem 1, sorry for the confusion.

And yes, it's valid. Just gotta plug it in and get the value of t2.
 
  • #4
33,631
5,288
Just means #1 as in problem 1, sorry for the confusion.

And yes, it's valid. Just gotta plug it in and get the value of t2.
I don't understand. What do you mean "just gotta plug it in and get the value of t2."

Also, what is this chunk of code intended to do?
Code:
$t0 = 0x55555555
$t1= 0x12345678

And $t2, $t0, $t1
Bgtz $t2, add 1
J end 
Add0: addi $t0, $t0, 0
Add1: addi $t1, $t1, 1
Add2 : addi $t2, $t2, 2

End:
 

Related Threads on Some help with MIPS assembly code

Replies
4
Views
6K
  • Last Post
Replies
4
Views
5K
  • Last Post
Replies
1
Views
3K
  • Last Post
Replies
2
Views
6K
Replies
1
Views
7K
Replies
3
Views
703
Replies
4
Views
2K
Replies
8
Views
4K
  • Last Post
Replies
5
Views
5K
Top