C5 BasicOperationalConcepts 2 COA
C5 BasicOperationalConcepts 2 COA
Recap
• Hierarchical nature of a computer
• Structure of a computer
• Function of a computer
• Internal of a single processor system
• Contemporary computers with multiple processors
• History of computers
• Computer organization- computer architecture
• Computer types
• Layered view of a computer system
• Computer as a multilevel machine
• Microarchitecture level
• Course content
2
04-09-2023
Functional Units
• Input Unit
• Memory Unit
• Arithmetic and Logic Unit (ALU)
• Output Unit
• Control Unit
I/O Processor
3
Data path or bus
Execution of an Instruction
• Execution of an instruction requires to perform several steps
– Instruction is fetched from memory into processor
– If the instruction include operands, then the operands are fetched
– If an instruction is for arithmetic operation, perform that operation on the
fetched operands and store the results in destination location
Operational Details
Memory
MAR MDR
Control
PC R0 Unit
R1
IR
ALU
Rn-1
Registers in Processor
• General purpose registers
– Hold the operands or address of the operand
– Typically 16 to 32
• IR (Instruction Register)
– Holds the instruction currently being executed
• PC (Program Counter)
– Holds the memory address of the next instruction to be fetched and execured
• MAR (Memory Address Register)
– Holds the address of the memory location to be accessed
• MDR (Memory Data Register)
– Holds the data to be written into or read out of the addressed location
Execution of an Instruction, IN
PC LOC 101
Memory
IR IN PORTA, LOCA LOC 0
MAR LOC 101
ALU
10
04-09-2023
Execution of an Instruction, IN
PC LOC 101
Memory
IR IN PORTA, LOCA LOC 0
MAR LOCA
MDR 5 • Decode
LOC 101 IN PORTA, LOCA
R0 LOC 102 IN PORTA, LOCB
R1 • Execution
LOC 103 LOAD LOCA, R0
n general LOC 104 ADDM LOCB, R0
purpose
LOC 105 STORE R0, LOCC
registers
LOC 106 OUT PORTB
Rn-1
ALU
11
Execution of an Instruction, IN
PC LOC 102
Memory
IR IN PORTA, LOCA LOC 0
MAR LOCA
MDR 5 • Decode
LOC 101 IN PORTA, LOCA
R0 LOC 102 IN PORTA, LOCB
R1 • Execution
LOC 103 LOAD LOCA, R0
n general LOC 104 ADDM LOCB, R0
purpose
LOC 105 STORE R0, LOCC
registers
LOC 106 OUT PORTB
Rn-1
ALU
12
04-09-2023
Execution of an Instruction, IN
PC LOC 103
Memory
IR IN PORTA, LOCB LOC 0
MAR LOCB
MDR 4 • Decode
LOC 101 IN PORTA, LOCA
R0 LOC 102 IN PORTA, LOCB
R1 • Execution
LOC 103 LOAD LOCA, R0
n general LOC 104 ADDM LOCB, R0
purpose
LOC 105 STORE R0, LOCC
registers
LOC 106 OUT PORTB
Rn-1
ALU
13
ALU
14
04-09-2023
MDR 05 • Fetch
LOC 101 IN PORTA, LOCA
R0 LOC 102 IN PORTA, LOCB
R1 • Decode
LOC 103 LOAD LOCA, R0
n general LOC 104 ADDM LOCB, R0
purpose • Execution
LOC 105 STORE R0, LOCC
registers
LOC 106 OUT PORTB
Rn-1
ALU
15
MDR 05 • Fetch
LOC 101 IN PORTA, LOCA
R0 05 LOC 102 IN PORTA, LOCB
R1 • Decode
LOC 103 LOAD LOCA, R0
n general LOC 104 ADDM LOCB, R0
purpose • Execution
LOC 105 STORE R0, LOCC
registers
LOC 106 OUT PORTB
Rn-1
Control MDR_OUT
R0_IN LOCA 05
Unit
LOCB 04
Processor LOCC
ALU
16
04-09-2023
ALU
17
MDR 04
LOC 101 IN PORTA, LOCA
R0 05
09 LOC 102 IN PORTA, LOCB
R1 LOC 103 LOAD LOCA, R0
n general LOC 104 ADDM LOCB, R0
purpose
LOC 105 STORE R0, LOCC
registers
LOC 106 OUT PORTB
Rn-1
Control Read
Add LOCA 05
Unit
LOCB 04
Processor LOCC
ALU 05 +04 = 09
18
04-09-2023
To Summarize
• Functional units
19
Functional Units
• Suitable connection between the functional units
• Functional units handle one full word of information
– All the bits in a word are transferred in parallel over
many wires, lines
– One bit per line
• Bus: group of lines that serve as a connecting path
I/O Processor
20
Data path or bus
04-09-2023
Bus Structures
I/O Processor
21
Data path or bus
Bus Structures
• Devices connected to a bus vary widely in speed of operation
– Keyboards and printers are relatively slow
Electromechanical devices
– Memory and processor are faster
Operate at electronics speed
Buffer registers
- Every device to hold the information during transfers
- Transfer of a character from processor to a printer
- Transferred over a bus to the printer buffer
- Printer can print without further intervention of the bus and the processor
22
04-09-2023
System Software
• For executing an application program, some system software must
already be in memory and executing
• Program that reads numbers stored in a file on disk, sorts the
number in ascending order and displays the sorted list on the screen
- Write a program in high level language using some text editor
- Save the program onto disk in a file
- Translate the program written in high level language into machine language
program
- Linking a user written program with the standard library which the program is
using
- Running the program
- Receiving and interpreting the commands issued for translation, execution etc
- Managing the disk storage to support the file reading operation
- Coordinating the I/O units
23
System Software
• Responsible for the coordination of all activities in a computing
system
• Program that reads numbers stored in a file on disk, sorts the
number in ascending order and displays the sorted list on the screen
- Text editor
- Command prompt – Operating system
- Compiler
- Linker and loader
- Operating system
- …..
• Operating system
– Large program, collection of routines
– Control the sharing and interaction of various computer units
– Assigning resources to individual application programs 24
04-09-2023
Performance of a Processor
• How quickly programs can be executed
• Good performance
- Hardware
- Machine instruction set
- Compiler
25
Performance of a Processor
• Elapsed time
- Total time required to execute a program
- Measure of entire computer system
- Affected by the speed of the processor, disk and peripherals like
printers
• Processor time
- Performance of the processor
- Periods during which the processor is active
- Depends on the hardware involved in the execution of individual
machine instruction
Processor and memory
26
04-09-2023
Processor Clock
• Timing signal that controls the processor circuit
• Periodic signal
- Regular time intervals- clock cycles
• Execution of an instruction
- Divide into a sequence of basic steps
- Each basic step can be completed in one clock cycle
• Length of one clock cycle: P
- Clock rate 𝑅 = ⁄ cycles per second
- Hertz (Hz), Mega (M) Hz-Million, Giga (G) Hz-Billion
500 million cycles per second-500 MHz
o 2 nanoseconds (ns)
1250 million cycles per second—1.25 GHz
o 0.8 ns
27
High Performance
𝑁x𝑆
𝑇=
𝑅
• Reduce the value of T
- Reduce N and S
- Increase R
• Reduction in N – complexity of instruction increases
- S increases
• Increasing R-using higher frequency clock
– Time to complete a basic execution step reduces
• N,S, and R are not independent parameters
– Changing one may affect the other
• Attempt to improve performance only by overall reduction of T
31
Instruction 2 IF ID OF EX WB
Instruction 3 IF ID OF EX WB
Instruction N-1 IF ID OF EX WB
Instruction N IF ID OF EX WB 32
04-09-2023
1 2 3 4 5 6 7 8 9 10 11 12 13 14
I1 IF ID OF EX WB
I2 IF ID OF EX WB
I3 IF ID OF EX WB
I4 IF ID OF EX WB
Instruction
I5 IF ID OF EX WB
I6 IF ID OF EX WB
I7 IF ID OF EX WB
I8 IF ID OF EX WB
I9 IF ID OF EX WB
I10 IF ID OF EX WB
• One instruction completed in every clock cycle from 5th clock cycle
onwards
33
• For the purpose of computing T, the effective value of S is 1
Instruction Pipelining
Clock cycle
1 2 3 4 5 6 7 8 9 10 11 12 13 14
I1 IF ID OF EX WB
I2 IF ID OF EX WB
I3 IF ID OF EX WB
I4 IF ID OF EX WB
Instruction
I5 IF ID OF EX WB
I6 IF ID OF EX WB
I7 IF ID OF EX WB
I8 IF ID OF EX WB
I9 IF ID OF EX WB
I10 IF ID OF EX WB
• One instruction completed in every clock cycle from 5th clock cycle
onwards
34
• For the purpose of computing T, the effective value of S is 1
04-09-2023
Superscalar Execution
• Multiple instruction pipelines
– Multiple functional units
35
Performance of a Processor
• Good performance
- Compiler
- Machine instruction set
- Hardware
36
04-09-2023
37
• Simple instructions
– Require a small number of basic steps
– A large number of instructions may be needed to perform a given
programming task
– Large value of N and small value of S
• Complex instructions
– Require a large number of steps
– Individual instructions perform complex operations
– Fewer instructions will be needed
– Lower value of N and a larger value of S
39
Compiler
• Translates a high-level language program into a sequence of
machine instructions
Performance of a Processor
• Affected by
– Hardware
– Machine language instructions-instruction set
– Compiler
41
Performance Measurement
• Performance equation
– Conceptual simplicity
– Not easy to measure
• Measuring computer performance using benchmark programs
– Benchmark: Standardised program
• Performance measure: Time it takes to execute a given benchmark
• Use a selection of real application programs to evaluate performance
– System Performance Evaluation Corporation (SPEC) selects and
publishes representative application programs for different application
domains
Range from game playing, compiler and database applications to numerically
intensive programs in astrophysics and quantum chemistry
Performance Measurement
• SPEC rating for a benchmark is given by
43
To Summarize
• Bus structure
• System software
• Performance of a processor
– Basic performance equation
– Factors affecting the performance
• Performance measurement
44
04-09-2023
Thank You
45