Discussion:
HW#3
(too old to reply)
Steven Wood
2005-09-16 22:19:43 UTC
Permalink
In Problem 3.12 we are supposed to show how to perform
slt $t0, $s0, $s1, with all of the conditional branch instructions (except
beq, and bne) removed as well as slt and all of its variants. It says Hint:
it requires more than 2 instructions.

However, I was able to do it in 2, I wrote it up and tested it in SPIM and
for all possible test cases:

+VAL < +VAL
-VAL < +VAL
-VAL < -VAL

and in all cases it returned the correct result for both true and false.
Just wondering, is this a "Good For You" situation, or am I missing
something?

-Thanks
carlos
2005-09-17 19:26:16 UTC
Permalink
I'm having the same problem... I was able to do it in two as well.

-carlos
Post by Steven Wood
In Problem 3.12 we are supposed to show how to perform
slt $t0, $s0, $s1, with all of the conditional branch instructions (except
it requires more than 2 instructions.
However, I was able to do it in 2, I wrote it up and tested it in SPIM and
+VAL < +VAL
-VAL < +VAL
-VAL < -VAL
and in all cases it returned the correct result for both true and false.
Just wondering, is this a "Good For You" situation, or am I missing
something?
-Thanks
David Grohmann
2005-09-20 08:42:11 UTC
Permalink
what about 2 numbers that are equal? in this case t0 should be assigned a 0

______________

David Grohmann
Post by Steven Wood
In Problem 3.12 we are supposed to show how to perform
slt $t0, $s0, $s1, with all of the conditional branch instructions (except
it requires more than 2 instructions.
However, I was able to do it in 2, I wrote it up and tested it in SPIM and
+VAL < +VAL
-VAL < +VAL
-VAL < -VAL
and in all cases it returned the correct result for both true and false.
Just wondering, is this a "Good For You" situation, or am I missing
something?
-Thanks
David Grohmann
2005-09-20 09:28:19 UTC
Permalink
well i just attempted this and did it with 2,

except large positive and negative values cause overflows and i get the
wrong answer

______________

David Grohmann
Post by Steven Wood
In Problem 3.12 we are supposed to show how to perform
slt $t0, $s0, $s1, with all of the conditional branch instructions (except
it requires more than 2 instructions.
However, I was able to do it in 2, I wrote it up and tested it in SPIM and
+VAL < +VAL
-VAL < +VAL
-VAL < -VAL
and in all cases it returned the correct result for both true and false.
Just wondering, is this a "Good For You" situation, or am I missing
something?
-Thanks
Continue reading on narkive:
Loading...