introduction to computer architecture
DESCRIPTION
Introduction To Computer Architecture. Jean-Michel RICHER University of Angers France [email protected] January 2003. WARNING !. This document can be reproduced, modified and used freely. Please report any change or improvement to Jean-Michel Richer at : - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/1.jpg)
IntroductionTo
Computer Architecture
Jean-Michel RICHER
University of AngersFrance
January 2003
![Page 2: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/2.jpg)
WARNING !
This document can be reproduced, modified and used freely.
Please report any change or improvement to Jean-Michel Richer at :
[email protected](http://www.info.univ-angers.fr/pub/richer)
January 2003
![Page 3: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/3.jpg)
OUTLINE
Memory organization
Some CPU organizations
Example of program execution with the Intel 8086
Example of program execution with pipeline technology
![Page 4: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/4.jpg)
MEMORY ORGANIZATIONThe operating system organizes the memory as follows :
contains the program codeCode
contains the program dataData
contains subprograms callsSTACK
contains the rest of the memoryHEAP
![Page 5: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/5.jpg)
DIFFERENT CPU ORGANIZATIONS
808680486
Pentium IIIPentium IV
![Page 6: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/6.jpg)
Code
Data
STACK
HEAP
Load InstructionDecode
Load OperandExecute
ALU
Registers
Write Result
Intel 8086Instruction path
Data path
Cpu diemotherboard
Coprocessor
![Page 7: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/7.jpg)
Code
Data
STACK
HEAP
Load InstructionDecode
Load OperandExecute
ALU
Registers
Write Result
Intel 80486
L1 Cache - I
L1 Cache
FPU
Integrated FPUL2 Cache
L2 Cache onMotherboard
![Page 8: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/8.jpg)
Code
Data
STACK
HEAP
L1 Cache - I
Load InstructionDecode
Load OperandExecute
FPU
Registers
Write Result
Intel Pentium
BTB TLB
Branch Prediction
ALU1
ALU2
Superscalar
L2 Cache
L1 Cache - DL1 Cache
![Page 9: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/9.jpg)
![Page 10: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/10.jpg)
Code
Data
STACK
HEAP
L1 Cache - I
Load InstructionDecode
Load OperandExecute
ALU1
ALU2 FPU
BTB TLB
L2 Cache
Registers
L1 Cache - D
Write Result
Intel Pentium III
L2 Cache on-die
![Page 11: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/11.jpg)
![Page 12: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/12.jpg)
Code
Data
STACK
HEAP
Load Instruction
DecodeLoad Operand
Execute
UAL1
UAL2 FPU
BTB TLB
L2 Cache
Registers
L1 Cache - D
Write Result
Intel Pentium IV
Trace Cache
Trace Cache
![Page 13: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/13.jpg)
![Page 14: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/14.jpg)
![Page 15: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/15.jpg)
PROGRAM EXECUTION
The 8086 case
![Page 16: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/16.jpg)
int a, b ,c
a = 1;b = 2;c = a + b
C Language
(a) 100 0000000000000001(b) 102 0000000000000010(c) 104 0000000000000000
Program
mov ax, [100]mov bx, [102]add ax, bxmov [104], ax
Assembler 8086
![Page 17: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/17.jpg)
Micro code
OP Value 1 Value 2 R1 R22 bits 2 bits 2 bits16 bits 16 bits
00 mov r1,[adr]01 mov [adr],r111 add r1,r2
00 AX01 BX10 CX11 DX
Instructions are converted into micro-operations that can be handled by the CPU (Central Processing Unit) of the micro-processor
Operation Values Registers
![Page 18: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/18.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=0STACK
HEAP
RegistersLoad Instruction
DecodeLoad Operand
Execute
UAL
Write Result
AX=?BX=?CX=?DX=?
Starting point
![Page 19: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/19.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=0STACK
HEAP
Registersmov ax,[100]
DecodeLoad Operand
Execute
UAL
Write Result
AX=?BX=?CX=?DX=?
Load Instruction : mov ax,[100]
![Page 20: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/20.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=0STACK
HEAP
Registersmov ax,[100]
00 100 ? 00 ?Load Operand
Execute
UAL
Write Result
AX=?BX=?CX=?DX=?
Decode Instruction : mov ax,[100]Micro code
00 00100 ??op val1 val2 r1 r2
![Page 21: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/21.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=0STACK
HEAP
Registersmov ax,[100]
00 100 ? 00 ?00 100 1 00 ?
Execute
UAL
Write Result
AX=?BX=?CX=?DX=?
Load operand : mov ax,[100]Micro code
00 00100 ?1op val1 val2 r1 r2
![Page 22: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/22.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=0STACK
HEAP
Registersmov ax,[100]
00 100 ? 00 ?00 100 1 00 ?
Execute
UAL
Write Result
AX=?BX=?CX=?DX=?
Execute : mov ax,[100]
![Page 23: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/23.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=0STACK
HEAP
Registersmov ax,[100]
00 100 ? 00 ?00 100 1 00 ?
Execute
UAL
00 100 1 00 ?
AX=1BX=?CX=?DX=?
Write result : mov ax,[100]
![Page 24: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/24.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=0STACK
HEAP
Registersmov bx,[102]
DecodeLoad Operand
Execute
UAL
Write Result
AX=1BX=?CX=?DX=?
Load Instruction : mov bx,[102]
![Page 25: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/25.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=0STACK
HEAP
Registersmov bx,[102]
00 102 ? 01 ?Load Operand
Execute
UAL
Write Result
AX=1BX=?CX=?DX=?
Decode Instruction : mov bx,[102]Micro code
00 01102 ??op val1 val2 r1 r2
![Page 26: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/26.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=0STACK
HEAP
Registersmov bx,[102]
00 102 ? 01 ?00 102 2 00 ?
Execute
UAL
Write Result
AX=1BX=?CX=?DX=?
Load operand : mov bx,[102]Micro code
00 01102 ?2op val1 val2 r1 r2
![Page 27: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/27.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=0STACK
HEAP
Registersmov bx,[102]
00 102 ? 01 ?00 102 2 00 ?
Execute
UAL
Write Result
AX=1BX=?CX=?DX=?
Execute : mov bx,[102]
![Page 28: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/28.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=0STACK
HEAP
Registersmov bx,[102]
00 102 ? 01 ?00 102 2 01 ?
Execute
UAL
00 102 2 01 ?
AX=1BX=2CX=?DX=?
Write result : mov bx,[102]
![Page 29: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/29.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=0STACK
HEAP
Registersadd ax,bxDecode
Load OperandExecute
UAL
Write Result
AX=1BX=2CX=?DX=?
Load Instruction : add ax,bx
![Page 30: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/30.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=0STACK
HEAP
Registersadd ax,bx
11 ? ? 00 01Load Operand
Execute
UAL
Write Result
AX=1BX=2CX=?DX=?
Decode Instruction : add ax,bxMicro code
11 00? 01?op val1 val2 r1 r2
![Page 31: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/31.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=0STACK
HEAP
Registersadd ax,bx
11 ? ? 00 0111 1 2 00 01
Execute
UAL
Write Result
AX=1BX=2CX=?DX=?
Load Operand : add ax,bxMicro code
11 001 012op val1 val2 r1 r2
![Page 32: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/32.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=0STACK
HEAP
Registersadd ax,bx
11 ? ? 00 0111 1 2 00 01
Execute
1+2 11 3 2 00 01
Write Result
AX=1BX=2CX=?DX=?
Execute : add ax,bxMicro code
11 003 012op val1 val2 r1 r2
![Page 33: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/33.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=0STACK
HEAP
Registersadd ax,bx
11 ? ? 00 0111 1 2 00 01
Execute
11 3 2 00 01
11 3 2 00 01
AX=3BX=2CX=?DX=?
Write Result : add ax,bx
![Page 34: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/34.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=0STACK
HEAP
Registersmov [104],ax
DecodeLoad Operand
Execute
UAL
Write Result
AX=3BX=2CX=?DX=?
Load Instruction : mov [104],ax
![Page 35: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/35.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=0STACK
HEAP
Registersmov [104],ax
01 104 ? 00 ??Load Operand
Execute
UAL
Write Result
AX=3BX=2CX=?DX=?
Decode Instruction : mov [104],axMicro code
01 00104 ??op val1 val2 r1 r2
![Page 36: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/36.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=0STACK
HEAP
Registersmov [104],ax
01 104 ? 00 ??01 104 3 00 ??
Execute
UAL
Write Result
AX=3BX=2CX=?DX=?
Load Operand : mov [104],axMicro code
01 00104 ?3op val1 val2 r1 r2
![Page 37: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/37.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=0STACK
HEAP
Registersmov [104],ax
01 104 ? 00 0101 104 3 00 01
Execute
UAL
Write Result
AX=3BX=2CX=?DX=?
Load Operand : mov [104],axMicro code
01 00104 ?3op val1 val2 r1 r2
![Page 38: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/38.jpg)
mov ax,[100]mov bx,[102]add ax, bxmov [104],ax
[100]=1[102]=2[104]=3STACK
HEAP
Registersmov [104],ax
01 104 ? 00 0101 104 3 00 01
Execute
UAL
01 104 3 00 01
AX=3BX=2CX=?DX=?
Write Result : mov [104],ax
![Page 39: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/39.jpg)
PROGRAM EXECUTION WITH PIPELINE
Pentium-Like
![Page 40: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/40.jpg)
DEPENDENCIES
mov ax, [100]
mov bx, [102]
add ax, bx
mov [104], ax
The 8086 code shows there are 2 dependencies :
RAW
WAW
Forward
Forward
![Page 41: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/41.jpg)
AVOID DEPENDENCIES
To avoid dependencies we can add a field to the micro-code in order to indicate when data need to be forwarded into the pipeline :
OP Value 1 Value 2 R1 R22 bits 2 bits 2 bits16 bits 16 bits
Operation Values Registers
F1 bit
If F = 1 then Forward Data
Flag
![Page 42: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/42.jpg)
00 00100 ??op val1 val2 r1 r2
TRADUCTION INTO MICRO-OPs
mov ax, [100]
mov bx, [102]
add ax, bx
mov [104], ax
00 01102 ??
11 00? 01?
01 00104 ??
0f
1
1
0
![Page 43: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/43.jpg)
Load Operand
Execute
UAL
Write Result
Load Operand : mov ax,[100]
00 00100 ?? 01
Step 1
![Page 44: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/44.jpg)
Load Operand
Execute
UAL
Write Result
Load Operand : mov bx,[102]Execute : mov ax,[100]
00 01102 ?? 1
00 00100 ?1 0
2
Step 2
![Page 45: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/45.jpg)
Load Operand
Execute
UAL
Write Result
Execute : mov bx,[102]
AX=1
Load Operand : add ax,bx
11 00? 01? 1
00 01102 ?2 1
Write Result : mov ax,[100]
00 00100 ?1 0
1
Step 3
Forward result
1
2
![Page 46: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/46.jpg)
Load Operand
Execute
UAL
Write Result BX=2
Load Operand : mov [104],ax
01 00104 ?? 0
Execute : add ax, bx
11 001 012 1
Write Result : mov bx,[102]
00 01102 ?2 1
1+211 00 012 13
Step 4
Forward result
1
3
![Page 47: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/47.jpg)
Load Operand
Execute
UAL
Write Result AX=3
Execute : mov ax,[104]
01 00104 ?3 0
Write Result : add ax, bx
11 003 012 1
Step 5
![Page 48: Introduction To Computer Architecture](https://reader033.vdocument.in/reader033/viewer/2022042523/56815111550346895dbf2f14/html5/thumbnails/48.jpg)
Load Operand
Execute
UAL
Write Result
Write Result : mov ax, [104]
01 00104 ?3 0
RAM
Step 6