|
-
Dec 13th, 2006, 02:33 AM
#1
Thread Starter
Hyperactive Member
logic confusion, not sure how i got 12, but its not a choice .:Resolve:.
Hello everyone i'm not sure how they got their answer here, it seems simple but I ended up getting 12 for $t3. Here is the question:
IF we are to run the below code on a pipleined 5 staged data path, how many cycles are needed? Assume there is no data forwarding hardware in the pipline.
After running, what is the data stored in $t3?
$t1 = 2
$t0 = 4 at the beginning.
Code:
add $t2, $t1, $t0
xor $t3, $t2, $t1
sub $t4, $t0, $t1
j label
add $t3,$t3,$t3
...
label: or $t3, $t1, $t0
A. $t3 = 8 , 11 cycles
B. $t3 = 4 , 10 cycles
C. $t3 = 6 , 10 cycles
D. $t3 = 6 , 11 cycles
I got 10 cycles and the naswer to be $t3 = 12.
Here is my reasoning.
first line:
add $t2, $t1, $t0 #$t2 = 6
xor $t3, $t2, $t1 # $t3 = 6 xor 2 would be 0110 xor 0010 = 0100 = 4
sub $t4, $t0, $t1 # $t4 = 2
j label #jump to label
add $t3,$t3,$t3
....
label: or $t3, $t1, $t0 # t3 = 2 or 4 = 0010 or 0100 = 0110 = 6
but now you must add $t3 = $t3 + $t3 = 6 + 6 = 12
I don't see where i'm misunderstanding...
Thanks!
Last edited by voidflux; Dec 21st, 2006 at 02:29 AM.
C¤ry Sanchez
Computer Science/Engineering
@ Penn State
IBM.zSeries Intern
Mandriva 2007
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|