Computer Architecture – An Introduction
-
Upload
dilum-bandara -
Category
Engineering
-
view
971 -
download
6
description
Transcript of Computer Architecture – An Introduction
![Page 1: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/1.jpg)
Computer Architecture – An Introduction
CS2052 Computer ArchitectureComputer Science & Engineering
University of Moratuwa
Dilum [email protected]
![Page 2: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/2.jpg)
2
From Outside
Input
Output
ProcessorMemoryHard diskDVD ROMGraphics cardEthernet
Source: techwench.com
![Page 3: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/3.jpg)
3
Source: Daniel Zanetti, wikimedia.org
From Outside (Cont.)
Source: Amazon.com
Touch padTouch screenWireless
Screen sizeWeightBattery capacitySD Card slotSensors
![Page 4: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/4.jpg)
4
From Inside
Source: http://rays-place.net
Source: http://news.techgenie.com
![Page 5: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/5.jpg)
5
From Inside (Cont.)
Source: www.laptopaid.comSource: http://techgoesboom.com
![Page 6: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/6.jpg)
6
From Inside (Cont.)
iPhone 6
![Page 7: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/7.jpg)
7
What We Are Going To Study? How these internal components look like?
Top-down approach with schematics How do they fit together? How to program them? How to improve their performance?
![Page 8: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/8.jpg)
8
Very High-Level View of a Computer
CPU – execute instructions Memory – store program & data IO devices – receive inputs & produce outputs Bus – interconnects everything by transferring data
Central Processing Unit (CPU)
Main Memory
Input/output (IO) Devices
System Bus
![Page 9: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/9.jpg)
Blocks of a Microprocessor
9
Program Memory Instruction
Register
STACK Program CounterInstruction
Decoder
Timing, Control, & Register selection
Accumulator
RAM & Data
Registers
ALU
IO
IOFLAG &SpecialPurposeRegisters
Source: Makis Malliris & Sabir Ghauri, UWE
![Page 10: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/10.jpg)
10
Blocks of a Microprocessor (Cont.)
Literal Address
Operation
Program Memory
Instruction Register
STACK Program CounterInstruction
Decoder
Timing, Control and Register selection
Accumulator
RAM & Data
Registers
ALU
IO
IOFLAG &Special
FunctionRegisters
ClockReset Interrupts
Program Execution Section Register Processing Section
Set up Set upModify
Address
Internal data bus
Source: Makis Malliris & Sabir Ghauri, UWE
![Page 11: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/11.jpg)
11
Arithmetic & Logic Unit (ALU) Data processing
unit Arithmetic unit
Performs arithmetic operations
Logic unit Performs logical
operations
Accumulator
Source: Introduction to PIC Microcontroller – Part 1 by Khan Wahid
![Page 12: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/12.jpg)
12
Registers Type of memory located inside CPU Can hold a single piece of data
This data is useful in both data processing & control functionalities
Several types of CPU registers Program Counter (PC) Instruction Register (IR) Accumulator or working register Special purpose registers
Flag register General purpose registers
![Page 13: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/13.jpg)
13
Program Counter (PC)
Used to keep track of memory address of next instruction to be executed
When instructions are fetched, always instruction pointed by PC is fetched into CPU
Once the instruction is fetched, PC is updated to point to next instruction PC = PC + d
![Page 14: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/14.jpg)
14
Instruction Register (IR)
Once fetched, instructions are stored in IR for execution
Located closely to control unit which decodes the instruction
![Page 15: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/15.jpg)
15
Accumulator (A) / Working Register (W)
Results of arithmetic & logical operations always go to accumulator
Connected directly to output of ALU
Source: Introduction to PIC Microcontroller – Part 1 by Khan Wahid
![Page 16: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/16.jpg)
16
FLAG/STATUS Register Individual bits Indicate status of ALU operations
Source: www.plantation-productions.com/Webster/www.artofasm.com/Linux/HTML/RealArithmetic.html
![Page 17: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/17.jpg)
17
Internal Structure
A
E
D
C
B
ALU
Add
ress
Bus
Control Unit
IR
FLAG
ALU
PC
+1
Dat
a B
usC
TR
L B
us
Source : Dr. Chathura de Silva, CSE, UoM
![Page 18: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/18.jpg)
18
Sample Program
100: Load A,10101: Load B,15102: Add A,B103: STORE A,[20]
Load A,10
Load B,15
ADD A,B
STORE A,[20]
100
101
102
103
104
105
Program memory
18
19
20
21
Data memory
00
00
00
00
![Page 19: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/19.jpg)
19
Instruction Execution Sequence
1. Fetch next instruction from memory to IR
2. Change PC to point to next instruction
3. Determine type of instruction just fetched
4. If instruction needs data from memory, determine where it is
5. Fetch data if needed into register
6. Execute instruction
7. Go to step 1 & continue with next instruction
![Page 20: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/20.jpg)
20
Before execution of 1st fetch cycle
A
E
D
C
B
ALU
Add
ress
Bus
Control Unit
IR
FLAG
ALU
100
+1
Dat
a B
usC
TR
L B
us
Source: Dr. Chathura de Silva, CSE, UoM
![Page 21: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/21.jpg)
21
After 1st fetch cycle …
A
E
D
C
B
ALU
Add
ress
Bus
Control Unit
Load A,10
FLAG
ALU
101
+1
Dat
a B
usC
TR
L B
us
![Page 22: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/22.jpg)
22
After 1st instruction cycle …
10
E
D
C
B
ALU
Add
ress
Bus
Control Unit
Load A,10
FLAG
ALU
101
+1
Dat
a B
usC
TR
L B
us
![Page 23: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/23.jpg)
23
Sample Program (Cont.)
100: Load A,10101: Load B,15102: Add A,B
![Page 24: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/24.jpg)
24
After 2nd fetch cycle …
A
E
D
C
B
ALU
Add
ress
Bus
Control Unit
Load B,15
FLAG
ALU
102
+1
Dat
a B
usC
TR
L B
us
![Page 25: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/25.jpg)
25
After 2nd instruction cycle …
10
E
D
C
15
ALU
Add
ress
Bus
Control Unit
Load B,15
FLAG
ALU
102
+1
Dat
a B
usC
TR
L B
us
![Page 26: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/26.jpg)
26
Sample Program (Cont.)
100: Load A,10101: Load B,15102: Add A,B
![Page 27: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/27.jpg)
27
After 3rd fetch cycle …
10
E
D
C
15
ALU
Add
ress
Bus
Control Unit
ADD A,B
FLAG
ALU
103
+1
Dat
a B
usC
TR
L B
us
![Page 28: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/28.jpg)
28
After 3rd instruction cycle …
25
E
D
C
15
ALU
Add
ress
Bus
Control Unit
ADD A,B
FLAG
ALU
103
+1
Dat
a B
usC
TR
L B
us
![Page 29: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/29.jpg)
29
Architectural Differences Length of microprocessors’ data word
4, 8, 16, 32, 64, & 128 bit Speed of instruction execution
Clock rate & processor speed Size of direct addressable memory CPU architecture Instruction set Number & types of registers Support circuits Compatibility with existing software & hardware
development systems
![Page 30: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/30.jpg)
Microprocessor vs. Microcontroller Microprocessor – CPU & various IO functions are packed
as separate ICs Microcontroller – Most IO functions are integrated into
same package with CPU
30
Microprocessor
Clock
Program Memory
Data Storage
I/O
I/O
I/O
MicroprocessorCore
Program Memory
Real-time Clock
I/O
I/O
I/OData
Storage
![Page 31: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/31.jpg)
31
Programming Hierarchies
Source: Introduction to PIC Microcontroller – Part 1 by Khan Wahid
![Page 32: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/32.jpg)
Programming Language Levels Machine code (40s-50s)
0001000000111000 0001001000110100 0101110000000000 0001110000000000 0001001000110101
Hex notation (50s-60s) 1038 1234 5C00 1E00 1235
32Source: http://mentalfloss.com/article/53160/meet-refrigerator-ladies-who-programmed-eniac
![Page 33: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/33.jpg)
Programming Language Levels (Cont.) Assembler
Machine code (60s-70s).define const = 6num1: .byte [1]num2: .byte [2]move.b num1,d0addq.b #const,d0move.b d0,num2
High-level languages C code fragment (70s-80s)
#define const 6int num1, num2;num2 = num1 + const;
33
![Page 34: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/34.jpg)
34
When is Assembler Appropriate? Parts of a program where absolute speed is
critical More effective use of CPU registers & instruction set Can produce code that runs faster than that produced
by a compiler There may be no other way to access a
particular feature of hardware Compiler might not provide library functions to access
IO ports or to disable/enable interrupts Compiler might not take advantage of CPU special
instructions BCD arithmetic, binary-ASCII conversion, table lookups, high
speed copying of entire blocks of data
![Page 35: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/35.jpg)
35
Building Digital Solutions to Computational Problems
· Labs & design project· Product specs
· Algorithms, RTL, etc.· Flowcharts· State transition diagrams
· Logic equations· Circuit schematics· Verilog or VHDL code· Assembler· C, C++
· TTL Gates (AND, OR, XOR ... )· Programmable Logic· Custom ASICs· FPGAs· MCs, DSPs
![Page 36: Computer Architecture – An Introduction](https://reader034.fdocuments.net/reader034/viewer/2022042504/557b349dd8b42adc608b4961/html5/thumbnails/36.jpg)
36
Real-World Performance Metrics
Commercial digital designs seek the most appropriate trade-offs for the target application
Time-to-market is also very important
Cost
Commodity Products
Speed
Scientific Computing,Simulation
Energy
Portable Devices
Capacity
Multimedia, Scientific Computing,
Simulation