All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.

Share

Description

Pipeline Programming. Programming Techniques & Datapath Requirements. Hazard Avoidance Example Sample code: for (int i = 0; i < 100; i++) { A[i] = B[i] + c; } Assume: A is in reg 1 B is in reg 2 c is in reg 3 Write the LC2K code to minimize stalls – assume:

Transcript

Pipeline ProgrammingProgramming Techniques& Datapath RequirementsHazard Avoidance ExampleSample code: for (int i = 0; i < 100; i++) { A[i] = B[i] + c;}Assume: A is in reg 1 B is in reg 2 c is in reg 3 Write the LC2K code to minimize stalls – assume: a single cycle delayed branch (branch delay slot of size 1) any necessary/possible data forwarding Hazard Avoidance: ExampleThe unoptimized codebased on a simplehand-compile: Hazard Avoidance: UnoptimizedLoad stall!Hazard Avoidance: OptimizedBranch delay slotBranch delay slotPerformance AnalysisN iterations (N = 100 in the example) Unoptimized: Overhead: 2 cycles are required to get to the loop Each iteration takes 15 – 3 + 1 = 13 cycles 1 more cycle to finish last instruction in the pipeline Total cycles for unoptimized version 2 + 13 * N + 1 = 1303 Total instructions = 2 + 9 * N = 902 CPI 1.445 Optimized: Each iteration takes 11 – 3 + 1 = 9 cycles 4 more cycles to finish last instruction in the pipeline Total cycles for optimized version 2 + 9 * N + 4 = 906 CPI 1.004

Related Search

We Need Your Support

Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks