Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6824327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:53:18+00:00 2026-05-26T21:53:18+00:00

In the Patterson & Hennessy Book: But can’t this be handled as a EX

  • 0

In the Patterson & Hennessy Book:

But can’t this be handled as a EX hazard:

Why is forwarding done in the MEM stage? And how? With 1 stall (for the 2nd add, I will need result from EX in next EX)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:53:18+00:00Added an answer on May 26, 2026 at 9:53 pm

    Document used http://www.cs.cornell.edu/courses/cs3410/2011sp/faq/faq_pa1.html

    I’ll rewrite EX and MEM hazard condition (dropping !=0 part for simplicity), before we will take in account “double data hazard” (original rules):

    EX Hazard

     if (EX/MEM.RegWrite and (EX/MEM.RegisterRd == ID/EX.RegisterRs)  # =EX_h_Rs 
       ) ForwardA = 10
     if (EX/MEM.RegWrite and (EX/MEM.RegisterRd == ID/EX.RegisterRt)  # =EX_h_Rt
       ) ForwardB = 10
    

    I’ll call conditions EX_h_Rs and EX_h_Rt to keep formulas shorter

    MEM Hazard (original condition)

     if (MEM/WB.RegWrite and (MEM/WB.RegisterRd == ID/EX.RegisterRs)) ForwardA = 01 
     if (MEM/WB.RegWrite and (MEM/WB.RegisterRd == ID/EX.RegisterRt)) ForwardB = 01
    

    ====

    And our example with two types of hazard at once, between (1st and 3rd) & (2nd and 3rd) at same time:

    add $1, $1, $2 
    add $1, $1, $3 
    add $1, $1, $4
    

    or (promlem cycle is marked with ** on top and bottom)

                    **   
    add C+A -> A ... A
               v     ?  
         add B+A -> A
                    v   
              add C+ A -> A     
                    **     
    

    According to my link, after taking into account double EX + MEM hazard: (without !=0 and reordered boolean terms), Updated rules of MEM Hazard:

    Let’s revise the forwarding conditions for MEM hazard to take care of ‘double’ data hazards

     if (MEM/WB.RegWrite and (MEM/WB.RegisterRd = ID/EX.RegisterRs) and 
      not (EX/MEM.RegWrite and (EX/MEM.RegisterRd == ID/EX.RegisterRs)) 
      ) 
       ForwardA = 01
     if (MEM/WB.RegWrite and (MEM/WB.RegisterRd = ID/EX.RegisterRt) and 
      not (EX/MEM.RegWrite and (EX/MEM.RegisterRd == ID/EX.RegisterRt)) 
     ) 
       ForwardB = 01
    

    Or the same using short record of EX_h_*

     if (MEM/WB.RegWrite and (MEM/WB.RegisterRd = ID/EX.RegisterRs) and 
      not ( EX_h_Rs ) 
      ) 
       ForwardA = 01
     if (MEM/WB.RegWrite and (MEM/WB.RegisterRd = ID/EX.RegisterRt) and 
      not ( EX_h_Rt ) 
     ) 
       ForwardB = 01
    

    which means:

    Try to forward from MEM/WB to EX; if there is no forward into same input operand from EX/MEM pipeline registers.

    Or the same

    Don’t even try to forward from MEM/WB to EX; if there is already forwarding of more recent result from EX/MEM.

    I’ll try to illustrate:

    add C+A -> A     A'
                     v?  (forwarding to 3rd instruction) 
               A -> A''
                    v?
              add C+A -> A          
    

    so, for third instruction original rules will say that Both A' from first instruction and A'' from second instruction should be forwarded (but mux can’t be fed from two sources at single moment of time). And modifying of MEM hazard condition says that A' should not be tryed to forward if there is active forwarding of A'' which is more recent.

    So; your drawing is right, there will be 2 EX Hazards forwarding; But MEM hazard forwarding should not be tried if there is already active EX Hazard forwarding.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From the Patterson/Hennessy book: Whats PCWrite & IF/DWrite (2 left most control signals from
Ok so if I have this pattern: ab&bc&cd&de&ef And I need to replace all
So this pattern: def foo(&block) block.call end foo lambda { puts 'hi' } Is
What does this pattern '/\\\(?!&#|\?#)/' match in PHP preg_replace function? Is this pattern valid?
Suppose code is given like this: pattern_mask[pattern[i]] &= ~(1UL << i); What kind of
Hy, I am implementing MVC in my game and i can't get this thing
So James Patterson keeps trying to hack my website! Okay, not really, but he
I have this pattern: Thing * y = FindNearestItem(); if (y && (MenuElement *
How can I write a regex pattern in JavaScript that accepts: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789[]`!@#$%^&*()_={}:;<>+-' especially the
I'm aware that a product can be added via querystring in Magento. Pattern: /path/to/app/checkout/cart/add?product=[id]&qty=[qty]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.