330 likes | 476 Views
ROB Example. We will go through an example of the use of reorder buffers in two scenarios— Completion without exceptions One instruction raises an exception First, let’s consider the data structures in use for the example. FUs. RF. R0. R1. ROB. R2. R3. HEAD. TAIL. Reservation
E N D
ROB Example • We will go through an example of the use of reorder buffers in two scenarios— • Completion without exceptions • One instruction raises an exception • First, let’s consider the data structures in use for the example. ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
FUs RF R0 R1 ROB R2 R3 HEAD TAIL Reservation Stations ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
Code for the example A LW R2, 4(R0) B MULT R3, R1, R2 C LW R2, 8(R0) D ADD R1, R1, R2 E SUB R2, R0, R1 F ADD R0, R1, R2 At each step, we will show the changes by coloring the cell backgrounds pink. ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
A LW R2, 4(R0) FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 HEAD TAIL Reservation Stations ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
A LW R2, 4(R0) FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 HEAD TAIL Reservation Stations ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
B MULT R3, R1, R2 FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 HEAD TAIL Reservation Stations ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
B MULT R3, R1, R2 FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 HEAD TAIL Reservation Stations 0 (cache miss) ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
C LW R2, 8(R0) FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 HEAD TAIL Reservation Stations 0 (cache miss) ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
C LW R2, 8(R0) HEAD TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 Reservation Stations 0 (cache miss) ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
D ADD R1, R1, R2 HEAD TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 Reservation Stations 0 (cache miss) ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
D ADD R1, R1, R2 HEAD TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 Reservation Stations 0 (cache miss) 2 (cache hit) ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
E SUB R2, R0, R1 HEAD TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 Reservation Stations 0 (cache miss) 2 (cache hit) ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
E SUB R2, R0, R1 HEAD TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 Reservation Stations 0 (cache miss) 2 (cache hit) ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
HEAD TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 Reservation Stations 0 (cache miss) 2, 667, no exception ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
HEAD TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 Reservation Stations 0 (cache miss) 3 ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
HEAD TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 Reservation Stations 0 (cache miss) 3, 743, no exception ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
HEAD TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 Reservation Stations 0 (cache miss) 4, –689, no exception ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
F ADD R0, R1, R2 HEAD TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 Reservation Stations 0 (cache miss) ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
F ADD R0, R1, R2 HEAD TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 Reservation Stations 0 (cache miss) ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
HEAD TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 Reservation Stations 0 (cache miss) 5, 54, no exception ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
HEAD TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 Reservation Stations 0, 650000, no exception ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
HEAD TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF Reg=R2, Tag=0, Val=650000 R0 Note: Tag doesn’t match RF tag, don’t set “In RF” Note: Commit value to register- file state R1 ROB R2 R3 Reservation Stations 1 (multiply) ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
Two scenarios next… • Multiply • Scenario #1: Completes without exception • Scenario #2: Raises exception ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
HEAD TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 Reservation Stations 1, 49400000, no exception ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
HEAD TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF Reg=R3, Tag=1, Val=49400000 R0 Note: Tag matches RF tag, so set “In RF” Note: Commit value to register-file state R1 ROB R2 R3 Reservation Stations ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
HEAD TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF Reg=R2, Tag=2, Val=667 R0 Note: Tag does not match RF tag, don’t set “In RF” Note: Commit value to register-file state R1 ROB R2 R3 Reservation Stations ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
HEAD TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF Reg=R1, Tag=3, Val=743 R0 Note: Tag matches RF tag, so set “In RF” Note: Commit value to register-file state R1 ROB R2 R3 Reservation Stations ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
HEAD TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF Reg=R2, Tag=4, Val=–689 R0 Note: Tag matches RF tag, so set “In RF” Note: Commit value to register-file state R1 ROB R2 R3 Reservation Stations ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF Reg=R0, Tag=5, Val=54 R0 Note: Tag matches RF tag, so set “In RF” Note: Commit value to register file state R1 ROB R2 R3 HEAD Reservation Stations ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
Now do scenario #2 • Multiply raises exception. ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
HEAD TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 Reservation Stations 1, exception ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
TAIL FUs ALW R2, 4(R0) BMULT R3, R1, R2 CLW R2, 8(R0) DADD R1, R1, R2 ESUB R2, R0, R1 FADD R0, R1, R2 RF R0 R1 ROB R2 R3 HEAD Reservation Stations ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University
Other animations • Another good animation of reorder buffers is the one by John Kubiatowicz. See www.cs.ccu.edu.tw/~chen/arch/reorder-step.ppt or www.cs.uit.no/studier/kurs/d241/info/2002h/notes/Berkeley/ Kubiatowicz-2001f/files/lectures/lec19-memory.ppt. • A higher-level visualization of the process is at http://www.ece.lsu.edu/koppel/see/ ECE 463/521, Profs. Conte, Rotenberg, & Gehringer, Dept. of ECE,NC State University