Presentation is loading. Please wait.

Presentation is loading. Please wait.

תרגיל כיתה 7 מבוא לטכנולוגיות מחשב CPE. – 2 – ארכיטקטורה של מעבד מודרני Execution Functional Units Instruction Control Integer/ Branch FP Add FP Mult/Div.

Similar presentations


Presentation on theme: "תרגיל כיתה 7 מבוא לטכנולוגיות מחשב CPE. – 2 – ארכיטקטורה של מעבד מודרני Execution Functional Units Instruction Control Integer/ Branch FP Add FP Mult/Div."— Presentation transcript:

1 תרגיל כיתה 7 מבוא לטכנולוגיות מחשב CPE

2 – 2 – ארכיטקטורה של מעבד מודרני Execution Functional Units Instruction Control Integer/ Branch FP Add FP Mult/Div LoadStore Instruction Cache Data Cache Fetch Control Instruction Decode Address Instrs. Operations Prediction OK? Data Addr. General Integer Operation Results Retirement Unit Register File Register Updates Control Unit (CU) Arithmetic Logic Unit (ALU)

3 – 3 – היכולות של Pentium III  ניתן להריץ במקביל: 1 load 1 store 2 integer (one may be branch) 1 FP Addition 1 FP Multiplication or Division Some Instructions Take > 1 Cycle, but Can be Pipelined InstructionLatencyCycles/Issue Load / Store31 Integer add11 Integer Multiply41 Integer Divide3636 חלקים שונים של אותה פקודה מבוצעים על ידי רכיבים שונים. לכן ניתן לבצע מספר רכיבים של פקודות שונות בו זמנית.

4 – 4 – דוגמאות לחישובCPE – מכפלת איברים

5 – 5 – שרטוט גרף CPE CPE = 4 ללא מגבלת משאבים

6 – 6 – פריסת לולאה  באיזו פונקציה ה- CPE עבור חישוב מכפלה יהיה קטן יותר: int funca(int* a, int size) { int result = 1; for (int i=0; i < size; i+=2) { result = result * a[i]; result = result * a[i+1]; } return result; } int funcb(int* a, int size) { int result1 = 1; int result2 = 1; for (int i=0; i < size; i+=2) { result1 = result1 * a[i]; result2 = result2 * a[i+1]; } return result1*result2; } צורה זו של פריסת לולאה מורידה מ- CPE=4

7 – 7 – סכימת איברים CPE = 1

8 – 8 – CPE = 2 סכימת איברים תחת מגבלת משאבים

9 – 9 – פריסה ו- CPE  נפרוס את לולאת החיבור ל- 3:

10 – 10 – פריסה של חיבור CPE = 1

11 – 11 – תוצאות פריסה

12 – 12 – תרגיל  נתון הקוד הבא: int inner_product (int * u, int * v, int n) { int i; int res=0; for ( i=1 ; i<n ; i++ ) { res = res + u[i]*v[i]; } return res; }

13 – 13 – תרגיל  שלב ראשון - נתרגם לשפת מכונה int inner_product (int * u, int * v, int n) { int i; int res=0; for ( i=1 ; i<n ; i++ ) { res = res + u[i]*v[i]; } return res; } Assembly: move 8(R8), R3 move 12(R8), R2 move 16(R8), R6.loop: move (R2,R4,4),R5 multiply (R3,R4,4),R5 add R5,R1 increment R4 compare R6,R4 jl.loop

14 – 14 – תרגיל  שלב שני - מה באמת המחשב מריץ? Assembly:.loop: move (R2,R4,4),R5 multiply (R3,R4,4),R5 add R5,R1 increment R4 compare R6,R4 jl.loop load (R2,R4.0,4) → R5.1 load (R3,R4.0,4) → t.1 multiply t.1,R5.1 → R5.1 add R5.1,R1.0 → R1.1 increment R4.0 → R4.1 compare R6,R4.1 → cc.1 jl –taken cc.1

15 – 15 –  שלב שלישי- מציירים איטרציה בודדת load (R2,R4.0,4) → R5.1 load (R3,R4.0,4) → t.1 multiply t.1,R5.1 → R5.1 add R5.1,R1.0 → R1.1 increment R4.0 → R4.1 compare R6,R4.1 → cc.1 jl –taken cc.1 תרגיל load R4.0 mul R5.1 t.1 add R5.1 R1.0 R1.1 inc cmp R4.1 jmp cc.1

16 – 16 – load R4.0 mul R5.1 t.1 add R5.1 R1.0 R1.1 inc cmp R4.1 jmp cc.1 load mul R5.2 t.2 add R5.2 R1.2 inc cmp R4.2 jmp cc.2


Download ppt "תרגיל כיתה 7 מבוא לטכנולוגיות מחשב CPE. – 2 – ארכיטקטורה של מעבד מודרני Execution Functional Units Instruction Control Integer/ Branch FP Add FP Mult/Div."

Similar presentations


Ads by Google