Title: Scoreboarding
1Scoreboarding
- The following four steps replace ID, EX and WB
steps - ID Issue if a functional unit for instruction
is free and no other active instruction has the
same destination register (WAW) it can proceed,
otherwise it stalls - ID Read operands a source operand is available
if no earlier instruction is going to write it - EX Execute once the execution is complete this
stage notifies the scoreboard - WB Write results scoreboard checks for WAR
hazards and may stall write back
2Scoreboarding
- Operands are always read from register file no
advantage is taken of forwarding - This is no large penalty as write occurs
immediately after the execution and not after MEM
stage - Read operand and write result stages cannot
overlap so we have 1 cycle latency
3Time 1
Issue first load
Instruction status
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
L.D F2, 45(R3)
MUL.D F0, F2, F4
SUB.D F8, F6, F2
DIV.D F10, F0, F6
ADD.D F6, F8, F2
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
Yes
Load
F6
R2
Yes
FP Mult1
FP Mult2
FP Add
FP Div
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Integer
4Time 2
First load reads operands
Second load cannot be issued due to structural
hazard
Instruction status
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
L.D F2, 45(R3)
MUL.D F0, F2, F4
SUB.D F8, F6, F2
DIV.D F10, F0, F6
ADD.D F6, F8, F2
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
Yes
Load
F6
R2
Yes
No
FP Mult1
FP Mult2
FP Add
FP Div
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Integer
5Time 3
First load completes execution
Second load cannot be issued due to structural
hazard
Instruction status
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
L.D F2, 45(R3)
MUL.D F0, F2, F4
SUB.D F8, F6, F2
DIV.D F10, F0, F6
ADD.D F6, F8, F2
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
Yes
Load
F6
R2
No
FP Mult1
FP Mult2
FP Add
FP Div
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Integer
6Time 4
First load writes the result and frees ALU
Second load cannot be issued due to structural
hazard
Instruction status
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
?
L.D F2, 45(R3)
MUL.D F0, F2, F4
SUB.D F8, F6, F2
DIV.D F10, F0, F6
ADD.D F6, F8, F2
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
Yes
Load
F6
R2
No
FP Mult1
FP Mult2
FP Add
FP Div
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Integer
7Time 5
Second load is issued
Instruction status
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
?
L.D F2, 45(R3)
?
MUL.D F0, F2, F4
SUB.D F8, F6, F2
DIV.D F10, F0, F6
ADD.D F6, F8, F2
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
Yes
Load
F2
R3
Yes
FP Mult1
FP Mult2
FP Add
FP Div
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Integer
8Time 6
Second load reads operands
Mult is issued
Instruction status
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
?
L.D F2, 45(R3)
?
?
MUL.D F0, F2, F4
?
SUB.D F8, F6, F2
DIV.D F10, F0, F6
ADD.D F6, F8, F2
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
Yes
Load
F2
R3
Yes
No
FP Mult1
No
Yes
Integer
Yes
Mult
F0
F2
F4
FP Mult2
FP Add
FP Div
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Integer
Mult1
9Time 7
Second load completes execution
Mult is stalled waiting for F2
Instruction status
Sub is issued
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
?
L.D F2, 45(R3)
?
?
?
MUL.D F0, F2, F4
?
SUB.D F8, F6, F2
?
DIV.D F10, F0, F6
ADD.D F6, F8, F2
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
Yes
Load
F2
R3
No
FP Mult1
No
Yes
Integer
Yes
Mult
F0
F2
F4
FP Mult2
FP Add
Yes
Integer
No
Sub
F8
F6
F2
Yes
FP Div
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Add
Integer
Mult1
10Time 8
Second load writes result
Mult is stalled waiting for F2
Sub is stalled waiting for F2
Instruction status
Div is issued
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
?
L.D F2, 45(R3)
?
?
?
?
MUL.D F0, F2, F4
?
SUB.D F8, F6, F2
?
DIV.D F10, F0, F6
?
ADD.D F6, F8, F2
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
Yes
Load
F2
R3
No
FP Mult1
No
Yes
Yes
Integer
Yes
Mult
F0
F2
F4
FP Mult2
FP Add
Yes
Integer
No
Sub
F8
F6
F2
Yes
Yes
FP Div
Div
F10
F0
Yes
Mult1
Yes
F6
No
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Mult1
Add
Divide
Integer
11Time 9
Mult reads operands
Sub reads operands
Div is stalled waiting for F0
Instruction status
Add cannot be issueddue to structural hazard
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
?
L.D F2, 45(R3)
?
?
?
?
MUL.D F0, F2, F4
?
?
SUB.D F8, F6, F2
?
?
DIV.D F10, F0, F6
?
ADD.D F6, F8, F2
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
Yes
Yes
FP Mult1
No
No
Yes
Mult
F0
F2
F4
FP Mult2
FP Add
Yes
No
Yes
Yes
Sub
F8
F6
F2
No
FP Div
Div
F10
F0
Yes
Mult1
Yes
F6
No
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Mult1
Add
Divide
12Time 10
Mult in execution (1 out of 10)
Sub in execution (1 out of 2)
Div is stalled waiting for F0
Instruction status
Add cannot be issueddue to structural hazard
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
?
L.D F2, 45(R3)
?
?
?
?
MUL.D F0, F2, F4
?
?
10
SUB.D F8, F6, F2
10
?
?
DIV.D F10, F0, F6
?
ADD.D F6, F8, F2
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
FP Mult1
No
No
Yes
Mult
F0
F2
F4
FP Mult2
FP Add
Yes
No
Sub
F8
F6
F2
No
FP Div
Div
F10
F0
Yes
Mult1
Yes
F6
No
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Mult1
Add
Divide
13Time 11
Mult in execution (2 out of 10)
Sub completes execution
Div is stalled waiting for F0
Instruction status
Add cannot be issueddue to structural hazard
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
?
L.D F2, 45(R3)
?
?
?
?
MUL.D F0, F2, F4
?
?
10
SUB.D F8, F6, F2
10
?
?
?
DIV.D F10, F0, F6
?
ADD.D F6, F8, F2
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
FP Mult1
No
No
Yes
Mult
F0
F2
F4
FP Mult2
FP Add
Yes
No
Sub
F8
F6
F2
No
FP Div
Div
F10
F0
Yes
Mult1
Yes
F6
No
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Mult1
Add
Divide
14Time 12
Mult in execution (3 out of 10)
Sub writes result, frees adder
Div is stalled waiting for F0
Instruction status
Add cannot be issueddue to structural hazard
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
?
L.D F2, 45(R3)
?
?
?
?
MUL.D F0, F2, F4
?
?
10
SUB.D F8, F6, F2
?
?
?
?
DIV.D F10, F0, F6
?
ADD.D F6, F8, F2
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
FP Mult1
No
No
Yes
Mult
F0
F2
F4
FP Mult2
FP Add
Yes
No
Sub
F8
F6
F2
No
FP Div
Div
F10
F0
Yes
Mult1
Yes
F6
No
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Mult1
Divide
Add
15Time 13
Add is issued
Mult in execution (4 out of 10)
Div is stalled waiting for F0
Instruction status
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
?
L.D F2, 45(R3)
?
?
?
?
MUL.D F0, F2, F4
?
?
10
SUB.D F8, F6, F2
?
?
?
?
DIV.D F10, F0, F6
?
ADD.D F6, F8, F2
?
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
FP Mult1
No
No
Yes
Mult
F0
F2
F4
FP Mult2
Add
F6
F8
F2
FP Add
Yes
Yes
Yes
FP Div
Div
F10
F0
Yes
Mult1
Yes
F6
No
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Mult1
Add
Divide
16Time 14
Mult in execution (5 out of 10)
Div is stalled waiting for F0
Add reads operands
Instruction status
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
?
L.D F2, 45(R3)
?
?
?
?
MUL.D F0, F2, F4
?
?
10
SUB.D F8, F6, F2
?
?
?
?
DIV.D F10, F0, F6
?
ADD.D F6, F8, F2
?
?
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
FP Mult1
No
No
Yes
Mult
F0
F2
F4
FP Mult2
Add
F6
F8
F2
FP Add
Yes
No
Yes
Yes
No
FP Div
Div
F10
F0
Yes
Mult1
Yes
F6
No
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Mult1
Add
Divide
17Time 15
Mult in execution (6 out of 10)
Div is stalled waiting for F0
Add in execution (1 out of 2)
Instruction status
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
?
L.D F2, 45(R3)
?
?
?
?
MUL.D F0, F2, F4
?
?
10
SUB.D F8, F6, F2
?
?
?
?
DIV.D F10, F0, F6
?
ADD.D F6, F8, F2
?
15
?
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
FP Mult1
No
No
Yes
Mult
F0
F2
F4
FP Mult2
Add
F6
F8
F2
FP Add
Yes
No
No
FP Div
Div
F10
F0
Yes
Mult1
Yes
F6
No
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Mult1
Add
Divide
18Time 16
Mult in execution (7 out of 10)
Div is stalled waiting for F0
Add completes execution
Instruction status
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
?
L.D F2, 45(R3)
?
?
?
?
MUL.D F0, F2, F4
?
?
10
SUB.D F8, F6, F2
?
?
?
?
DIV.D F10, F0, F6
?
ADD.D F6, F8, F2
?
?
15
?
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
FP Mult1
No
No
Yes
Mult
F0
F2
F4
FP Mult2
Add
F6
F8
F2
FP Add
Yes
No
No
FP Div
Div
F10
F0
Yes
Mult1
Yes
F6
No
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Mult1
Add
Divide
19Time 17
Mult in execution (8 out of 10)
Div is stalled waiting for F0
Add is stalled, WAR hazard
Instruction status
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
?
L.D F2, 45(R3)
?
?
?
?
MUL.D F0, F2, F4
?
?
SUB.D F8, F6, F2
?
?
?
?
DIV.D F10, F0, F6
?
ADD.D F6, F8, F2
?
?
?
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
FP Mult1
No
No
Yes
Mult
F0
F2
F4
FP Mult2
Add
F6
F8
F2
FP Add
Yes
No
No
FP Div
Div
F10
F0
Yes
Mult1
Yes
F6
No
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Mult1
Add
Divide
20Time 19
Mult completes execution
Div is stalled waiting for F0
Add is stalled, WAR hazard
Instruction status
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
?
L.D F2, 45(R3)
?
?
?
?
MUL.D F0, F2, F4
?
?
?
SUB.D F8, F6, F2
?
?
?
?
DIV.D F10, F0, F6
?
ADD.D F6, F8, F2
?
?
?
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
FP Mult1
No
No
Yes
Mult
F0
F2
F4
FP Mult2
Add
F6
F8
F2
FP Add
Yes
No
No
FP Div
Div
F10
F0
Yes
Mult1
Yes
F6
No
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Mult1
Add
Divide
21Time 20
Mult writes result
Div is stalled waiting for F0
Add is stalled, WAR hazard
Instruction status
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
?
L.D F2, 45(R3)
?
?
?
?
MUL.D F0, F2, F4
?
?
?
?
SUB.D F8, F6, F2
?
?
?
?
DIV.D F10, F0, F6
?
ADD.D F6, F8, F2
?
?
?
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
FP Mult1
No
No
Yes
Mult
F0
F2
F4
FP Mult2
Add
F6
F8
F2
FP Add
Yes
No
No
FP Div
Div
F10
F0
Yes
Mult1
No
Yes
F6
Yes
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Mult1
Divide
Add
22Time 21
Div reads operands
Add is stalled, WAR hazard
Instruction status
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
?
L.D F2, 45(R3)
?
?
?
?
MUL.D F0, F2, F4
?
?
?
?
SUB.D F8, F6, F2
?
?
?
?
DIV.D F10, F0, F6
?
?
ADD.D F6, F8, F2
?
?
?
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
FP Mult1
FP Mult2
Add
F6
F8
F2
FP Add
Yes
No
No
FP Div
Div
F10
F0
Yes
No
Yes
F6
Yes
No
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Divide
Add
23Time 22
Div in execution (1 out of 40)
Add writes result
Instruction status
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
?
L.D F2, 45(R3)
?
?
?
?
MUL.D F0, F2, F4
?
?
?
?
SUB.D F8, F6, F2
?
?
?
?
DIV.D F10, F0, F6
22
?
?
ADD.D F6, F8, F2
?
?
?
?
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
FP Mult1
FP Mult2
Add
F6
F8
F2
FP Add
Yes
No
No
FP Div
Div
F10
F0
No
Yes
F6
No
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Add
Divide
24Time 61
Div completes execution
Instruction status
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
?
L.D F2, 45(R3)
?
?
?
?
MUL.D F0, F2, F4
?
?
?
?
SUB.D F8, F6, F2
?
?
?
?
DIV.D F10, F0, F6
?
?
?
ADD.D F6, F8, F2
?
?
?
?
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
FP Mult1
FP Mult2
FP Add
FP Div
Div
F10
F0
No
Yes
F6
No
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Divide
25Time 62
Div writes result
Instruction status
Issue Read operands Execution complete
Write result
L.D F6, 34(R2)
?
?
?
?
L.D F2, 45(R3)
?
?
?
?
MUL.D F0, F2, F4
?
?
?
?
SUB.D F8, F6, F2
?
?
?
?
DIV.D F10, F0, F6
?
?
?
?
ADD.D F6, F8, F2
?
?
?
?
Functional unit status
Busy Op Fi Fj Fk
Qj Qk Rj Rk
Integer ALU
FP Mult1
FP Mult2
FP Add
FP Div
Div
F10
F0
No
Yes
F6
No
Register result status
F0 F2 F4 F6
F8 F10 F12
Functional unit
Divide
26Tomasulos Algorithm
- Use reservation stations that will hold operands
for instructions waiting to issue - Reservation station fetches the operand as soon
as it is available - Pending instructions read operands from
reservation stations - When writes overlap in execution, only the last
write actually updates the register
27Tomasulos Algorithm
Frominstruction unit
Common data bus
Instructionqueue
FP registers
LOAD-STOREOPERATIONS
Store buffers
FPOPERATIONS
Load buffers
Address unit
4 3 2 1
4 3 2 1
Reservationstations
Data
Address
Memory unit
FP adders
FP multipliers
28Tomasulos Algorithm
- Each reservation station holds the opcode for the
pending instruction and either operand values or
names of reservation stations that will provide
them - Load and store buffers hold data and addresses
for memory access - Transfer of all data goes over the common data bus
29Homework
- Due Tuesday, October 19 by the end of the class
- Submit either in class (paper) or by E-mail (PS
or PDF only) or bring the paper copy to my office
- Show scheduling of the following code using
scoreboard(assume one integer ALU, two FP
multipliers, one FP adder and one FP divider) - LD F2, 0(R2)
- LD F4, 100(R3)
- ADD F8, F2, F2
- MUL F6, F4, F8
- SUB F6, F2, F4