1 / 49

Ανίχνευση κίνδυνου Επίλυση με προώθηση

Ανίχνευση κίνδυνου Επίλυση με προώθηση. Αποτέλεσμα της sub διαθέσιμο. Εγγραφή -20 στον Reg. από την sub. IF/ID ID/EX EX/MEM MEM/WB. Μπλέ: Εξαρτήσεις. Εξαρτήσεις προς προηγούμενα CC είναι κίνδυνοι δεδομένων K όκκινο: Προώθηση. rd, rs, rt. R-type. 1 α 2 β.

teleri
Download Presentation

Ανίχνευση κίνδυνου Επίλυση με προώθηση

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ανίχνευση κίνδυνου Επίλυση με προώθηση

  2. Αποτέλεσμα της sub διαθέσιμο Εγγραφή -20 στον Reg. από την sub IF/ID ID/EX EX/MEM MEM/WB Μπλέ: Εξαρτήσεις. Εξαρτήσεις προς προηγούμενα CC είναι κίνδυνοι δεδομένων Kόκκινο: Προώθηση

  3. rd, rs, rt R-type 1α 2β IF/ID ID/EX EX/MEM MEM/WB

  4. IF/ID ID/EX EX/MEM MEM/WB Οι τιμές στους καταχωρητές διοχέτευσης δείχνουν σε ποιο CC είναι διαθέσιμη η κατάλληλη τιμή πριν γραφεί στο Reg.

  5. Σήμα ελέγχου εγγραφής στον Rd είναι ενεργό Αποφυγή προώθησης μη μηδενικού αποτελέσματος

  6. Προώθηση στους MUX εισόδου της ALU: Εξόδου ALU Εξόδου ΜUX από ΜΕΜ/WB (rs) (rt) (rd) Από τον MUX της rt δεν εμφανίζεται η πληροφορία από το EXS Σύγκριση με την αρχιτεκτονική χωρίς προώθηση Χωρίς προώθηση

  7. Forwarding MUXs

  8. Προηγούμενη εντολή στο στάδιο ΕΧ 2η προηγούμενη εντολή στο στάδιο ΜΕΜ 3η προηγούμενη εντολή στο στάδιο WB

  9. 32 (rs) 32 (rt) (rd) 2 2 Οι διευθύνσεις όλων των καταχωτητών είναι των 5 bit

  10. Αθροισμα στοιχείων διανύσματος στον $1 Στους $rd και $rs (Στα στάδια ΕΧκαι ΜΕΜ) Κίνδυνοι δεδομένων από αποτελέσματα εντολών στο στάδιοΕΧ, στο στάδιο MEM, και τον τελεστέο προέλευσηςτης εντολής στο στάδιο της ALU Ποιό είναι το πιο πρόσφατο αποτέλεσμα ; Προώθηση από το πιο πρόσφατο στάδιο (από το ΜΕΜ). Αναθεώρηση ελέγχου ΜΕΜ

  11. Condition for EX hazard on Rs Condition for EX hazard on Rt ONLY FORWARD IF EX HAZARD CONDITION ISN’T TRUE

  12. Τα επιπλέον σήματα στην μονάδα προώθησης είναι τα : EX/MEM.RegWrite και MEM/WB.RegWrite

  13. Ανάγνωση $2 μετά από lw

  14. IF/IDID/EXEX/MEM MEM/WB lw $rt, $20(rs) and $rd, $rs, $rt

  15. (Ολα τα σήματα ελέγχου απενεργοποιημένα)

  16. IF/ID ID/EXEX/MEM MEM/WB Repeat decode repeat fetch

  17. Α bubble is inserted beginning in CC4, by changing the AND instruction to a NOP. AND instruction is fetched and decoded in CC2 and CC3 but its EX stage is delayed until CC5 (versus the unstalled position in CC4). OR instruction is fetched in CC3, but its ID stage is delayed until CC5 (versus the unstalled CC4 position). After insertion of the bubble, all dependences go forward in time and no further hazards occur. IF/ID ID/EXEX/MEM MEM/WB stall

  18. Ελεγχος εγγραφής σε PC, IF/ID και σήματος επιλογής του MUX της μονάδας ελέγχου (καθυστέρηση για load-use hazard) Ελεγχος των MUX στην είσοδο της ALU

  19. Στοτέλος του CC3 η απόφαση για την beq. Παράλληλα έχει ξεκινήσει η εκτέλεση των 3 επόμενων εντολών Υπόθεση μη ληφθείσας διακλάδωσης (το σχήμα αναφέρεται για μη βελτιστοποιημένη διαδρομή) Στα στάδια IF, ID, EX (και όχι μόνο στο ID όπως στο load-use hazard)

  20. Μεταφορά εκτέλεσης της διακλάδωσης νωρίτερα στην διοχέτευση (εκκένωση λιγότερων εντολών) με Από EX μετακίνηση στο ID Εισαγωγή στο ID

  21. Αθροιστής IF/IDWrite PCWrite Συγκριτής Μηδενισμός πεδίου εντολής στον IF/ID Απόφαση ότι beq θα πρέπει να ληφθεί, δηλ. 72 στον PC και απόρριψη επόμενης εντολής

  22. Παρουσίαση της εντολής lw και με τον μηδενισμό του πεδίου εντολής στον IF/ID (IF.Flush=1. Σήμα της CU) μετασχηματίζει την προσκομισθείσα εντολή σε NOP.

  23. prediction bit 1 0 a31a30…a11…a2a1a0 branch instruction 1K-entry BHT 10-bit index 1 Instruction memory • Branch History Table (BHT): • Lower bits of PC addressas index to BHT • Indicates whether or not the branch was taken last time • No address check (saves HW, but may not be the right branch) • If prediction is wrong, invert prediction bit • 1 = branch was last taken • 0 = branch was last not taken

  24. The Branch Target and Prediction Buffer (BPB) is implemented as a small cache. Stores the target address of recent branches and jumps. The prediction bits are added. They predict whether branches are taken or not taken. The prediction bits (1 or 2) are dynamically determined by the hardware. 10 22 22 hit 32

  25. Example : A loop branch that is taken 9 times in a row and then not taken once. What is the prediction accuracy of the 1-bit predictor for this branch assuming only this branch ever changes its corresponding prediction bit? Answer: 80%. Because there are two mispredictions – one on the first iteration and one on the last iteration.

  26. 3 2 • 0 1

  27. State 3: Strong predict taken State 2: Weak predict taken State 0: Strong predict not taken State 1: Weak predict not taken Υλοποιείται με μετρητή (αύξηση για ληφθείσα πρόβλεψη, μείωση διαφορετικά)

  28. Execute Exception handler

  29. ΕΞΑΙΡΕΣΕΙΣ ΣΕ ΜΙΑ ΔΙΟΧΕΤΕΥΣΗ • Treat them as another form of a “control hazard” • Consider overflow on add in EX stage • e.g. add $1,$2,$1 • ACTIONS: • Prevent $1 from being updated. • The exception must be serviced directly after the instruction leaves the EX stage. • Must complete all previous instructions. Instructions in MEM and WB stages proceed normally. • Flush addand subsequent instructions. Need to flush IF/ID (as in mispredicted branch), ID/EX, EX/MEM PR. • Set Cause and EPC register values. Save overflow bit from ALU in Cause register. Need to save PC (+4) in EPC • Transfer control to handler. Jump to 0x80000180

  30. Similar to mispredicted branch. Use much of the same hardware. • Additional status signal (from ALU): • Overflow output signal (part of the Status Reg. (SR)) • Additional control signals (from CU): • ID stage Flush through an OR-gate (ID.Flush and Stall from the Hazard Detection Unit) • EX stage Flush with the EX.Flush control signal. • Additional registers: • Cause – EPC • The PC MUX is augmented with the address of the Exception handler (0x80000180). • Upon servicing the exception and notifying the user with the offending instruction and the cause of the exception, the user/OS can decide to resume execution of the program. • Execute a “return from exception” (RFE) instruction which simply copies EPC to PC.

  31. stall overflow

  32. Overflow exception Exception handler

  33. Exe instructions and or as normal Save PC Select 8000180 oveflow Overflow detection At the end of CC6, enable the Flush signals

  34. Flush IF/ID Flush ID/EX Flush EX/MEM Fetch sw from handler

  35. Εξυπηρέτηση εξαίρεσης της σωστής εντολής που την προκάλεσε.

More Related