All Exams Test series for 1 year @ ₹349 only
Question

The EX stage of a pipelined processor performs the memory read operations for LOAD instructions, and the operations for the arithmetic and logic instructions. Let $t_{EX}$ denote the time taken by the EX stage to perform the operation for an instruction. For each instruction type, the values of $t_{EX}$ and $M$ (the number of instructions of that type in a sequence of 100 instructions for a program P), are given in the table below.
The duration of the pipeline clock cycle is 1 nanosecond. Assume that the latch time for the interstage buffers in the pipeline is negligible.
Instruction$t_{EX}$ in nanoseconds$M$
LOAD1.815
IMUL1.510
IDIV2.55
FADD1.710
FSUB1.75
FMUL2.815
FDIV3.25
All other instructionsLess than 1.035

When program P is executed, the number of clock cycles for which the pipeline is stalled due to structural hazards in the EX stage is ______. (answer in integer)

Pipelined Processor EX Stage Structural Hazards

This solution calculates the number of clock cycles the pipeline stalls due to structural hazards specifically within the EX (Execution) stage of a pipelined processor. We analyze the provided execution times ($t_{EX}$) for different instruction types and their counts ($M$) within a program sequence.

Calculating EX Stage Cycles and Stalls

Structural hazards in the EX stage occur when an instruction requires more than one clock cycle to complete its execution within this stage. Since the pipeline clock cycle is 1 nanosecond (ns), the number of clock cycles an instruction occupies the EX stage is determined by $\lceil t_{EX} / 1 \text{ ns} \rceil$. If this value is greater than 1, it indicates that the EX stage will be busy for multiple cycles, causing subsequent instructions to stall.

The number of stall cycles introduced by an instruction type is calculated as: (Cycles in EX - 1). We then sum these stall cycles, weighted by the number of instructions of each type ($M$), to find the total pipeline stalls.

Instruction Type $t_{EX}$ (ns) $M$ Cycles in EX ($\lceil t_{EX}/1 \rceil$) Stall Cycles per Instruction ($\text{Cycles in EX} - 1$) Total Stall Cycles ($M \times \text{Stall Cycles per Instruction}$)
LOAD 1.8 15 $\lceil 1.8/1 \rceil = 2$ $2 - 1 = 1$ $15 \times 1 = 15$
IMUL 1.5 10 $\lceil 1.5/1 \rceil = 2$ $2 - 1 = 1$ $10 \times 1 = 10$
IDIV 2.5 5 $\lceil 2.5/1 \rceil = 3$ $3 - 1 = 2$ $5 \times 2 = 10$
FADD 1.7 10 $\lceil 1.7/1 \rceil = 2$ $2 - 1 = 1$ $10 \times 1 = 10$
FSUB 1.7 5 $\lceil 1.7/1 \rceil = 2$ $2 - 1 = 1$ $5 \times 1 = 5$
FMUL 2.8 15 $\lceil 2.8/1 \rceil = 3$ $3 - 1 = 2$ $15 \times 2 = 30$
FDIV 3.2 5 $\lceil 3.2/1 \rceil = 4$ $4 - 1 = 3$ $5 \times 3 = 15$
All other instructions < 1.0 35 $\lceil <1.0/1 \rceil = 1$ $1 - 1 = 0$ $35 \times 0 = 0$

Determining Total Pipeline Stalls

The total number of clock cycles the pipeline is stalled due to structural hazards in the EX stage is the sum of the 'Total Stall Cycles' for all instruction types.

Total Stalls = Sum of ($M \times (\text{Cycles in EX} - 1)$)

Total Stalls = $15 + 10 + 10 + 10 + 5 + 30 + 15 + 0 = 95$ clock cycles.

Thus, the pipeline is stalled for 95 clock cycles due to structural hazards in the EX stage.

Was this answer helpful?

Important Questions from Instruction Pipelining

  1. The right sequence of suboperations that are performed in arithmetic pipeline is-
    A. Align the mantissas
    B. Add or subtract the mantissas
    C. Normalize the result
    D. Compare the exponents
    Choose the correct answer from the options given below:
  2. A 5-stage instruction pipeline has stage delays of 180, 250, 150, 170, and 250, respectively, in nanoseconds. The delay of an inter-stage latch is 10 nanoseconds. Assume that there are no pipeline stalls due to branches and other hazards. The time taken to process 1000 instructions in microseconds is ____________ (rounded off to two decimal places)
  3. Which one of the following is a technique of decomposing a sequential process into sub-operations, with each sub-process being executed in a special dedicated segment that operates concurrently with all other segments?
  4. A non-pipelined instruction execution unit that operates at 1.6 GHz clock takes an average of 5 clock cycles to complete the execution of an instruction. To improve the performance, the system was pipelined with a goal of achieving an average throughput of one instruction per clock cycle. However, it could operate only at 1.2 GHz due to pipeline overheads. While executing a program in the pipelined design, 30% of instructions encountered a stall of 2 cycles due to pipeline hazards. The speed-up obtained by the pipelined design over the non-pipelined one for this program is ___________. (rounded off to two decimal places)

    Note: 1G=$10^9$
  5. Pipelining improves performance by :
Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App