Riyadh Philanthropic Society For Science Prince Sultan College For Woman
description
Transcript of Riyadh Philanthropic Society For Science Prince Sultan College For Woman
![Page 1: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/1.jpg)
Riyadh Philanthropic Society For Science
Prince Sultan College For WomanDept. of Computer & Information Sciences
CS 251Introduction to Computer Organization
& Assembly Language
Lecture 3(Computer System Organization)
Processors
![Page 2: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/2.jpg)
Processors 2
From text book: 2.1, 2.1.1, 2.1.2
The Von Neumann Machine
CPU Organization
Instruction Execution
Timing
Control Unit
CISC vs. RISC
Design Principles for modern Computers
Outline
![Page 3: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/3.jpg)
The Von-Neumann Machine
3Processors
The first version of modern computer designed by John Von-Neumann
It is the basis for the majority of digital computer designs
Its main features are:
Using binary arithmetic
Representing the program in a digital form inside the computer’s memory
Organizing the steps of the computer operation into a cycle of decode-fetch-
execute.
![Page 4: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/4.jpg)
Central Processing Unit (CPU)
4Processors
It is the brain of the computer
Its function is to execute programs stored in main memory by fetching instructions, decoding them, and executing them.
CPU
Main Memory
(IOP) O-DI-D
RegistersControl UnitALU
It consists of 3 main components
Arithmetic Logic Unit (ALU)
Control Unit
Registers
![Page 5: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/5.jpg)
CPU – Internal Components
5Processors
Internal components of the CPU:
I. ALU: Arithmetic & Logic Unit responsible for manipulating data
II. Control Unit: Directs the flow of information. It controls where every bit of data goes
III. Registers: High speed memory locations used to store temporary results & certain control information
CPU
MARControl
Unit
MDR
PC
IR
R0
R1
:::
Rn-1
ALU
Registers
![Page 6: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/6.jpg)
Processors 6
CPU – Data path
(A) (B)
ALU
A + B)
A + B
A
B
Registers
ALU input register
ALU output register
ALU input bus
![Page 7: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/7.jpg)
Processors 7
The figure corresponds to the data path of a typical Von-Neumann machine
Not all designs have the input registers A & B or the output register.
It consists of:
Registers (Typically 1 to 32)
ALU
Several busses connecting the pieces
CPU – Data path (Cont.)
![Page 8: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/8.jpg)
Processors 8
1. The registers feed into the ALU input registers A & B
2. The input registers hold the input data while the ALU does the execution
3. The ALU performs simple operations such as addition, subtraction, and Boolean
logic on its inputs
4. The output value is fed into the ALU output register
5. The result is then stored in one of the registers in the register stack
6. The value of the register could be then saved in memory if required
7. The cycle repeats a gain for any other operation in the ALU
CPU – Data path Flow Sequence
![Page 9: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/9.jpg)
Processors 9
CPU – Data path Features
The data path is very important in all machines
Not all machines have the input registers A & B or the output register
The process of running two operands through the ALU and storing the result is
called the data path cycle.
The faster the data path cycle is, the faster the machine runs.
![Page 10: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/10.jpg)
Processors 10
CPU – Data path Instructions
Most instructions can be divided into one of the two categories:
Register – Register Instructions:
Involve instructions between registers
Register – memory Instructions:
Allow memory words to be fetched into registers, where they can be used as ALU
inputs in subsequent instructions.
Allow registers to be stored back into memory.
![Page 11: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/11.jpg)
Processors 11
Machine Instruction Format• A machine instruction has two parts:
•Opcode• Operands
Specify the type of operation Immediate data or address
Opcode Operand 1 Operand 2
16 bits
4 bits 6 bits 6 bits
![Page 12: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/12.jpg)
Processors 12
CPU – Registers There are three main registers in a typical ALU:
Program Counter Register (PC):
It holds the address of the next instruction to be fetched for execution
Instruction Register (IR):
It holds the instruction currently being executed
Accumulator Register (AC):
It accumulates arithmetic results
![Page 13: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/13.jpg)
Processors 13
Instruction Cycle
The processing required for an instruction is called an instruction cycle.
Instruction cycle = fetch-decode-execute cycle
The program is executed one instruction at a time.
The execution of the program is nothing more than a repeated sequence of
fetching, decoding, & executing individual instructions, until the program executes a
Halt or until a fetal error occurs
![Page 14: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/14.jpg)
Processors 14
Instruction Execution
Obtain instruction from program storageInstruction
Fetch
Instruction Decode
Operand fetch
Execute
Result Store
Next Instruction
Determine required actions
Locate and obtain operand data
Compute result value and status
Deposit result in storage
Determine successor instruction
![Page 15: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/15.jpg)
Processors 15
1. Fetch the next instruction from memory into the instruction register
2. Change the program counter to point to the following instruction
3. Determine the type of instruction just fetched
4. If the instruction uses a word in memory, determine where it is.
5. Fetch the word, if needed, into the CPU register
6. Execute the instruction
7. Go to step 1 to begin executing the following instruction
Instruction Cycle – In details
![Page 16: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/16.jpg)
Processors 16
ExampleMain Memory
979899100101
357358359
25
Load contents of 100 into AC
Add contents of 101 to AC
Store contents of AC to 100
360361
Program code
void main(void){ : : a = 2; b = 5; a = a + b;}
![Page 17: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/17.jpg)
Processors 17
ExampleMain Memory
979899100101
357358359
25
Load contents of 100 into AC
Add contents of 101 to AC
Store contents of AC to 100
360361
357
Start
PC
AC
IR
![Page 18: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/18.jpg)
Processors 18
ExampleCPU
PC
AC
IR
Main Memory
979899100101
357358359
25
Load contents of 100 into AC
Add contents of 101 to AC
Store contents of AC to 100
360361
Fetch
357
Fetch
Load 100 in AC
358
2
A register
![Page 19: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/19.jpg)
Processors 19
ExampleCPU
Load 100 in AC
PC
AC
IR
Main Memory
979899100101
357358359
25
Load contents of 100 into AC
Add contents of 101 to AC
Store contents of AC to 100
360361
Execute
358
Execute
2
2
A register
![Page 20: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/20.jpg)
Processors 20
ExampleCPU
2
Load 100 in AC
PC
AC
IR
Main Memory
979899100101
357358359
25
Load contents of 100 into AC
Add contents of 101 to AC
Store contents of AC to 100
360361
Fetch
358
Fetch
Add 101 to AC
359
5
A register
![Page 21: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/21.jpg)
Processors 21
ExampleCPU
Add 101 to AC
PC
AC
IR
Main Memory
979899100101
357358359
25
Load contents of 100 into AC
Add contents of 101 to AC
Store contents of AC to 100
360361
Execute
359
Execute
2 + 5 = 7
5
A register
![Page 22: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/22.jpg)
Processors 22
ExampleCPU
2 + 5 = 7
Add 101 to AC
PC
AC
IR
Main Memory
979899100101
357358359
25
Load contents of 100 into AC
Add contents of 101 to AC
Store contents of AC to 100
360361
Fetch
359
Fetch
Store AC in 100
![Page 23: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/23.jpg)
Processors 23
ExampleCPU
7
Store AC in 100
PC
AC
IR
Main Memory
979899100101
357358359
25
Load contents of 100 into AC
Add contents of 101 to AC
Store contents of AC to 100
360361
Execute
359
Execute
7
![Page 24: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/24.jpg)
Processors 24
ExampleCPU
7
Store AC in 100
PC
AC
IR
Main Memory
979899100101
357358359
75
Load contents of 100 into AC
Add contents of 101 to AC
Store contents of AC to 100
360361
Halt
359
![Page 25: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/25.jpg)
Processors 25
Instruction Execution Can we run a program that imitate the function of the CPU?
Yes, by using an interpreter.
This machine can be much simpler & less expensive than a hardware processor.
A hardware machine should also be provided (in order to run the interpreter)
![Page 26: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/26.jpg)
Processors 26
Timing
Voltage
Time
Train of clock pulses
To ensure that the steps of an instruction are carried out in an orderly fashion a clock circuit controls the processor by generating a train of clock pulses.
![Page 27: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/27.jpg)
Processors 27
Timing (Cont.) The time interval between two pulses is known as a clock period
The clock rate or speed corresponds to the number of pulses per second,
measured in Mega Hertz (MHz). 1 MHz = 1 million cycles per second
The computer circuits perform an operation on the clock pulse
Each step in the instruction execution cycle requires one or more clock periods
If the clock circuit is sped up, the processor could be made to operate faster.
However, each processor has a rated maximum clock speed over which it can’t
operate properly
![Page 28: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/28.jpg)
Processors 28
The control unit of the microprocessor is the one responsible for controlling the
sequencing of events needed for the execution of an instruction, as well as the
timing of this sequence of events.
It obtains instructions from memory in the proper order, and sends them to IR.
Decode them, and issue the necessary timing and control signals to all other
devices so that the instructions can be executed correctly.
The control unit is complemented by a clock or timing generator that helps it
trigger the occurrence of each event at the correct point in time.
Control Unit (CU)
![Page 29: Riyadh Philanthropic Society For Science Prince Sultan College For Woman](https://reader034.fdocuments.net/reader034/viewer/2022051821/56816380550346895dd46181/html5/thumbnails/29.jpg)
Processors 29
There are two major types of control organization:
Hardwired control
Microprogrammed control
RISC vs. CISC
This control determines the instruction set of the computer and it is mainly split
into two main categories:
RISC: (Reduced Instruction Set Computer)
CISC: (Complex Instruction set Computer)