1 / 38

Pipeline

Pipeline. Lab. FIC An03.Sapt03. Motto:. S aga lui Pip Eline. Pip Eline VS Vrăjitoarea Dacă Pip reuşeşte să facă clătitele mai repede decât vrăjitoarea, primeşte calul năzdrăvan. Cum lucrează vrăjitoarea?. Întors clătita. Scos clătita. Turnat aluatul. Încălzit tigaia. Timpul.

nemo
Télécharger la présentation

Pipeline

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Pipeline Lab. FICAn03.Sapt03

  2. Motto:

  3. Saga lui PipEline • Pip Eline VS Vrăjitoarea • Dacă Pip reuşeşte să facă clătitele mai repede decât vrăjitoarea, primeşte calul năzdrăvan

  4. Cum lucrează vrăjitoarea? Întors clătita Scos clătita Turnat aluatul Încălzit tigaia Timpul Făcut aluatul Scos clătita Întors clătita Colectat ingredientele Turnat aluatul Încălzit tigaia

  5. Cum lucrează Pip Eline? Scos clătita din tigaia 2 Întors clătita din tigaia 3 Turnat aluatul în tigaia 4 Încălzit tigaia 1 Scos clătita din tigaia 3 Întors clătita din tigaia 4 Turnat aluatul în tigaia 1 Încălzit tigaia 2 Timpul Scos clătita din tigaia 1 Întors clătita din tigaia 2 Turnat aluatul în tigaia 3 Încălzit tigaia 4 Făcut aluatul Colectat ingredientele Întors clătita din tigaia 1 Turnat aluatul în tigaia 2 Încălzit tigaia 3 Turnat aluatul în tigaia 1 Încălzit tigaia 2 Încălzit tigaia 1

  6. Cum ştim cine a câştigat? • Timpul total • Timpul necesar până la terminarea apariţiei tuturor ieşirilor • Latenţa =L • Latency • Timpul necesar ca o intrare să apară la ieşire • Capacitatea de trecere = T • Throughput • #outputs / time

  7. Pentru a obţine N clătite • Vrăjitoarea • Timp total = timp ingrediente + timp aluat + N*(t încălzit + t turnat + t întors + t scos) • Excluzând timpul pentru ingrediente şi aluat • L= t încălzit + t turnat + t întors + t scos • T = 1 / L • Pip Eline • Timp total = timp ingrediente + timp aluat +N/4*(t încălzit + t turnat + t întors + t scos) • Excluzând timpul pentru ingrediente şi aluat • L = max (t încălzit, t turnat, t întors, t scos) * 4 • T = 1 / L

  8. Răsplata lui Pip.Eline

  9. Limitări al metodei pipeline • Există porţiuni NEPARALELIZABILE Scos clătita din tigaia 2 Întors clătita din tigaia 3 Turnat aluatul în tigaia 4 Încălzit tigaia 1 Timpul Scos clătita din tigaia 1 Întors clătita din tigaia 2 Turnat aluatul în tigaia 3 Încălzit tigaia 4 Colectat ingredientele Întors clătita din tigaia 1 Turnat aluatul în tigaia 2 Încălzit tigaia 3 Făcut aluatul Turnat aluatul în tigaia 1 Încălzit tigaia 2 Încălzit tigaia 1

  10. De analizat: speed-up şi cost A 16 km B 44 km C

  11. A B C 4km/h 0 $ 10km/h 10 $ 50 km/h 40$ 250 km/h 150$ Timp Speed-up Cost 15h 1 0 8.4h 1.786 10 5.14h 2.92 40 4.176h 3.59 150 Speed-up & cost

  12. Legea lui Amdhal

  13. Şi acum... Înapoi la circuite...

  14. Unpipelined L of the circuit = longest path fromthe input to the output T is 1 output / L Pipelined registers in-between Idealregisters zero contamination and propagation delay zero setup and hold time register’s clock cycle = propagation delay of the slowest block. Unpipelined VS pipelined in combinational logic

  15. Making a pipeline - rules of thumb • Put two dots on opposite sides of the circuit. Draw lines from onedot to another • Always put a register on the output • Isolate the slowest block with registers. Make this block the sloweststage for maximum throughput • Never cross a path twice with the same line. This helps ensure that eachpath has the same number of registers • Add a register every time a line crosses a wire. • Sursa: A Student’s Guideto the Digital Worldby Margaret Chong

  16. Exemplu • Any configuration isvalid as long as there are an equal number of registers on each path from input to output. • Sursa: A Student’s Guideto the Digital Worldby Margaret Chong

  17. MIPS

  18. MIPS - pipeline

  19. ALU instructions - schema

  20. EX/MEM.IR ← ID/EX.IR; EX/MEM.ALUOutput← ID/EX.A func ID/EX.B; or EX/MEM.ALUOutput ← ID/EX.A op ID/EX.Imm; EX/MEM.cond ← 0; Regs[MEM/WB.IR[rd]] ← MEM/WB.ALUOutput; or Regs[MEM/WB.IR[rt]] ← MEM/WB.ALUOutput; ALU instructions – schema + tabelul IF/ID.IR ← Mem[PC]; IF/ID.NPC,PC ← (if ((EX/MEM.opcode == branch) & EX/MEM.cond){EX/MEM. ALUOutput} else {PC+4}); ID/EX.A ← Regs[IF/ID.IR[rs]]; ID/EX.B ← Regs[IF/ID.IR[rt]]; ID/EX.IR ← IF/ID.IR; MEM/WB.IR ← EX/MEM.IR; MEM/WB.ALUOutput ← EX/MEM.ALUOutput;

  21. Load - schema

  22. Load – schema + tabelul MEM/WB.IR ← EX/MEM.IR; MEM/WB.LMD ← Mem[EX/MEM.ALUOutput]; IF/ID.IR ← Mem[PC]; IF/ID.NPC,PC ← (if ((EX/MEM.opcode == branch) & EX/MEM.cond){EX/MEM. ALUOutput} else {PC+4}); ID/EX.A ← Regs[IF/ID.IR[rs]]; ID/EX.Imm ← sign extend(IF/ID.IR[immediate field]); ID/EX.IR ← IF/ID.IR; EX/MEM.IR← ID/EX.IR EX/MEM.ALUOutput ← ID/EX.A + ID/EX.Imm; EX/MEM.cond ← 0; Regs[MEM/WB.IR[rt]] ← MEM/WB.LMD;

  23. Store - schema

  24. Store – schema + tabelul MEM/WB.IR ← EX/MEM.IR; Mem[EX/MEM.ALUOutput] ← EX/MEM.B; IF/ID.IR ← Mem[PC]; IF/ID.NPC,PC ← (if ((EX/MEM.opcode == branch) & EX/MEM.cond){EX/MEM. ALUOutput} else {PC+4}); ID/EX.A ← Regs[IF/ID.IR[rs]]; ID/EX.B ← Regs[IF/ID.IR[rt]]; ID/EX.Imm ← sign extend(IF/ID.IR[immediate field]); ID/EX.IR ← IF/ID.IR; EX/MEM.IR← ID/EX.IR EX/MEM.ALUOutput ← ID/EX.A + ID/EX.Imm; EX/MEM.cond ← 0; EX/MEM.B← ID/EX.B;

  25. Branch - schema NPC

  26. Branch – schema + tabelul IF/ID.IR ← Mem[PC]; IF/ID.NPC,PC ← (if ((EX/MEM.opcode == branch) & EX/MEM.cond){EX/MEM. ALUOutput} else {PC+4}); ID/EX.A ← Regs[IF/ID.IR[rs]]; ID/EX.NPC ← IF/ID.NPC ID/EX.Imm ← sign extend(IF/ID.IR[immediate field]); ID/EX.IR ← IF/ID.IR; EX/MEM.ALUOutput ← ID/EX.NPC+ID/EX.Imm; EX/MEM.cond ← (ID/EX.A == 0); NPC

  27. And that’s MIPS pipeline schematics in a nutshell!

  28. Moduri de notatie • O instructiune: • sau • Mai multe instructiuni

  29. Let’s complicate things!

  30. Moduri de tratare branch-uri -1/5 • De ce e necesar? • Pentru ca branch-ul se intoarce cu adresa CORECTA de start abia dupa ciclul de EX

  31. Moduri de tratare branch-uri -2/5 • Freeze & flush

  32. Moduri de tratare branch-uri -4/5 • Predict as untaken

  33. Moduri de tratare branch-uri -3/5 • Predict as taken

  34. Moduri de tratare branch-uri -5/5 • Delayslot

  35. Tricks & treats – 1/3

  36. Tricks & treats – 2/3 • Forwarding

  37. Tricks & treats – 3/3 • Bypassing S.D F8, -8(R1)

  38. Congratulations! You’ve made it!

More Related