asked 201k views
5 votes
assume a 5-stage pipeline with all necessary forwarding paths. the branch is resolved in the mem stage and the pipeline stalls until the branch is resolved. what is the cpi of branches? note the question asks for cpi, not the number of stall cycles.

asked
User Isarathg
by
7.5k points

1 Answer

3 votes

Final answer:

The CPI of branches in a 5-stage pipeline with necessary forwarding paths and branch resolution in the MEM stage is 3.

Step-by-step explanation:

The correct answer is option (d) 3. The CPI (Cycle Per Instruction) of branches in a 5-stage pipelined processor with all necessary forwarding paths and branch resolution in the MEM stage is 3. This is because when a branch instruction is encountered, the pipeline needs to be flushed or stalled until the branch is resolved.

This results in a 3-cycle penalty: one cycle for the branch instruction fetch, one cycle for the branch instruction decode, and one cycle for the branch resolution in the MEM stage.

The CPI (Cycles Per Instruction) for branches in a 5-stage pipeline with stalls at the MEM stage cannot be determined exactly without specific details on stall cycles. CPI is calculated by dividing the total cycles including stall cycles for branch instructions by the number of branches executed.

answered
User Janey
by
7.5k points