Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.
-
date post
22-Dec-2015 -
Category
Documents
-
view
232 -
download
3
Transcript of Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.
![Page 1: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/1.jpg)
Datapath and Control
Andreas KlappeneckerCPSC321 Computer
Architecture
![Page 2: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/2.jpg)
Administrative Issues
Exam has been graded Grades need to be entered by TA
Attendance in the labs Lab 3 assignment Make-up exam T 2:00pm-2:50pm
![Page 3: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/3.jpg)
Goal of this lecture Revisit the single-cycle processor
datapath control Why are the instructions structured in
the way they are? Multi-cycle processor
![Page 4: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/4.jpg)
The Single-Cycle Processor
Revisited
![Page 5: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/5.jpg)
Instruction Word Formats
Register format
Immediate format
Jump format
op-code rs rt rd shamt functop-code rs rt rd shamt funct
op-code rs rt immediate valueop-code rs rt immediate value
op-code 26 bit current segment addressop-code 26 bit current segment address
6 5 5 16
6 5 5 5 5 6
6 26
![Page 6: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/6.jpg)
Hardware components
PC
Instructionmemory
Instructionaddress
Instruction
a. Instruction memory b. Program counter
Add Sum
c. Adder
ALU control
RegWrite
RegistersWriteregister
Readdata 1
Readdata 2
Readregister 1
Readregister 2
Writedata
ALUresult
ALU
Data
Data
Registernumbers
a. Registers b. ALU
Zero5
5
5 3
16 32Sign
extend
b. Sign-extension unit
MemRead
MemWrite
Datamemory
Writedata
Readdata
a. Data memory unit
Address
![Page 7: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/7.jpg)
Datapath for MIPS instructions
Seven control signals
![Page 8: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/8.jpg)
Datapath Each instruction type required
some hardware components Designed the datapaths for the
different instruction types Merged the datapaths
reuse hardware whenever possible use multiplexors to combine
datapaths
![Page 9: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/9.jpg)
R-Format Instructions
Register format
op-code rs rt rd shamt functop-code rs rt rd shamt funct
6 5 5 5 5 6
![Page 10: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/10.jpg)
Datapath for a load and store
1. register access 2. memory access calculation3. read or write from memory4. in the case of a load, write into register file
![Page 11: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/11.jpg)
Datapaths for Instruction Fetch, Memory and R-type Instructions
Note the added multiplexor switching between register 2 and sign-extended immediate value
![Page 12: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/12.jpg)
Control
Selecting the operations to perform (ALU, read/write, etc.) Controlling the flow of data (multiplexor inputs) Information comes from the 32 bits of the instruction Example: add $8, $17, $18 Instruction Format:
000000 10001 10010 01000 00000 100000
op rs rt rd shamt funct
ALU's operation based on instruction type and function code
![Page 13: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/13.jpg)
For example, what should the ALU do with this instruction?
lw $1, 100($2)
35 2 1 100
op rs rt 16 bit offset
Control
![Page 14: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/14.jpg)
ALU Control Logic
ALU cntrl
Function
000 and
001 or
010 add
110 sub
111 slt
Depending on instruction,the ALU has to perform one of the five operations
Why is the control for sub110 and not 011?
![Page 15: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/15.jpg)
ALU Control
Operation2
Operation1
Operation0
Operation
ALUOp1
F3
F2
F1
F0
F (5– 0)
ALUOp0
ALUOp
ALU control block
Instruction ALUOp Instruction Funct field Operationoperation ALUOp1 ALUOp0 Opcode F5 F4 F3 F2 F1 F0lw sw 0 0 lw/sw X X X X X X 010beq 0 1 beq X X X X X X 110add 1 X R-type X X 0 0 0 0 010sub 1 X R-type X X 0 0 1 0 110and 1 X R-type X X 0 1 0 0 000or 1 X R-type X X 0 1 0 1 001slt 1 X R-type X X 1 0 1 0 111
![Page 16: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/16.jpg)
Control
PC
Instructionmemory
Readaddress
Instruction[31– 0]
Instruction [20– 16]
Instruction [25– 21]
Add
Instruction [5– 0]
MemtoReg
ALUOp
MemWrite
RegWrite
MemRead
BranchRegDst
ALUSrc
Instruction [31– 26]
4
16 32Instruction [15– 0]
0
0Mux
0
1
Control
Add ALUresult
Mux
0
1
RegistersWriteregister
Writedata
Readdata 1
Readdata 2
Readregister 1
Readregister 2
Signextend
Shiftleft 2
Mux
1
ALUresult
Zero
Datamemory
Writedata
Readdata
Mux
1
Instruction [15– 11]
ALUcontrol
ALUAddress
![Page 17: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/17.jpg)
Multi-Cycle Processor
![Page 18: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/18.jpg)
Performance Improvement Fixed cycle time
obviously inefficient Variable cycle time
faster timing more complex
Multiple Clock Cycles break up instructions into one-cycle steps balance amount of work to be done restrict each cycle to use only one major
functional unit store values at end of cycle for use in later cycles
![Page 19: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/19.jpg)
Reuse functional units ALU used to compute address and to increment
PC Memory used for instruction and data
Control signals not just determined by instruction additional complexity is introduced here
Finite state machine can be used for control
Multicycle Approach
![Page 20: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/20.jpg)
Multicycle Datapath
PC
Memory
Address
Instructionor data
Data
Instructionregister
Registers
Register #
Data
Register #
Register #
ALU
Memorydata
register
A
B
ALUOut
![Page 21: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/21.jpg)
Outlook
Discuss the details of the datapath Instruction fetch/decode/execute
cycle Construct the finite state machine
for control More complicated processors: Use
microprogramming to simplify control
![Page 22: Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.](https://reader035.fdocuments.in/reader035/viewer/2022062308/56649d785503460f94a5a24a/html5/thumbnails/22.jpg)
Finite state machines: a set of states and next state function (determined by current state + input) output function (determined by current state + input)
Moore machine (output based only on current state)
Finite State Machines
Next-statefunction
Current state
Clock
Outputfunction
Nextstate
Outputs
Inputs