Download presentation

Presentation is loading. Please wait.

Published byCade Winget Modified about 1 year ago

1
Pipeline - problema Lab. FIC An03.Sapt04

2
2/8 Text problema Se da următorul cod scris in limbaj de asamblare MIPS. Ştiind că iniţial: R4 = R2 +352 Se cere: a)De căte ori se efectuează bucla? b)Presupunând că nu avem forwarding, nici bypassing, doar artificiul cu tactul; iar branch-urile sunt tratate în maniera freeze flush, arătaţi funcţionarea buclei în pipeline c)În cazul anterior câte impulsuri de tact trec de la iniţierea buclei până la terminarea ultimei instrucţiuni din ultima repetiţie a buclei? d)Presupunând că avem forwarding, bypassing şi artificiul cu tactul; iar branch-urile sunt tratate în maniera predict as taken, arătaţi funcţionarea buclei în pipeline e)În cazul anterior câte impulsuri de tact trec de la iniţierea buclei până la terminarea ultimei instrucţiuni din ultima repetiţie a buclei? Punctaj: a – 0.5 b – 1.75 (din care branch:0.5) c – 0.25 d – 1.75 (din care branch:0.5) e – 0.25

3
3/8 Codul: loop: LD F4, 4(R2) ADDD F2, F4, F2 LD F6, 4(R3) LD F8, 0(R4) DADDUI R2, R2, #16 MULD F6,F6,F2 ADDD F8, F8, F2 DADDUI R3, R3, #16 XOR R7,R8,R9 DSUBUI R4, R4, #16 SD F2, -4(R2) DSUBU R5, R4, R2 DSUBU R6, R3, R2 BNEZ R5, loop F4 Mem [R2 + 4] F2 F4 + F2 F6 Mem [R3 + 4] F8 Mem [R4] R2 R2 + 16 F6 F6 * F2 F8 F8 + F2 R3 R3 + 16 R7 R8 xor R9 R4 R4 -16 Mem[R2 - 4] F2 R5 R4 - R2 R6 R3 - R2 If R5 ≠ 0 go

4
4/8 Subpunctul a Conditie de terminare bucla: R5 final = 0 La fiecare iteratie R5 = R4 – R2 R4 = R4 anterior -16 R2 = R2 anterior +16 => R4 – R2 = R4 anterior -16 – (R2 anterior +16) R4 – R2 = R4 anterior – R2 anterior – 32 => R5 = R5 anterior - 32 Din enunt se stie ca: R4 initial = R2 initial + 352 R4 initial - R2 initial = 352 F4 Mem [R2 + 4] F2 F4 + F2 F6 Mem [R3 + 4] F8 Mem [R4] R2 R2 + 16 F6 F6 * F2 F8 F8 + F2 R3 R3 + 16 R7 R8 xor R9 R4 R4 -16 Mem[R2 - 4] F2 R5 R4 - R2 R6 R3 - R2 If R5 ≠ 0 repeat loop

5
5/8 Subpunctul b instruction Clock cycles 12345678910111213141516171819202122232425 loop: LD F4, 4(R2) IFIDEXMEWB ADDD F2, F4, F2 IF IDA1A2A3A4MEWB LD F6, 4(R3) IFIDEXMEWB LD F8, 0(R4) IFIDEXMEWB DADDUI R2, R2, #16 IFIDEX MEWB MULD F6,F6,F2 IF IDM1M2M3M4M5M6M7MEWB ADDD F8, F8, F2 IFIDA1A2A3A4MEWB DADDUI R3, R3, #16 IFIDEXMEWB XOR R7,R8,R9 IFIDEXMEWB DSUBUI R4, R4, #16 IFIDEX MEWB SD F2, - 4(R2) IFID EX MEWB DSUBU R5, R4, R2 IF IDEXMEWB DSUBU R6, R3, R2 IFIDEXMEWB BNEZ R5, loop IF IDEXMEWB IF next …

6
6/8 Sunpunctul c Nr bucle * 23 + 2 = 11*23 +2 = 255 cc instruction Clock cycles 12345678910111213141516171819202122232425 loop: LD F4, 4(R2) IFIDEXMEWB ADDD F2, F4, F2 IF IDA1A2A3A4MEWB LD F6, 4(R3) IFIDEXMEWB LD F8, 0(R4) IFIDEXMEWB DADDUI R2, R2, #16 IFIDEX MEWB MULD F6,F6,F2 IF IDM1M2M3M4M5M6M7MEWB ADDD F8, F8, F2 IFIDA1A2A3A4MEWB DADDUI R3, R3, #16 IFIDEXMEWB XOR R7,R8,R9 IFIDEXMEWB DSUBUI R4, R4, #16 IFIDEX MEWB SD F2, - 4(R2) IFID EX MEWB DSUBU R5, R4, R2 IF IDEXMEWB DSUBU R6, R3, R2 IFIDEXMEWB BNEZ R5, loop IF IDEXMEWB IF next …

7
7/8 Subpunctul d instruction Clock cycles 1234567891011121314151617181920 loop: LD F4, 4(R2) IFIDEXMEWB ADDD F2, F4, F2 IFID A1A2A3A4MEWB LD F6, 4(R3) IF IDEXMEWB LD F8, 0(R4) IFIDEXMEWB DADDUI R2, R2, #16 IFIDEX MEWB MULD F6,F6,F2 IFIDM1M2M3M4M5M6M7MEWB ADDD F8, F8, F2 IFIDA1A2A3A4MEWB DADDUI R3, R3, #16 IFIDEXMEWB XOR R7,R8,R9 IFIDEXMEWB DSUBUI R4, R4, #16 IFIDEX MEWB SD F2, - 4(R2) IFID EXMEWB DSUBU R5, R4, R2 IF IDEXMEWB DSUBU R6, R3, R2 IFIDEXMEWB BNEZ R5, loop IFIDEXMEWB IF LD IFID LD … If taken IF next … If not taken

8
8/8 Subpunctul e: nr bucle*17+3=190cc instruction Clock cycles 1234567891011121314151617181920 loop: LD F4, 4(R2) IFIDEXMEWB ADDD F2, F4, F2 IFID A1A2A3A4MEWB LD F6, 4(R3) IF IDEXMEWB LD F8, 0(R4) IFIDEXMEWB DADDUI R2, R2, #16 IFIDEX MEWB MULD F6,F6,F2 IFIDM1M2M3M4M5M6M7MEWB ADDD F8, F8, F2 IFIDA1A2A3A4MEWB DADDUI R3, R3, #16 IFIDEXMEWB XOR R7,R8,R9 IFIDEXMEWB DSUBUI R4, R4, #16 IFIDEX MEWB SD F2, - 4(R2) IFID EXMEWB DSUBU R5, R4, R2 IF IDEXMEWB DSUBU R6, R3, R2 IFIDEXMEWB BNEZ R5, loop IFIDEXMEWB IF LD IFID LD … If taken IF next … If not taken

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google