basic processing unit
DESCRIPTION
TRANSCRIPT
![Page 1: Basic Processing Unit](https://reader033.vdocument.in/reader033/viewer/2022061212/5495df69b479596f4d8b4df9/html5/thumbnails/1.jpg)
Basic Processing Unit
V.SaranyaAP/CSE
Sri Vidya College of Engineering and Technology,
Virudhunagar
![Page 2: Basic Processing Unit](https://reader033.vdocument.in/reader033/viewer/2022061212/5495df69b479596f4d8b4df9/html5/thumbnails/2.jpg)
Objective
Execution of Instructions.Single Bus Organization of the Processor.Multiple Bus Organization of the Processors.
![Page 3: Basic Processing Unit](https://reader033.vdocument.in/reader033/viewer/2022061212/5495df69b479596f4d8b4df9/html5/thumbnails/3.jpg)
Some Fundamental Concepts
Processor (CPU): the active part of the computer, which does all the work (data manipulation and decision-making).
Datapath: portion of the processor which contains hardware necessary to perform all operations required by the computer (the brawn).
Control: portion of the processor (also in hardware) which tells the data path what needs to be done (the brain).
![Page 4: Basic Processing Unit](https://reader033.vdocument.in/reader033/viewer/2022061212/5495df69b479596f4d8b4df9/html5/thumbnails/4.jpg)
InstructionFetch
InstructionDecode
OperandFetch
Execute
ResultStore
NextInstruction
Instruction execution cycle: fetch, decode, execute. Fetch: fetch next
instruction (using PC) from memory into IR.
Decode: decode the instruction.
Execute: execute instruction.
![Page 5: Basic Processing Unit](https://reader033.vdocument.in/reader033/viewer/2022061212/5495df69b479596f4d8b4df9/html5/thumbnails/5.jpg)
Fetch
Fetch: Fetch next instruction into IR (Instruction Register).Assume each word is 4 bytes and each
instruction is stored in a word, and that the memory is byte addressable.
PC (Program Counter) contains address of next instruction.
IR [[PC]]PC [PC] + 4
![Page 6: Basic Processing Unit](https://reader033.vdocument.in/reader033/viewer/2022061212/5495df69b479596f4d8b4df9/html5/thumbnails/6.jpg)
Single Bus Organization
Data line
Address line
PC
MAR
MDR
Y
Internal processor bus
Memory bus
Z
MUX
A
ALU
B
Constant 4
Select
AddSub
XOR
:ALU control lines
Carry-in
IR
RO
R(n–1)
::
TEMP
Instruction decoder and control logic
. . .
Control signals
![Page 7: Basic Processing Unit](https://reader033.vdocument.in/reader033/viewer/2022061212/5495df69b479596f4d8b4df9/html5/thumbnails/7.jpg)
Instruction Execution An instruction can be executed by performing one
or more of the following operations in some specified sequence: Transfer a word of data from one register to
another or to the ALU (Arithmetic Logic Unit). Perform an arithmetic or a logic operation and
store the result in a register. Fetch the contents of a given memory location
and load them into a register. Store a word of data from a register into a given
memory location.
![Page 8: Basic Processing Unit](https://reader033.vdocument.in/reader033/viewer/2022061212/5495df69b479596f4d8b4df9/html5/thumbnails/8.jpg)
Register Transfer Register to register transfer:
For each register Ri, two control signals:Riin used to load the data on the bus into the
register.Riout to place the register’s contents on the
bus. Example: To transfer contents of R1 to R4:
Set R1out to 1. This places contents of R1 on the bus.
Set R4in to 1. This loads data from the processor bus into R4.
![Page 9: Basic Processing Unit](https://reader033.vdocument.in/reader033/viewer/2022061212/5495df69b479596f4d8b4df9/html5/thumbnails/9.jpg)
Register Transfer (2)
Y
Internal processor bus
Z
MUX
A
ALU
B
Constant 4
Select
Ri
X
Ri in
X
Ri out
Y in
X
X
Z in
Z out
X
![Page 10: Basic Processing Unit](https://reader033.vdocument.in/reader033/viewer/2022061212/5495df69b479596f4d8b4df9/html5/thumbnails/10.jpg)
Arithmetic/Logic Operation
ALU: Performs arithmetic and logic operations on its A and B inputs.
To perform R3 [R1] + [R2]:1. R1out, Yin
2. R2out, SelectY, Add, Zin
3. Zout, R3in
Y
Internal processor bus
Z
MUX
A
ALU
B
Constant 4
Select
Ri
X
Ri in
X
Ri out
Y in
X
X
Z in
Z out
X
![Page 11: Basic Processing Unit](https://reader033.vdocument.in/reader033/viewer/2022061212/5495df69b479596f4d8b4df9/html5/thumbnails/11.jpg)
Arithmetic/Logic Operation (2) If there are n operations, do we need n ALU
control lines? We could use encoding, which requires log2 n
control lines for n operations. However, this will increase complexity and hardware (additional decoder needed).
A
ALU
BAdd
Sub
XOR
:ALU control lines
Carry-in
![Page 12: Basic Processing Unit](https://reader033.vdocument.in/reader033/viewer/2022061212/5495df69b479596f4d8b4df9/html5/thumbnails/12.jpg)
Reading a Word from Memory Move R3, (R2) /* R2 [[R1]]
1. MAR [R2]2. Start a Read operation on the memory bus3. Wait for the MFC response from the memory4. Load MDR from the memory bus5. R3 [MDR]
MDR has four control signals: MDRin, MDRout, MDRinE and MDRoutE
Memory-bus data lines
MDR
X
MDR inE
X
MDR outE
Internal processor bus
X
MDR in
X
MDR out
Control Signals…R2out, MARin, Read.WMFCMDRout, R3in
MOVE R3, (R2)
![Page 13: Basic Processing Unit](https://reader033.vdocument.in/reader033/viewer/2022061212/5495df69b479596f4d8b4df9/html5/thumbnails/13.jpg)
Reading a Word from Memory (2) Move (R1), R2 /* R2 [[R1]] Sequence of control steps:
1. R1out, MARin, Read
2. R2out, MDRinE, WMFC
3. MDRout, R2in
WMFC: Wait for arrival of MFC (Memory-Function-Completed) signal.
MFC: To accommodate variability in response time, the processor waits until it receives an indication that the Read/Write operation has been completed. The addressed device sets MFC to 1 to indicate this.
![Page 14: Basic Processing Unit](https://reader033.vdocument.in/reader033/viewer/2022061212/5495df69b479596f4d8b4df9/html5/thumbnails/14.jpg)
Storing a Word in Memory
Move R2, (R1) /* [R1] [R2]Sequence of control steps:
1.R1out, MARin
2.R2out, MDRin, Write
3.MDRoutE, WMFC
4.R1in.
![Page 15: Basic Processing Unit](https://reader033.vdocument.in/reader033/viewer/2022061212/5495df69b479596f4d8b4df9/html5/thumbnails/15.jpg)
• MOVE (R2), R1.
• MAR [R2]• MDR [R1]
R2out, MARin,R1out, MDRin, WriteWMFCMDRout, R2in
Example 2
![Page 16: Basic Processing Unit](https://reader033.vdocument.in/reader033/viewer/2022061212/5495df69b479596f4d8b4df9/html5/thumbnails/16.jpg)
Executing a Complete Instruction Add (R3), R1 /* R1 [R1] + [[R3]] Adds the contents of a memory location pointed
to by R3 to register R1. Sequence of control steps:
1. PCout, MARin, Read, Select4, Add, Zin
2. Zout, PCin, Yin, WMFC
3. MDRout, IRin
4. R3out, MARin, Read
5. R1out, Yin, WMFC
6. MDRout, SelectY, Add, Zin
7. Zout, R1in, End
Steps 1 – 3: Instruction fetch
![Page 17: Basic Processing Unit](https://reader033.vdocument.in/reader033/viewer/2022061212/5495df69b479596f4d8b4df9/html5/thumbnails/17.jpg)
Multiple-Bus Organization Single-bus structure: Control sequences are long as
only one data item can be transferred over the bus in a clock cycle.
Figure on next slide shows a three-bus structure. All registers are combined into a single block called
register file with three ports: 2 outputs allowing 2 registers to be accessed simultaneously and have their contents put on buses A and B, and 1 input allowing data on bus C to be loaded into a third register.
Buses A and B are used to transfer source operands to the A and B inputs of ALU, and result transferred to destination over bus C.
![Page 18: Basic Processing Unit](https://reader033.vdocument.in/reader033/viewer/2022061212/5495df69b479596f4d8b4df9/html5/thumbnails/18.jpg)
Multiple-Bus Organization (2)Bus C
Constant 4
Bus A Bus B
PC
Register file
MU
X
Incrementer
AALU
B
R
Address line
Memory bus data lines
Bus CBus A Bus B
MAR
MDR
IR
Instruction decoder
Processor: Datapath and Control
![Page 19: Basic Processing Unit](https://reader033.vdocument.in/reader033/viewer/2022061212/5495df69b479596f4d8b4df9/html5/thumbnails/19.jpg)
Multiple-Bus Organization (3)
For the ALU, R=A (or R=B) means that its A (or B) input is passed unmodified to bus C.
Add R4, R5, R6 /* R6 [R4] + [R5] Adds the contents of R4 and R5 to R6.
Sequence of control steps:1. PCout, R=B, MARin, Read, IncPC
2. WMFC3. MDRoutB, R=B, IRin
4. R4outA, R5outB, SelectA, Add, R6in, End