

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


CS433g: Computer System Organization โ Fall 2005 Practice Problem Set 2 Question 1 Consider two different machines. The first has a single cycle datapath (i.e., a single stage, non- pipelined machine) with a cycle time of 4ns. The second is a pipelined machine with four pipeline stages and a cycle time of 1ns. a. What is the speedup of the pipelined machine versus the single cycle machine assuming there are no stalls? b. What is the speedup of the pipelined machine versus the single cycle machine if the pipeline stalls 1 cycle for 30% of the instructions? c. Now consider a 3 stage pipeline machine with a cycle time of 1.1ns. Again assuming no stalls, is this implementation faster or slower than the original 4 stage pipeline? Explain your answer. Question 2 Consider the following code fragment: Loop: LW R1, 0(R2) DADDI R1, R1, 1 SW R1, 0(R2) DADDI R2, R2, 4 DADDI R4, R4, - BNEZ R4, Loop Consider the standard 5 stage pipeline machine (IF ID EX MEM WB). Assume the initial value of R4 is 396 and all memory accesses hit in the cache.
the second iteration. For this part, assume there is no forwarding or bypassing hardware. Assume a register write occurs in the first half of the cycle and a register read occurs in the last half of the cycle. Also, assume that branches are resolved in the memory stage and are handled by flushing the pipeline. Use a pipeline timing chart to show the timing. How many cycles does this loop take to complete (for all iterations, not just one iteration)? b. Show the timing for the same instruction sequence for the pipeline with full forwarding and bypassing hardware (as discussed in class). Assume that branches are resolved in the MEM stage and are predicted as not taken. How many cycles does this loop take to complete?
Question 3 (Based on question A.5 in your book, from Appendix A.) For these problems, we will explore a pipeline for a register-memory architecture. The architecture has two instruction formats: a register-register format and a register-memory format. In the register-memory format, one of the operands for an ALU instruction could come from memory. There is a single memory-addressing mode (offset + base register). The only non-branch register-memory instructions available have the format: Op Rdest, Rsrc1, Rsrc or Op Rdest, Rsrc1, MEM where Op is one of the following: Add, Subtract, And, Or, Load (in which case Rsrc1 is ignored), or Store. Rsrc1, Rsrc2, and Rdest are registers. MEM is a (base register, offset) pair. Branches compare two registers and, depending on the outcome of the comparison, move to a target address. The target address can be specified as a PC-relative offset or in a register (with no offset). Assume that the pipeline structure of the machine is as follows: IF RF ALU1 MEM ALU2 WB The first ALU stage is used for effective address calculation for memory references and branches. The second ALU stage is used for operations and branch comparison. RF is both a decode and register-fetch stage. Assume that when a register read and a register write of the same register occur in the same cycle, the write data is forwarded. a. Find the number of adders, counting any adder or incrementor, needed to minimize the number of structural hazards. Justify why you need this number of adders. b. Find the number of register read and write ports and memory read and write ports needed to minimize the number of structural hazards. Justify why you need this number of ports for the register file and memory. c. Will data forwarding from the ALU2 stage to any of ALU1, MEM, or ALU2 stages reduce or avoid stalls? Explain your answer for each stage. d. Will data forwarding from the MEM stage to any of ALU1, MEM, or ALU2 stages reduce or avoid stalls? Explain your answer for each stage. Question 4 Consider a machine with multicycle functional units that is an extension of the 5 stage pipeline machine (IF ID EX MEM WB). Integer operations have 1 EX stage, FP Add has 3 EX stages, and FP multiply has 8 EX stages. Each FP unit is pipelined and the pipeline supports full forwarding. All other stages in the pipeline complete in one cycle. Branches are resolved in the ID stage. Show the timing for the following set of instructions through one loop iteration. List all of the data hazards that cause stalls in the following code segment and explain why they occur (for