- 8 Pipelining Assume That The Following C Code Has Been Used To Initialize The Memory Segment Used By The Mips Program 1 (79.97 KiB) Viewed 36 times
8: Pipelining Assume that the following C++ code has been used to initialize the memory segment used by the MIPS program
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
8: Pipelining Assume that the following C++ code has been used to initialize the memory segment used by the MIPS program
8: Pipelining Assume that the following C++ code has been used to initialize the memory segment used by the MIPS program below for (i=0;i<1000; i++) { // As you may easily figure out, this loop generates a fixed pattern of 1 odd number followed by 9 even numbers. 1: 2: 3: 4: 5: 6: 7: ODD: 9: 10: 11: 12: 13: 14: 15: if (is10) A= 6000+2*1/ else Ali 6000+2*1+1; B = 5000 + 100 i ADD ADDIU $81, Szero, 10000 ADDIU $82, Szero, 20000 ADDIU $83, Szero, 1000 St0,0(551) ANDI St1,$t0, 1 LW St2,0 ($s2) BEQ St1, Szero, EVEN St2, St2, Sto Szero, Szero, FSH BEQ SUB $t2, St2, Sto $t2,0 ($s2) Sal, Sel, 4. $82, $82,4 Sa3, S3,-1 BNE $s3, Szero, LOOP LOOP: LW EVEN: FSH: SW ADDI ADDI ADDI // base address for array A // base address for array B // counter initialized to 1000 // read All // Flag if Ali) is odd // read Blil // if Ali is even, branch // it A is odd B+Ali) (Ctr)- // if Alil is even B-=A // A++/ // B++ // Decrement Counter // Loop if Counter is not zero. Compute the average approximate number of cycles required to computer the above program by each of the following machines: (Assume 2 cycle penalty for a stall due to data or control hazard, and 1 cycle penalty for immediate data dependency on a load if forwarding is used.) I Single cycle machine II: Pipelined machine that uses stall for data hazards and predict not taken for branches III: Pipelined machine that uses forwarding for data hazards and predict taken for branches. IV: Pipelined machine that use forwarding for data hazards and branch history of 1-bit for branch prediction V: Pipelined machine that uses forwarding for data hazards and branch history of 2-bits for branch prediction