• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 347
  • Last Modified:

HW - pipelined datapath mips - worst performance

I need to take the following code and re-arrange it to MINIMIZE performance...making the most clockcylces occur that I can on  a piplelined datapath with forwarding and stalls on a use following a load.  The result of the code must remain the same.

1    lw    $2, 100($6)
2    lw    $3, 200($7)
3  add    $4, $2, $3
4  add    $6, $3, $5
5  sub    $8, $4, $6
6    lw    $7, 300($8)
7  beq    $7, $8, Loop

It is unclear to me how to re-arrange my lw's in order to minimize the performance...further, I can only see swapping lines 3 and 4 being done without ruining the end result, but am not sure how this would effect performance, if at all.

Suggestions?
0
D4Ly
Asked:
D4Ly
  • 3
  • 2
  • 2
1 Solution
 
grg99Commented:
It might just be a not very good question.   The loads are already about as far as they can be from the ops.

If the goal was to improve things a bit, you could load $3 first, then you can move the add of $3 and $5 up a notch, and the lw of $7 could go anywhere higher.  But all those are improvements, so no good.

0
 
D4LyAuthor Commented:
yes, i was trying to look at the data dependencies, but so many seem to already be in a mandatory order...ie:

3 must be after 1 & 2
7 must be last
5 must come after 4 and 3
6 must come after 5
etc...

so lost on this one :\
0
 
grg99Commented:
Could it be a question written by someone like my EE lab TA, who somehow managed to put several NOTs into each question, until you were never sure what they meant?

"Your goal is to find the resonant frequency that is not passing the signal not at all and therefore not indicating nothing on the null meter."

0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
D4LyAuthor Commented:
haha wow what a bad question. null meter makes it hysterical!

Here's word for word out of the book.
Rewrite the following code to _minimize_ performance on this datapath - that is, reorder the instructions so that this sequence takes the _most_ clock cycles to execute while still obtaining the same result.

1    lw    $2, 100($6)
2    lw    $3, 200($7)
3  add    $4, $2, $3
4  add    $6, $3, $5
5  sub    $8, $4, $6
6    lw    $7, 300($8)
7  beq    $7, $8, Loop

The datapath has forwarding and stalls on a use following a load (so, stalls when add follows directly after a lw i assume...)
0
 
dimitryCommented:
Check if something like this better then the original:
1    lw    $3, 200($7)
2    lw    $2, 100($6)
3  add    $6, $3, $5
4  add    $4, $2, $3
5  sub    $8, $4, $6
6    lw    $7, 300($8)
7  beq    $7, $8, Loop
0
 
D4LyAuthor Commented:
yes! I was staring at this for 2 hours before class, and came up with exactly that before submitting it.  The data dependency on that model forces stalls from the dependency between line 1 and 3 and line 2 and 4...creating two more stall points than the original. Thanks VERY much for confirming my thoughts!  I will post back when I receive the graded solutions.
0
 
dimitryCommented:
You are welcome.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now