Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction To Computer Architecture Jean-Michel RICHER University of Angers France January 2003.

Similar presentations


Presentation on theme: "Introduction To Computer Architecture Jean-Michel RICHER University of Angers France January 2003."— Presentation transcript:

1 Introduction To Computer Architecture Jean-Michel RICHER University of Angers France richer@info.univ-angers.fr January 2003

2 WARNING ! This document can be reproduced, modified and used freely. Please report any change or improvement to Jean-Michel Richer at : richer@info.univ-angers.fr (http://www.info.univ-angers.fr/pub/richer)http://www.info.univ-angers.fr/pub/richer January 2003

3 OUTLINE  Memory organization  Some CPU organizations  Example of program execution with the Intel 8086  Example of program execution with pipeline technology

4 MEMORY ORGANIZATION The operating system organizes the memory as follows : contains the program code Code contains the program data Data contains subprograms callsSTACK contains the rest of the memory HEAP

5 DIFFERENT CPU ORGANIZATIONS 8086 80486 Pentium III Pentium IV

6 Code Data STACK HEAP Load Instruction Decode Load Operand Execute ALU Registers Write Result Intel 8086 Instruction path Data path Cpu die motherboard Coprocessor

7 Code Data STACK HEAP Load Instruction Decode Load Operand Execute ALU Registers Write Result Intel 80486 L1 Cache - I L1 Cache FPU Integrated FPU L2 Cache L2 Cache on Motherboard

8 Code Data STACK HEAP L1 Cache - I Load Instruction Decode Load Operand Execute FPU Registers Write Result Intel Pentium BTBTLB Branch Prediction ALU 1 ALU 2 Superscalar L2 Cache L1 Cache - D L1 Cache

9

10 Code Data STACK HEAP L1 Cache - I Load Instruction Decode Load Operand Execute ALU 1 ALU 2 FPU BTBTLB L2 Cache Registers L1 Cache - D Write Result Intel Pentium III L2 Cache on-die

11

12 Code Data STACK HEAP Load Instruction Decode Load Operand Execute UAL 1 UAL 2 FPU BTBTLB L2 Cache Registers L1 Cache - D Write Result Intel Pentium IV Trace Cache

13

14

15 PROGRAM EXECUTION The 8086 case

16 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, bx mov [104], ax Assembler 8086

17 Micro code OPValue 1Value 2R1R2 2 bits 16 bits 00 mov r1,[adr] 01 mov [adr],r1 11 add r1,r2 00 AX 01 BX 10 CX 11 DX Instructions are converted into micro-operations that can be handled by the CPU (Central Processing Unit) of the micro-processor Operation ValuesRegisters

18 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=0 STACK HEAP Registers Load Instruction Decode Load Operand Execute UAL Write Result AX=? BX=? CX=? DX=? Starting point

19 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=0 STACK HEAP Registers mov ax,[100] Decode Load Operand Execute UAL Write Result AX=? BX=? CX=? DX=? Load Instruction : mov ax,[100]

20 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=0 STACK HEAP Registers mov ax,[100] 00 100 ? 00 ? Load Operand Execute UAL Write Result AX=? BX=? CX=? DX=? Decode Instruction : mov ax,[100] Micro code 00 100?? opval1val2r1r2

21 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=0 STACK HEAP Registers mov 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 100?1 opval1val2r1r2

22 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=0 STACK HEAP Registers mov ax,[100] 00 100 ? 00 ? 00 100 1 00 ? Execute UAL Write Result AX=? BX=? CX=? DX=? Execute : mov ax,[100]

23 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=0 STACK HEAP Registers mov ax,[100] 00 100 ? 00 ? 00 100 1 00 ? Execute UAL 00 100 1 00 ? AX=1 BX=? CX=? DX=? Write result : mov ax,[100]

24 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=0 STACK HEAP Registers mov bx,[102] Decode Load Operand Execute UAL Write Result AX=1 BX=? CX=? DX=? Load Instruction : mov bx,[102]

25 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=0 STACK HEAP Registers mov bx,[102] 00 102 ? 01 ? Load Operand Execute UAL Write Result AX=1 BX=? CX=? DX=? Decode Instruction : mov bx,[102] Micro code 0001102?? opval1val2r1r2

26 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=0 STACK HEAP Registers mov bx,[102] 00 102 ? 01 ? 00 102 2 00 ? Execute UAL Write Result AX=1 BX=? CX=? DX=? Load operand : mov bx,[102] Micro code 0001102?2 opval1val2r1r2

27 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=0 STACK HEAP Registers mov bx,[102] 00 102 ? 01 ? 00 102 2 00 ? Execute UAL Write Result AX=1 BX=? CX=? DX=? Execute : mov bx,[102]

28 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=0 STACK HEAP Registers mov bx,[102] 00 102 ? 01 ? 00 102 2 01 ? Execute UAL 00 102 2 01 ? AX=1 BX=2 CX=? DX=? Write result : mov bx,[102]

29 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=0 STACK HEAP Registers add ax,bx Decode Load Operand Execute UAL Write Result AX=1 BX=2 CX=? DX=? Load Instruction : add ax,bx

30 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=0 STACK HEAP Registers add ax,bx 11 ? ? 00 01 Load Operand Execute UAL Write Result AX=1 BX=2 CX=? DX=? Decode Instruction : add ax,bx Micro code 1100?01? opval1val2r1r2

31 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=0 STACK HEAP Registers add ax,bx 11 ? ? 00 01 11 1 2 00 01 Execute UAL Write Result AX=1 BX=2 CX=? DX=? Load Operand : add ax,bx Micro code 11001012 opval1val2r1r2

32 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=0 STACK HEAP Registers add ax,bx 11 ? ? 00 01 11 1 2 00 01 Execute 1+2 11 3 2 00 01 Write Result AX=1 BX=2 CX=? DX=? Execute : add ax,bx Micro code 11003012 opval1val2r1r2

33 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=0 STACK HEAP Registers add ax,bx 11 ? ? 00 01 11 1 2 00 01 Execute 11 3 2 00 01 AX=3 BX=2 CX=? DX=? Write Result : add ax,bx

34 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=0 STACK HEAP Registers mov [104],ax Decode Load Operand Execute UAL Write Result AX=3 BX=2 CX=? DX=? Load Instruction : mov [104],ax

35 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=0 STACK HEAP Registers mov [104],ax 01 104 ? 00 ?? Load Operand Execute UAL Write Result AX=3 BX=2 CX=? DX=? Decode Instruction : mov [104],ax Micro code 0100104?? opval1val2r1r2

36 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=0 STACK HEAP Registers mov [104],ax 01 104 ? 00 ?? 01 104 3 00 ?? Execute UAL Write Result AX=3 BX=2 CX=? DX=? Load Operand : mov [104],ax Micro code 0100104?3 opval1val2r1r2

37 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=0 STACK HEAP Registers mov [104],ax 01 104 ? 00 01 01 104 3 00 01 Execute UAL Write Result AX=3 BX=2 CX=? DX=? Load Operand : mov [104],ax Micro code 0100104?3 opval1val2r1r2

38 mov ax,[100] mov bx,[102] add ax, bx mov [104],ax [100]=1 [102]=2 [104]=3 STACK HEAP Registers mov [104],ax 01 104 ? 00 01 01 104 3 00 01 Execute UAL 01 104 3 00 01 AX=3 BX=2 CX=? DX=? Write Result : mov [104],ax

39 PROGRAM EXECUTION WITH PIPELINE Pentium-Like

40 DEPENDENCIES mov ax, [100] mov bx, [102] add ax, bx mov [104], ax The 8086 code shows there are 2 dependencies : RAW WAW Forward

41 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 : OPValue 1Value 2R1R2 2 bits 16 bits Operation ValuesRegisters F 1 bit If F = 1 then Forward Data Flag

42 00 100?? opval1val2r1r2 TRADUCTION INTO MICRO-OPs mov ax, [100] mov bx, [102] add ax, bx mov [104], ax 0001102?? 1100?01? 00104?? 0 f 1 1 0

43 Load Operand Execute UAL Write Result Load Operand : mov ax,[100] 00 100??0 1 Step 1

44 Load Operand Execute UAL Write Result Load Operand : mov bx,[102] Execute : mov ax,[100] 0001102??100 100?10 2 Step 2

45 Load Operand Execute UAL Write Result Execute : mov bx,[102] AX=1 Load Operand : add ax,bx 1100?01?10001102?21 Write Result : mov ax,[100] 00 100?10 1 Step 3 Forward result 1 2

46 Load Operand Execute UAL Write Result BX=2 Load Operand : mov [104],ax 0100104??0 Execute : add ax, bx 110010121 Write Result : mov bx,[102] 0001102?21 1+2 110001213 Step 4 Forward result 1 3

47 Load Operand Execute UAL Write Result AX=3 Execute : mov ax,[104] 0100104?30 Write Result : add ax, bx 110030121 Step 5

48 Load Operand Execute UAL Write Result Write Result : mov ax, [104] 0100104?30 RAM Step 6


Download ppt "Introduction To Computer Architecture Jean-Michel RICHER University of Angers France January 2003."

Similar presentations


Ads by Google