Phase 1 – Lecture – 2/25/2013
description
Transcript of Phase 1 – Lecture – 2/25/2013
![Page 1: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/1.jpg)
Phase 1 – Lecture – 2/25/2013
![Page 2: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/2.jpg)
Background
1
![Page 3: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/3.jpg)
Background
2
![Page 4: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/4.jpg)
Design Process
3
1. Identify a problem and define solution requirements2. Break problem into smaller pieces3. Research all possible solutions4. Design all pieces to solution5. Prove functionality of each piece separately6. Integrate all pieces into working unit
![Page 5: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/5.jpg)
Process
4
![Page 6: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/6.jpg)
Research
Determine components used for each individual stage of our Pipelined CPU
Transition components to be used with other team’s stages of our Pipelined CPUWhat are Reg Files?What is Pipelining?
5
![Page 7: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/7.jpg)
Pipelining
6Computer Organization and Design, 4th Ed, D. A. Patterson and J. L. Hennessey
![Page 8: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/8.jpg)
Pipelining Our CPU
Stage Instruction For
IF Instruction fetch from memory
all
ID Instruction decode & register read
Decode for all
EX Execute operation or calculate address
All but j
MEM Access memory operand
lw, sw
WB Write result back to register
lw, R-type
7
![Page 9: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/9.jpg)
Our CPU
8
![Page 10: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/10.jpg)
Front EndThe United States Postal Service
9
![Page 11: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/11.jpg)
Research - Roles Park Lamerton – Lead Engineer Nik Marinov – Intra Team Relations Taylor Foster – Team Worker Kelle McCan – Wiki Specialist Melissa Allee - Historian
10
![Page 12: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/12.jpg)
Research - Timeline
11
![Page 13: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/13.jpg)
Front End
Collect the mail. Fetch instruction from memory.
Sort the mail. Decode instruction. Distribute data to desired locations.
Process replies. Write back to destination register.
Front end mimics a mailing service
12
![Page 14: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/14.jpg)
Instruction Fetch
PC tells MEMORY what instruction to fetch.
PC controlled by two multiplexers.
One instruction fetched at a time.
Collecting the Mail
13
![Page 15: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/15.jpg)
Instruction Encoding
OPCODE RS RT RD SHAMT FUNCT
OPCODE RS RT IMMEDIATE (offset, int, bit sequence)
32 26 21 16 0
OPCODE JUMP ADDRESS
32 26 0
32 26 21 16 11 6 0
R-TYPE
I-TYPE
J-TYPE
Types of instructions on the MIPS processor
14
![Page 16: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/16.jpg)
Instruction DecodeSort the mail
Distribute data to proper locations.
Sign or Zero extend immediate value.
Forward register data to execution.
Write back computed results into desired register.
15
![Page 17: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/17.jpg)
Register File Read Data Registers contain
previously written or default values.
Mux forwards data based on the 5-bit register address.
All logic operations are performed on the rising edge of clock.
Sort the mail
16
![Page 18: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/18.jpg)
Register File Write Back Decode write back
address. Wait for control bit. Write data to
destination register. All logic operations are
performed on the falling edge of clock.
Process replies
17
![Page 19: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/19.jpg)
ExecutionThe Executives
18
![Page 20: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/20.jpg)
The Team Michael Bowman – Lead Engineer Laly Vang – Wiki Specialist Matt Goranson – Intra Team Relations Darryle Parker – Intra Team Relations Matthew Horton – Report Compiler Austin O’Neil – Historian
19
![Page 21: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/21.jpg)
Phase 1 Schedule
20
![Page 22: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/22.jpg)
Exposition
Responsible for instruction execution and address calculation
Topics: ALU Branch/Jump
21
![Page 23: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/23.jpg)
22
![Page 24: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/24.jpg)
Branch Logic
Why?
What?
Where?
23
![Page 25: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/25.jpg)
Branch Logic
BEQ
BNE
Opcode Rs Rt Address/Immediate6 bits 5 bits 5 bits 16 bits
0001 00 xxxxx xxxxx xxxx xxxx xxxx
Opcode Rs Rt Address/Immediate6 bits 5 bits 5 bits 16 bits
0001 01 xxxxx xxxxx xxxx xxxx xxxx
24
![Page 26: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/26.jpg)
Branch Logic
Depends on 3 signals Zero BNE Control BEQ Control
PC + 4 is the default case (No branching/jumping)
25
![Page 27: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/27.jpg)
Jump Register
It can take you places…
Opcode Rs Rt Rd Shamt Function
6 bits 5 bits 5 bits 5 bits 5 bits 6 bits
0000 0 xxxxx 00000 00000 00000 001000
R-type
.org 0x1000000
here:lui $t0 0xdeadori $t0 $t0 0xbeefjr $t0nop
26
![Page 28: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/28.jpg)
Jump… and Link Register
Hey! Listen!Go places… and remember where we were (sort of).
Opcode Rs Rt Rd Shamt Function
6 bits 5 bits 5 bits 5 bits 5 bits 6 bits
0000 0 xxxxx 00000 xxxxx 00000 001001
R-type
.org 0x1000000
here:li $t0 joyjalr $ra $t0nop
done:j done
joy:jr $ra
27
![Page 29: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/29.jpg)
Jump and Link Register
Logic Required Jump control signal – allows a jump Jump register control – allows a jump from register New address (register value) – where we’re going Link control signal – pass a linked address to a register
Resultants New PC address – where we’re going PC control signal – allows update of PC Next instruction address (PC+4) for write back – the linked
address
28
![Page 30: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/30.jpg)
Jump
Very much like Jump Register, only we’re jumping to an immediate
But we’re limited. Instructions are 32 bits with the most significant six bits being the operation code. We’ve only got 26 bits to work with, but we can use up to 28. First two bits 0 next 26 bits from the jump address field and upper
four bits from the old PC value
Jump logic Jump Immediate – allows an immediate jump to a new location Value from register – the new address Jump Control – to allow a jump
29
![Page 31: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/31.jpg)
Jump and Link
Similar to JALR but uses the same address scheme used in Jump
Saves address for future use
Jump logic Jump Immediate – allows an immediate jump to a new location Jump Register Control Signal – allows register value to be taken Value from register – the new address Link Control Signal – to pass a linked address to a register
30
![Page 32: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/32.jpg)
ALU Main math unit
31
![Page 33: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/33.jpg)
Exposition: ALU
“Arithmetic and Logic Unit” Performs arithmetic and logical operations. Does any calculations necessary to execute an instruction
32
![Page 34: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/34.jpg)
Encoding
Operation Encoding SubADD 0000 0
SUB 0000 1
SLT 0001 1
SLTU 0010 1
AND 0011 0
NOR 0100 0
OR 0101 0
SRL 0110 0
SLL 0111 0
LUI 1000 0
MULLO 1001 0
MULHI 1010 0
5-bits: 4-bit encoding with extra Sub bit12 Operations
33
![Page 35: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/35.jpg)
Adder/SubtractorOperation Encoding Sub
ADD 0000 0
SUB 0000 1
ADDResult = Op1 + Op2
SUBResult = Op1 - Op2 = Op1 + (!Op2 + 1) = (Op1 +!Op2) + 1
34
![Page 36: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/36.jpg)
SLTEasy
SLTUSimilar, but a caveat
SLT/SLTU
Operation Encoding
Sub
SLT 0001 1
SLTU 0010 1
35
![Page 37: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/37.jpg)
Simple LogicOperation Encoding Sub
AND 0011 0
NOR 0100 0
OR 0101 0
36
![Page 38: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/38.jpg)
Logical ShiftsOperation Encoding Sub
SRL 0110 0
SLL 0111 0
SLL SRL
37
![Page 39: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/39.jpg)
LUIOperation Encoding Sub
LUI 1000 0
38
![Page 40: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/40.jpg)
MULLO/MULHI
Operation Encoding Sub
MULLO 1001 0
MULHI 1010 0
39
![Page 41: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/41.jpg)
ControlsControlling your life, everyday.
40
![Page 42: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/42.jpg)
The Team Kory Teague – Lead Engineer Kyle Lawler – Wiki Specialist Andres Vega – Intra Team Relations Bryan Rogers – Team Worker Michael Oltmanns - Historian
41
![Page 43: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/43.jpg)
Responsibilities Manage the Control Path
All non-hazard control logic Memory Stage Writeback Stage
42
![Page 44: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/44.jpg)
Processor Design
43
![Page 45: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/45.jpg)
Control Signals
44
![Page 46: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/46.jpg)
Declared Signals
45
![Page 47: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/47.jpg)
Signal Definitions
46
![Page 48: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/48.jpg)
X ≡ 0 on all signals except SE, where X ≡ 1Research47
![Page 49: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/49.jpg)
Control Unit Design
48
![Page 50: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/50.jpg)
ALUControl Unit Design
49
![Page 51: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/51.jpg)
MEM and WB Provided Allow for data flow MemRead, MemWrite LW, data first appears in
MEM Requires stall Hazards
Writes to Reg File MemToReg, RegWrite
50
![Page 52: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/52.jpg)
HAZARDSThe Hazarding
51
![Page 53: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/53.jpg)
Team Introduction Spencer Hood – Lead Engineer Jessie Monterroso – Wiki Specialist Zach Smith Max Jeter – Report Compilations Evan Novotny
52
![Page 54: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/54.jpg)
IntroductionOne down side of the pipeline is hazardsIf hazards aren’t properly handled then the processor will behave in unexpected ways and can lower throughput
There are three types of hazards that will be covered in this presentation
53
![Page 55: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/55.jpg)
Types of HazardsData HazardsControl HazardsStructural Hazards
54
![Page 56: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/56.jpg)
Data HazardsRAR (Read after Read)RAW (Read after Write)WAR (Write after Read)WAW (Write after Write)RAW is the only one of the above hazards that effects the MIPS pipeline
Load use
55
![Page 57: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/57.jpg)
Example of RAW HazardADD $t0, $t1, $t2SUB $t3, $t0, $t4
Register $t0 is used in the instruction immediately after it is written to
56
![Page 58: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/58.jpg)
Solution for RAW HazardForwarding
http://cs-alb-pc3.massey.ac.nz/notes/59304/Image168.gif
57
![Page 59: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/59.jpg)
Example of Load use Hazard
lw $t0, 4($t1)addiu $t2, $t0, 0x0badbeefMemory is the fourth stage of the pipeline
58
![Page 60: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/60.jpg)
Solution for Load use Hazard Stall the pipeline
http://upload.wikimedia.org/wikipedia/commons/thumb/d/d0/Data_Forwarding_%28Two_Stage%29.svg/370px-Data_Forwarding_%28Two_Stage%29.svg.png
59
![Page 61: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/61.jpg)
Control HazardsConditional Branching
Branch predictionAssume branch is always takenWhen its not taken flush the pipeline
60
![Page 62: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/62.jpg)
61
![Page 63: Phase 1 – Lecture – 2/25/2013](https://reader036.fdocuments.in/reader036/viewer/2022062305/56815f99550346895dce9e58/html5/thumbnails/63.jpg)
Questions?