COMPUTER ORGANIZATION & ARCHITECTURE
106401Module 3: Pipelining
Q1(a). A pipeline stage (i) Is sequential circuit (ii) Is combination circuit (iii) Consists of both sequential and combinational circuit (iv) None of these20232m
Module 3: Pipelining
View this question on its own page →A pipeline stage
(i) Is sequential circuit
(ii) Is combination circuit
(iii) Consists of both sequential and combinational circuit
(iv) None of theseWorked SolutionAnswer: (iii) Consists of both sequential and combinational circuit
Explanation: A pipeline stage typically contains combinational logic (ALU, adder) to perform operation and sequential elements (pipeline registers/latches) to hold intermediate results between stages and synchronize with clock. Hence it is not purely sequential or purely combinational.
Q1(c). The performance of a pipelined processor suffers if (i) The pipeline stages have different delays (ii) Consecutive instruction are dependent on each other (iii) The pipeline stages share hardware resources (iv) All of these20232m
Module 3: Pipelining
View this question on its own page →The performance of a pipelined processor suffers if
(i) The pipeline stages have different delays
(ii) Consecutive instruction are dependent on each other
(iii) The pipeline stages share hardware resources
(iv) All of theseWorked SolutionAnswer: (iv) All of these
Explanation:
Pipeline performance (Ideal CPI=1) degrades due to:- Different stage delays: Clock period is set by slowest stage; faster stages idle => loss of efficiency. Unequal delays create bottlenecks/bubbles.
- Consecutive instruction dependency (Data hazard): RAW/WAR/WAW dependencies force stalls or forwarding.
- Shared hardware resources (Structural hazard): e.g., single memory for instruction & data, single ALU; simultaneous use by two stages causes conflict/stall.
All three cause pipeline stalls/NOPs, reducing speedup < number of stages. Hence (iv).
Q1(e). What does a branch prediction mechanism in a CPU help reduce? a) Data hazards b) Control hazards c) Structural hazards d) Clock cycle delays20242m
Module 3: Pipelining
View this question on its own page →What does a branch prediction mechanism in a CPU help reduce?
a) Data hazards
b) Control hazards
c) Structural hazards
d) Clock cycle delaysWorked SolutionAnswer: b) Control hazards
Explanation:
- Control hazard occurs due to branch instructions (conditional/unconditional) where next PC is unknown until decode/execute; pipeline must stall/flush.
- Branch prediction predicts taken/not-taken and target address to fetch next instruction speculatively, reducing stalls/flushes.
- Data hazards are handled by forwarding/bypassing, stalling, instruction scheduling.
- Structural hazards handled by resource duplication/pipelining.
Hence branch prediction primarily reduces control hazards.
Q1(e). Which of the following has no practical usage? (i) SISD (ii) SIMD (iii) MISD (iv) MIMD20232m
Module 3: Pipelining
View this question on its own page →Which of the following has no practical usage?
(i) SISD
(ii) SIMD
(iii) MISD
(iv) MIMDWorked SolutionAnswer: (iii) MISD
Explanation (Flynn's taxonomy):
- SISD - Single Instruction Single Data - conventional von Neumann uni-processor - widely used.
- SIMD - Single Instruction Multiple Data - vector/array processors, GPUs - widely used.
- MIMD - Multiple Instruction Multiple Data - multicore, multiprocessor, distributed systems - widely used.
- MISD - Multiple Instruction Single Data - multiple processors execute different instructions on same data stream - no practical commercial implementation; considered impractical/theoretical only (some argue systolic array is near example but not pure MISD).
Hence MISD has no practical usage.
Q1(h). Which technique is used to handle data hazards in pipelining? a) Increasing memory size b) Instruction scheduling c) Parallel processing d) Increasing clock speed20242m
Module 3: Pipelining
View this question on its own page →Which technique is used to handle data hazards in pipelining?
a) Increasing memory size
b) Instruction scheduling
c) Parallel processing
d) Increasing clock speedWorked SolutionAnswer: b) Instruction scheduling
Explanation:
- Data hazards (RAW, etc.) handled by:
- Data forwarding/bypassing
- Instruction scheduling / reordering (compiler or hardware - out-of-order execution) to insert independent instructions between dependent ones
- Stalling (NOP insertion)
- Increasing memory size, parallel processing, or clock speed do not resolve data dependencies.
Hence among options, Instruction scheduling is the technique.
- Data hazards (RAW, etc.) handled by:
Q1(i). The stalling of the processor due to the unavailability of the instruction is called as: (i) Control hazard (ii) Structural hazard (iii) Input hazard (iv) None of the above20232m
Module 3: Pipelining
View this question on its own page →The stalling of the processor due to the unavailability of the instruction is called as:
(i) Control hazard
(ii) Structural hazard
(iii) Input hazard
(iv) None of the aboveWorked SolutionAnswer: (ii) Structural hazard
Explanation:
- Structural hazard: Stall due to hardware resource unavailability, e.g., memory port conflict where instruction fetch and data access need same memory, or insufficient ALUs. Unavailability of instruction (I-cache miss / memory contention) falls under this.
- Control hazard: Due to branches.
- Data hazard: Due to operand dependency.
Some texts specifically call "instruction hazard" as subtype of structural hazard.
Q1(i). (i) The situation wherein the data of operands are not available is called (i) data hazard (ii) stock (iii) deadlock (iv) structural hazard20222m
Module 3: Pipelining
View this question on its own page →(i) The situation wherein the data of operands are not available is called
(i) data hazard
(ii) stock
(iii) deadlock
(iv) structural hazardWorked SolutionAnswer: (i) data hazard
Explanation:
- Data hazard: Operand/data not yet available/computed by previous instruction (RAW - Read After Write) when needed, causing stall.
- Structural hazard: Hardware resource conflict (e.g., same memory port used by two stages).
- Control hazard: Due to branch/jump altering PC.
- Stock/deadlock are not pipeline hazard terms (stock is typo for stall).
Hence unavailable operand = data hazard.
Q1c. In case of pipelining processor, loop buffer is * (i) very high speed memory maintained by the instruction fetch stage * (ii) very high speed memory maintained by the instruction decode stage * (iii) very high speed memory maintained by the instruction execute stage * (iv) None of the above20192m
Module 3: Pipelining
View this question on its own page →In case of pipelining processor, loop buffer is
- (i) very high speed memory maintained by the instruction fetch stage
- (ii) very high speed memory maintained by the instruction decode stage
- (iii) very high speed memory maintained by the instruction execute stage
- (iv) None of the above
Worked SolutionCorrect option: (i) High-speed memory at fetch stage (Loop Buffer)
Loop buffer is a small, very high-speed memory at the instruction fetch stage that stores recently fetched instruction sequence of a loop. On loop repetition, instructions are fetched directly from buffer instead of main memory/cache, reducing fetch time and memory traffic. Hence answer is (i).
Q1f. Briefly explain the conflicts in instruction pipeline.20162m
Module 3: Pipelining
View this question on its own page →Briefly explain the conflicts in instruction pipeline.
Worked SolutionConflicts/Hazards in Instruction Pipeline: pipeline cannot overlap execution. Three types:
Structural Hazard (Resource conflict): Two stages need same hardware resource in same cycle. e.g., single memory for instruction fetch and data access, single ALU. Solved by separate I-cache/D-cache, extra functional units, pipeline stalls.
Data Hazard: Next instruction needs data not yet produced by previous instruction. Types: RAW (Read After Write - true dependency), WAR, WAW. Causes stalls/bubbles. Solved by forwarding/bypassing, register renaming, compiler scheduling.
Control Hazard (Branch hazard): Due to branch/jump instructions. Pipeline doesn't know next PC until branch resolved, so wrong instructions fetched. Causes flushing. Solved by branch prediction, delayed branch, branch target buffer, prefetch.
All reduce speedup from ideal to and need hazard handling.
Q1g. What do you mean by data hazards in pipelining?20172m
Module 3: Pipelining
View this question on its own page →What do you mean by data hazards in pipelining?
Worked SolutionData Hazards (RAW) Definition (2 Marks)
In a pipelined processor, a data hazard occurs when an instruction depends on result of a previous instruction still in pipeline and data is not yet available.
RAW (Read After Write) - True dependence: Most common type.
I1: ADD R1, R2, R3 // R1 ← R2+R3 I2: SUB R4, R1, R5 // needs R1I2 reads R1 before I1 writes it. If I2 enters ID/EX while I1 still in EX/MEM, it reads stale value — incorrect execution.
Handling: Data forwarding/bypassing from MEM/WB to ALU input, pipeline stalling (bubble/NOP), compiler reordering.
Other types WAW and WAR cause hazards only in out-of-order pipelines.
- Install PocketlyBudget App•POCKETLY
Pocketly on Android
Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.
Q1i. Pipeline speedup ideally increases with: (i) Number of control units (ii) Size of RAM (iii) Number of pipeline stages (iv) Size of cache20252m
Module 3: Pipelining
View this question on its own page →Pipeline speedup ideally increases with:
(i) Number of control units
(ii) Size of RAM
(iii) Number of pipeline stages
(iv) Size of cacheWorked SolutionAnswer: (iii) Number of pipeline stages
Explanation:
Ideal pipeline speedup (ignoring hazards and overhead) is:where = number of stages, or more precisely for tasks:
where = stage delay. Throughput increases because multiple instructions overlap in different stages simultaneously.
(iii) is correct: More stages → finer subdivision → more instructions overlapped → higher ideal speedup (linear with ). Example: 5-stage RISC pipeline ideally gives ~5x speedup.
Why others are wrong:
- (i) Number of control units - pipelining uses one control unit with stages, not multiple CUs.
- (ii) Size of RAM / (iv) Size of cache - affects memory performance, not pipeline speedup directly.
Note: Practical speedup < due to pipeline hazards (data, control, structural), branch penalties, and latch overhead, so deeper pipeline gives diminishing returns.
Q1i. What do you mean by array processors? How are they different from scalar processors?20152m
Module 3: Pipelining
View this question on its own page →What do you mean by array processors? How are they different from scalar processors?
Worked SolutionArray Processor (Vector Processor):
An array processor is a processor that performs the same operation on multiple data elements simultaneously. It is designed for vector/array computations (matrix operations, image processing, scientific computing). It implements SIMD - Single Instruction Multiple Data architecture (Flynn's taxonomy). Example: ILLIAC-IV, BSP, GPU vector units, Intel AVX.It consists of a single Control Unit and multiple Processing Elements (PEs)/ALUs working in parallel under common control.
Scalar Processor:
A scalar processor processes one data item at a time per instruction. It executes one instruction on one operand pair sequentially. It implements SISD - Single Instruction Single Data. Example: Conventional Intel 8086, basic RISC core. To process an array of N elements, scalar must loop N times.Difference - Array vs Scalar (SIMD vs SISD):
Aspect Array (SIMD) Scalar (SISD) Parallelism Data parallelism, N PEs operate concurrently No data parallelism, sequential Instruction One instruction controls many ALUs One instruction → one ALU operation Performance High throughput for vector tasks, Lower for vector tasks, loop overhead Use Scientific, MATLAB, ML, graphics General purpose Cost/Complexity Higher hardware, interconnection network needed Simpler control In short, array processor exploits DLP to compute
C[i]=A[i]+B[i]in one step; scalar needs N iterations.Q2(a). What are the hazards in pipeline architecture? Explain its types with suitable example.20237m
Module 3: Pipelining
View this question on its own page →What are the hazards in pipeline architecture? Explain its types with suitable example.
Worked SolutionPipeline Hazards - Types with Examples (7M)
1. Pipeline Concept
Pipelining overlaps fetch-decode-execute stages of multiple instructions. Ideal speedup =nstages. But dependencies cause hazards → pipeline stalls (bubbles) or flushes, reducing throughput. Clock must also handle slowest stage + latch delay.2. What is Hazard?
Situation where next instruction cannot execute in its designated clock cycle due to resource / data / control dependency.3. Three Types (Stallings Classification):
A) Structural Hazard - Resource Conflict
Occurs when hardware resources insufficient to support overlapping execution.
Example: Single memory for instruction + data (Von Neumann). IF stage needs memory to fetch, MEM stage needs memory for load/store at same cycle.
Cycle: 1 2 3 4 5 I1: IF ID EX MEM WB I2: IF ID EX MEM* <- MEM conflict with I1 MEM I3: IF* ID ... * structural stall 1 cycleSolutions: Harvard architecture (separate I-cache/D-cache), separate Instruction & Data memories, multi-port register file, pipelined ALU.
Other example: Single ALU for EX and address calculation.
B) Data Hazard - Data Dependency
Instruction needs data still being computed/ not yet written back.
Classification per register access:
- RAW (Read After Write) - True dependency - Most common
I1: ADD R1, R2, R3 ; R1 = R2+R3 I2: SUB R4, R1, R5 ; needs R1 -> must wait for WB of I1If pipelined without forwarding, I2 reads stale R1. With 5-stage pipeline, need 2 stalls or forwarding.
- WAR (Write After Read) - Anti-dependency (only in out-of-order)
I1: ADD R2, R1, R3 ; reads R1 I2: SUB R1, R4, R5 ; writes R1 - must not overwrite before I1 reads- WAW (Write After Write) - Output dependency
I1: ADD R1, R2, R3 I2: SUB R1, R4, R5 ; both write R1 -> order mattersSub-types by pipeline stage:
- Load-Use Hazard: Load followed by use needs 1 stall even with forwarding.
LW R1, 0(R2) ADD R3, R1, R4 ; needs R1 from MEM stage - 1 bubble inserted- EX-Use Hazard: ALU result forwarded from EX/MEM latch.
Example Timing with Forwarding vs Stall:
Without forwarding: ADD R1,R2,R3 SUB R4,R1,R5 -> stall 2 cycles With forwarding (bypass EX->EX): ADD: IF ID EX MEM WB SUB: IF ID --EX-- MEM WB (forwarded path from EX/MEM to ALU input)Solutions: Data Forwarding/Bypassing, Register Scoreboarding, Tomasulo, Compiler scheduling (insert NOP), stalls/bubbles.
C) Control Hazard - Branch / Jump Hazard
Due to branches, next PC unknown until decode/execute.
BEQ R1, R2, LABEL ; branch taken ? Next instr fetch is speculative -> if taken, fetched instr wrong -> flushCycle 1: IF BEQ Cycle 2: IF next (wrong) | ID BEQ -> branch decoded Cycle 3: IF next2 | ID next | EX BEQ -> target known -> flush IF,IDPenalty = 2-3 cycles in simple 5-stage (branch resolved in EX). Modern pipelines predict.
Example:
JMP Label,CALL, interrupts.Solutions:
- Stall until target known (simple)
- Branch Prediction - Static (predict not taken) / Dynamic (1-bit, 2-bit saturating counter, BTB)
- Branch Target Buffer (BTB) + Branch History Table
- Delayed Branch - Fill delay slot with useful instruction (MIPS)
- Speculative execution + flush on mispredict
- Loop unrolling
4. Summary Table
Hazard Cause Example Stall Cycles Fix Structural Lack of HW One memory 1 Add HW, split cache RAW Data Need result ADD->SUB R1 1-2 (0 with fwd) Forwarding, NOP WAR/WAW Write conflict Out-of-order only 0 in-order Renaming Control Branch PC unknown BEQ, JMP 2-3 Predict, BTB, delay slot 5. Performance Impact
Hazard stalls increase CPI:
CPI_pipelined = 1 + stall_cycles_per_instrSpeedup = n / (1 + stalls) * (cycle_unpipelined / cycle_pipelined)Goal of hazard handling is to keep CPI ~1.
Diagram to draw in exam: 5-stage pipeline (IF-ID-EX-MEM-WB) reservation table showing overlapping and bubble insertion for each hazard type.
Q2a. Explain Flynn’s classification of computer system architecture.20147m
Module 3: Pipelining
View this question on its own page →Explain Flynn’s classification of computer system architecture.
Worked SolutionFlynn's Classification of Computer Architecture (7M)
Proposed by Michael J. Flynn (1966) - classifies parallel architectures based on number of Instruction streams vs Data streams.
Streams = independent sequence of instructions / data as seen by CPU.
Single Data (SD) One data stream ┌───────────────── │ Single Instruction │ SISD Single instruction │ stream │ (von Neumann) │ -------------------+--------------------------------- │ Multiple Instruction│ MISD Multiple instruction│ (rare - systolic) stream │ └───────────────── Multiple Data (MD) Multiple data streams Actually 2x2 grid: ┌─────────────┬──────────────┐ │ SD │ MD │ ─────────┼─────────────┼──────────────┤ SI │ SISD │ SIMD │ ─────────┼─────────────┼──────────────┤ MI │ MISD │ MIMD │ └─────────────┴──────────────┘1. SISD - Single Instruction Single Data
One instruction stream, one data stream. Sequential.
- Architecture: Conventional Von Neumann uniprocessor. One CU fetches one instruction, one ALU operates on one data element at a time. (No parallelism)
- Execution:
IF -> ID -> EX -> MEM -> WBsingle thread. - Example: Intel 8086, 80386 uniprocessor, ARM single-core, IBM 360. Old mainframes.
- Diagram:
┌────┐ ┌─────┐ ┌─────┐ ┌─────┐ │ CU |----->| PU |----->| MU | IS DS -> Single pipeline └────┘ └─────┘ └─────┘ (IS= Instruction Stream, DS=Data Stream, PU=Processing Unit, MU=Memory)- Performance: Limited by clock, CPI, pipelining is still SISD (ILP but not classified separately by Flynn). Speedup via pipelining/superscalar still logically SISD.
2. SIMD - Single Instruction Multiple Data
One instruction executed on multiple data elements in parallel (Lockstep). Data parallelism.
- Architecture: One CU broadcasts same instruction to multiple Processing Elements (PEs)/ALUs, each with own data. Requires array of processors + interconnection network (shared memory or mesh).
- Execution: Fetch once, decode once, execute simultaneously on
Ndata:
for (i=0..N-1) C[i] = A[i] + B[i]single instruction ADD does all. - Examples:
- Vector processors: Cray-1, CDC STAR-100, TI ASC
- Array processors: ILLIAC-IV (64 PEs), CM-2, DAP
- Modern: GPU warp (SIMT - extension), Intel SSE/AVX (single core SIMD within register), AVX-512 executes 16 floats per instruction, Multimedia extensions
MMX.
- Diagram:
┌────┐ │ CU |---- IS (same instruction broadcast) ----+ └────┘ | ┌──────┼──────┬───────┐ v v v v ┌────┐┌────┐┌────┐ ┌────┐ │PE0 ││PE1 ││PE2 │..│PEN │ each PE has own data DS0..DSN │ALU ││ALU ││ALU │ │ALU │ └────┘└────┘└────┘ └────┘ ↕ ↕ ↕ ↕ Data Memory Module 0..N or interleaved- Use: Matrix operations, image processing, graphics, scientific loops where same operation applied to large dataset. Excellent speedup for vectorizable code; branch divergence hurts (masking).
- Types: Word-slice vs bit-slice, true array vs vector/pipelined.
3. MISD - Multiple Instruction Single Data
Multiple instruction streams on same single data stream. Rare/ theoretical.
- Architecture: Multiple CUs each with distinct instruction on same data item, pipelined through stages. Data flows through chain of processors.
- Example / Interpretation:
- Pipeline / Systolic array where data flows
X -> PE1 (Op1) -> PE2 (Op2) -> PE3 (Op3)each stage different instruction but same datum stream - e.g., real-time signal processing, fault-tolerant systems with redundant execution for voting (N-version). - Carnegie Mellon C.mmp (conceived but no commercial)
- Some view pipeline within single CPU as MISD-like (IF,ID,EX operate on same instruction stream overlapped) but not true.
- Pipeline / Systolic array where data flows
- Diagram:
DS ---->┌────┐ ┌────┐ ┌────┐ │PE0 │--->│PE1 │--->│PE2 │----> Result IS0---->|CU0 | IS1|CU1 | IS2|CU2 |- Use: Almost no general-purpose machine purely MISD; considered for specialized: multiple frequency filters on same sample stream, cryptographic pipelines.
4. MIMD - Multiple Instruction Multiple Data
Multiple instruction streams, multiple data streams. True parallelism - autonomous processors.
- Architecture: Multiple independent processors (each with own CU+ALU+Memory/Local) work on own instruction & data. Two flavors:
- Shared Memory (Tightly coupled): SMP (Symmetric Multiprocessors) - bus/cache coherent shared address space. E.g., Multicore CPU (Intel i7 8 cores), Xeon server.
- Distributed Memory (Loosely coupled): Message-passing - cluster, network of workstations (NOW), supercomputer. E.g., Beowulf cluster, IBM BlueGene, NUMA.
- Execution: MIMD can execute completely independent tasks (MIMD - multiple Programs) or cooperate on single problem (parallel programs) via synchronization (lock, barrier, MPI_Send).
- Examples: Multicore processors, Multiprocessors, Clusters, Grids, Multi-computer (Cray T3D, Intel Paragon).
- Diagram:
┌────┐ ┌────┐ ┌────┐ ┌────┐ │CU0 │->│PE0 │->DS0 │CU1 │->│PE1 │->DS1 └────┘ └────┘ └────┘ └────┘ IS0 \ shared/ \ IS1 Distribution Network (Bus/Crossbar/Network) ┌────┐ ┌────┐ ┌────┐ ┌────┐ │CUN │->│PEN │->DSN etc. └────┘ └────┘- Use: General-purpose parallel computing - database servers, OS multitasking, HPC. Most flexible; speedup limited by Amdahl's law:
Speedup = 1 / (f + (1-f)/N).
Comparison Table
Class Instr Streams Data Streams Parallelism Examples Use Case SISD 1 1 None (sequential) 8086, ARM single Basic PC SIMD 1 N Data parallel ILLIAC, GPU warp, AVX Vector/matrix MISD N 1 Pipeline on data Systolic (rare) Fault tolerance, pipeline MIMD N N Task parallel Multicore, Cluster General parallel Extended Classifications (Johnson, later): SISD vs pipelines etc., but Flynn remains standard.
For exam: Draw 4 quadrants diagram + small block for each type with CU/PE and arrows.
Q3. Discuss Flynn’s classification of computer.201614m
Module 3: Pipelining
View this question on its own page →Discuss Flynn’s classification of computer.
Worked SolutionFlynn's Classification (1966) – based on number of Instruction streams and Data streams
Streams = sequence of instructions / data operated by CPU.
Single Data (SD) Multiple Data (MD) Single Instruction (SI) SISD SIMD Multiple Instruction (MI) MISD MIMD 1. SISD – Single Instruction Single Data
- One control unit, one ALU, one data stream. Sequential execution (von Neumann).
- Eg: Uniprocessor 8086, RISC, single-core CPU.
- Instruction: then …
- No parallelism. Performance via pipelining.
CU ---> PU ---> Memory 1 1 12. SIMD – Single Instruction Multiple Data
- One instruction stream broadcast to many processing elements (PEs), each with own data.
- Array / Vector processors, GPU.
- Eg: ILLIAC-IV, Vector supercomputers, MMX/SSE, GPU warps.
- Operation: One opcode
ADDexecutes on vectors in lockstep.
CU | +------+------+------+ PE PE PE PE D1 D2 D3 D4- Exploits data parallelism, high throughput for multimedia, matrix ops. Requires synchronous control.
3. MISD – Multiple Instruction Single Data
- Many instructions operate on same data stream. Rare / theoretical.
- Eg: Systolic arrays, fault-tolerant systems where same data through different algorithms (-version programming), pipeline MISD interpretation: successive stages apply different operations on same data flowing through.
- No commercial general MISD.
CU1 ---> PU1 --\ CU2 ---> PU2 ---> same Data stream (pipelined) CU3 ---> PU3 --/4. MIMD – Multiple Instruction Multiple Data
- Multiple autonomous processors each with own instruction and data stream. Most general, multiprocessors / multicomputers.
- Two subclasses:
- Tightly coupled / Shared memory (SMP, multi-core): All CPUs share common RAM via bus/crossbar. Eg: Intel i7 quad-core, Xeon.
- Loosely coupled / Distributed memory (message passing): Each node has private memory, communicates via network. Eg: Clusters, supercomputers (Beowulf).
CU1->PU1->M1 \ CU2->PU2->M2 ---> Interconnection Network CU3->PU3->M3 /- Exploits task parallelism, true concurrency, scales (but needs synchronization, coherence).
Summary Table
Type #CU #PU Use Example Parallelism SISD 1 1 General 8086, ARM single ILP only SIMD 1 N Vector GPU, AVX Data MISD N 1 Special Systolic, fault-tolerant Rare MIMD N N General parallel Multi-core, Cluster Task/Data Extended taxonomies: SPMD (Single Program Multiple Data – subset of MIMD), MPMD. Modern machines are hybrid: MIMD of SIMD cores (multi-core GPU).
Diagram: All 4 types [SISD = single lane, SIMD = single instruction fan-out, MISD = multiple instr single data pipeline, MIMD = multiple independent lanes].
Q3. ### 3. A program runs on a 10 GHz CPU with the instruction mix and corresponding clock cycle count as given in the table: | Instruction type | Clock cycle count | Instruction count | | ---------------- | ----------------- | ----------------- | | Control transfer | 5 | 5000 | | Data transfer | 4 | 4000 | | Floating point | 2 | 2000 | | Integer | 1 | 1000 | --- ### Determine the following: - (a) CPI - (b) Execution time - \(c\) MIPS rate for program201414m
Module 3: Pipelining
View this question on its own page →3. A program runs on a 10 GHz CPU with the instruction mix and corresponding clock cycle count as given in the table:
Instruction type Clock cycle count Instruction count Control transfer 5 5000 Data transfer 4 4000 Floating point 2 2000 Integer 1 1000
Determine the following:
- (a) CPI
- (b) Execution time
- (c) MIPS rate for program
Worked SolutionGiven Data
Clock GHz ns s
Type CPI () Control 5 5000 Data transfer 4 4000 Floating 2 2000 Integer 1 1000 Total instructions
Total cycles
cycles(a) CPI (Average Clock Cycles per Instruction)
cycles/instr
If weighted:
(b) Execution Time
s
Alternatively
(if , )
(c) MIPS Rate
MIPS MIPS BIPS
Check:
If using MIPS = I/(T in ) same result.
Summary: CPI , at 10GHz ( at 1GHz), ~2609 MIPS.
Q4(b). Explain two techniques for enhancing the performance of computers with multiple execution pipelines.20227m
Module 3: Pipelining
View this question on its own page →Explain two techniques for enhancing the performance of computers with multiple execution pipelines.
Worked SolutionTwo Techniques for Enhancing Performance with Multiple Execution Pipelines
Multiple execution pipelines (superscalar / superpipelined architecture) allow Instruction Level Parallelism (ILP) by executing more than one instruction per clock. Two key techniques:
1. Superscalar Execution (Multiple Issue Pipeline)
- Concept: Processor contains parallel pipelines (e.g., Integer pipe, FP pipe, Load/Store pipe). In each cycle, issue logic fetches and issues instructions simultaneously (-way superscalar) if no dependencies.
- Hardware required:
- Multiple functional units: ALU1, ALU2, FPU, Branch unit, Load/Store unit
- Instruction Fetch & Decode capable of instructions/cycle
- Dependency checking / Scoreboarding / Tomasulo algorithm to detect data hazards (RAW, WAR, WAW)
- Register renaming to remove false dependencies
- Example: 2-way superscalar can issue
ADD R1,R2,R3andMUL R4,R5,R6together if independent. - Advantage: Increases throughput ideal CPI (e.g., CPI 0.5 for 2-way). Exploits ILP without compiler support (dynamic).
- Limitation: Complex issue logic, requires out-of-order execution and large window; limited by true dependencies and branches.
2. Superpipelining and Out-of-Order / Speculative Execution (Complementary techniques)
Often paired with superscalar; other major technique is VLIW-like / Superpipelined + Branch Prediction & Speculative Execution (can also be answered as Superpipelining or VLIW).
a) Superpipelining:
- Divides pipeline into many finer stages (e.g., 8-10 stages vs classic 5-stage: IF1, IF2, ID1, ID2, EX1, EX2, WB). Clock period = 1/m of base, so multiple instructions are in different sub-stages of same functional pipe - higher clock rate.
- Combination
Superscalar + Superpipelining= Super-speculative processor (e.g., Pentium 4).
b) Out-of-Order Execution + Register Renaming + Speculative/Branch Prediction (essential to keep multiple pipelines busy):
- Multiple pipelines stall on hazards/branches. Solution:
- Register Renaming: maps architectural registers to larger physical register file to eliminate WAR/WAW, allowing parallel execution.
- Out-of-Order Execution: Instructions wait in Reservation Stations; execute as soon as operands ready, not program order. ReOrder Buffer (ROB) commits in order.
- Branch Prediction + Speculative Execution: Predict branch direction (2-bit predictor, BTB) and speculatively execute down predicted path to keep pipelines filled. On mispredict, flush.
- Dynamic Scheduling: Tomasulo / Scoreboard.
Alternative valid answer - VLIW (Very Long Instruction Word):
Compiler packs independent operations into one very long instruction word (e.g., 128-256 bit). Hardware is simple (no dependency check), compiler does static scheduling. Example: IA-64/Itanium. Merits: simple hardware; Demerits: poor code density, compiler dependent, binary incompatibility.Performance gain summary: With pipelines ideal speedup if hazards avoided. Combination of ** Superscalar (space parallelism) + Superpipelining (time parallelism) + OOO/Speculation/Renaming** yields practical speedup 1.5x-3x per core.
Feature Superscalar Superpipeline/VLIW Parallelism Space - multiple pipes Time - finer clocks / compiler-packed Dependency check Hardware dynamic VLIW: Compiler static Complexity High hardware VLIW: simple HW, complex compiler Q5. What are the different conflicts that will arise in pipeline (elaborate)? How do you remove the conflicts?201714m
Module 3: Pipelining
View this question on its own page →What are the different conflicts that will arise in pipeline (elaborate)? How do you remove the conflicts?
Worked SolutionPipeline Conflicts (Hazards) and Remedies
Pipeline ideally gives 1 instruction per cycle, but dependencies cause hazards that stall/flush pipeline.
1. Structural Hazards (Resource Conflicts)
- Cause: Two stages need same hardware same cycle. e.g., single memory for IF and MEM stage; single ALU; register file with one write port but two instructions need write.
- Example: 4-stage pipeline with IF and MEM sharing memory -> IF of I4 conflicts with MEM of I1.
- Solutions:
- Separate Instruction and Data caches (Harvard) / L1 split - simultaneous IF+MEM.
- Multiple functional units, pipelined units, extra ports on register file.
- Stall (bubble) - hardware interlock delays one instruction.
2. Data Hazards (Data Dependency)
- RAW - Read After Write (True):
ADD R1,R2,R3 ; SUB R4,R1,R5- second needs R1 before first writes. Classic.- Sub-types: distance 1,2 hazards in pipeline.
- WAR - Write After Read and WAW - Write After Write (false dependencies) - occur in OOO / superscalar pipelines due to register reuse.
- Effects: Wrong operand value if pipeline forwards unupdated register.
- Solutions:
- Data Forwarding / Bypassing: Directly route ALU output to next instruction's ALU input via forwarding path (EX->EX, MEM->EX) - avoids stall for most RAW.
- Stall / Pipeline Interlock + NOP injection: Compiler/hardware inserts bubble when forwarding insufficient (e.g., Load-Use hazard:
LW R1,0(R2) ; ADD R3,R1,R4- needs one stall because data available after MEM). - Register Renaming: Remove WAR/WAW by mapping to physical registers (Tomasulo).
- Compiler Scheduling: Reorder independent instructions between dependent pair:
LW R1; ... independent ... ; USE R1 - Out-of-Order Execution + Scoreboarding: Execute independent instructions while dependent waits in reservation station.
3. Control Hazards (Branch Hazards)
- Cause: Pipeline doesn't know next PC after Branch/Jump until decode/execute stage. Fetches wrong path.
- Example:
BEQ R1,R2, Label- 2-3 instructions after branch already fetched before condition resolved. - Penalties: Flush 1-3 cycles (branch penalty) ~10-20% performance loss if ~15% branches.
- Solutions:
- Stall + Flush: On branch detection, freeze IF/ID, flush wrong path once target known (simple, slow).
- Branch Prediction: Predict taken/not-taken.
- Static: Predict not-taken or compiler hint.
- Dynamic: 1-bit / 2-bit saturating counter, Correlated (Gshare), BTB (Branch Target Buffer) to store target. Accuracy 90-95% -> penalty only on mispredict.
- Delayed Branch (Branch Delay Slot): Architecturally fill slot after branch with useful independent instruction - used in MIPS.
- Predicated Execution: Convert branch to conditional move
CMOV-> no flush. - Speculative Execution: Execute predicted path speculatively with ROB, rollback on mispredict.
- Loop Buffer / Branch Target Cache: Cache branch targets.
Summary Table
Hazard Cause Detection Remedy Cost Structural Resource sharing Scheduler Duplicate resources, split cache Hardware cost Data RAW Register dependency Comparator on RD vs RS Forwarding + stall if load-use 1 bubble if not forwarded Control PC change Branch logic Predict, delayed branch, flush 1-3 cycles mispredict penalty Overall techniques to keep pipeline busy: Forwarding (data), Prediction + Speculation (control), Superscalar OOO + Renaming.
Ideal CPI =1, actual CPI =1 + stall cycles per instruction. With forwarding+prediction CPI ~1.1-1.3 instead of ~1.6 without.
Q6. What is meant by pipelining? Why do we require instruction pipelining? Explain its working procedure. Discuss the pipeline performance measures.201614m
Module 3: Pipelining
View this question on its own page →What is meant by pipelining? Why do we require instruction pipelining? Explain its working procedure. Discuss the pipeline performance measures.
Worked SolutionPipelining
1. Definition
Pipelining is an implementation technique where multiple instructions are overlapped in execution, analogous to an assembly line. Each instruction is split into sequential stages; different stages of successive instructions execute concurrently using separate hardware resources.
Ideally -stage pipeline can execute instructions simultaneously and achieve speedup .
2. Why Require Instruction Pipelining?
- Performance without increasing clock rate: Single-cycle CPU has long critical path (IF+ID+EX+MEM+WB). Pipelining breaks it into shorter stages -> higher clock frequency and throughput.
- Exploit Instruction-Level Parallelism (ILP): Sequential model wastes hardware when one unit is active, others idle. Pipelining keeps all units busy.
- CPI approaches 1: Without pipeline CPI = 1 (single-cycle) but long or CPI >1 (multi-cycle). With pipeline, throughput = 1 instruction/cycle in steady state.
- Cost-effective speedup: No need for multiple CPUs; just pipeline registers.
3. Working Procedure (5-stage Classic RISC Pipeline)
Stages:
- IF - Instruction Fetch:
IR <- M[PC]; PC <- PC+4 - ID - Instruction Decode/Register Fetch: decode opcode, read , generate immediates.
- EX - Execute/ALU: ALU operation or effective address
ALUout <- Rs op RtorRs + imm - MEM - Memory Access:
MDR <- M[ALUout]for LOAD orM[ALUout] <- Rtfor STORE - WB - Write Back:
Rd <- ALUoutorRd <- MDR
Pipeline registers between stages: IF/ID, ID/EX, EX/MEM, MEM/WB isolate stages.
Timing diagram (no hazards, 5 instructions):
Cycle: 1 2 3 4 5 6 7 8 I1: IF | ID | EX | MEM| WB | I2: IF | ID | EX | MEM| WB | I3: IF | ID | EX | MEM| WB | I4: IF | ID | EX | MEM| WB | I5: IF | ID | EX | MEM| WB |After 5 cycles (fill), one instruction completes per cycle.
Non-pipelined: 5 cycles per instruction sequentially -> 25 cycles for 5 instr. Pipelined: 9 cycles.
Hazards (practical issues)
- Structural: two instr need same resource (e.g., single memory for IF and MEM) - solve by separate I/D caches.
- Data hazard:
I2needs result ofI1(RAW) - forward/bypass or stall (bubble). - Control hazard: branch target unknown until ID/EX - flush pipeline, branch prediction.
4. Pipeline Performance Measures
Let = stages, = time per stage, = latch overhead, = number of instructions.
Clock period: vs
Time for n instructions:
(ideal)Speedup: . For , (ideal).
With overhead:Efficiency: . For large , .
Throughput: instr/sec in steady state (vs non-piped). .
CPI: Ideal CPI = 1, effective CPI = (due to hazards).
Example: , , : , , , .
Pipeline improves throughput, not single-instruction latency (latency stays ). Maximum speedup limited by stage imbalance, latches, and hazards.
Q6(a). A non-pipeline system takes 50 seconds to process a task. The same task can be processed in a six-segment pipeline with a clock cycle of 10 seconds. Determine the speedup ratio of the pipeline for 100 tasks.20247m
Module 3: Pipelining
View this question on its own page →A non-pipeline system takes 50 seconds to process a task. The same task can be processed in a six-segment pipeline with a clock cycle of 10 seconds. Determine the speedup ratio of the pipeline for 100 tasks.
Worked SolutionSolution - Speedup Ratio of Pipeline (Q6a, 2024)
Given:
- Non-pipeline time per task sec
- Number of pipeline segments
- Pipeline clock cycle time sec
- Number of tasks
1. Time without pipeline (Sequential):
2. Time with pipeline:
The first task takes to fill the pipeline, then one task completes every .3. Speedup Ratio ():
Interpretation:
- Theoretical maximum speedup = . As , .
- For , speedup is 4.76, i.e., pipeline is 4.76 times faster than non-pipeline for 100 tasks.
- Efficiency or .
Answer: Speedup 4.76 (1050 sec vs 5000 sec). If is very large, speedup approaches 5.
Note: If clock cycle were sec ideally, speedup would approach 6. Here sec > ideal, so overhead reduces speedup.
- Install PocketlyBudget App•POCKETLY
Pocketly on Android
Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.
Q6(b). What are pipeline hazards? Explain different types of hazards in pipelining.20247m
Module 3: Pipelining
View this question on its own page →What are pipeline hazards? Explain different types of hazards in pipelining.
Worked SolutionSolution - Pipeline Hazards and Types
Pipeline Hazard: A situation that prevents the next instruction in the pipeline from executing during its designated clock cycle. It causes stalls/bubbles, reduces speedup and throughput, breaking ideal pipeline flow.
Three Major Types:
1. Structural Hazards (Resource Conflict):
Occurs when hardware resources required by two or more instructions overlap in same clock cycle.- Cause: Insufficient hardware duplication. E.g., single memory for both instruction fetch and data access (von Neumann), single ALU, single register file write port.
- Example: In 4-stage pipeline IF-ID-EX-MEM, if instruction I1 is in MEM accessing memory and I4 needs IF at same time with single memory port - conflict.
- Solution: Separate instruction and data memories (Harvard), duplicate resources, pipeline register file, stall pipeline (bubble).
2. Data Hazards (Data Dependency):
Occurs when instructions exhibit data dependency and pipeline changes order of read/write accesses.
There are three types:- RAW (Read After Write) - True Dependency: tries to read operand before writes it.
ADD R1,R2,R3;SUB R4,R1,R5-> SUB needs R1 before ADD writes. Most common. Causes stalls. - WAR (Write After Read) - Anti-dependency: writes before reads. Occurs in out-of-order execution.
ADD R1,R2,R3;MUL R2,R4,R5-> MUL writes R2 before ADD reads it. - WAW (Write After Write) - Output dependency: Both write same register out-of-order.
ADD R1,R2,R3;MUL R1,R4,R5-> ordering of writes matters. - Solutions: Data forwarding/bypassing, operand forwarding, compiler reordering, pipeline interlocks, register renaming, stalling.
3. Control Hazards (Branch Hazards):
Occurs due to branch instructions (conditional/unconditional) - pipeline doesn't know next PC until branch is resolved.- Example:
BEQ R1,R2,target- whether to fetch next sequential instruction or target is unknown until EX/MEM stage. Fetching wrong instruction causes flush. - Penalty: If pipeline has 5 stages and branch resolved at stage 3, 2 instructions already fetched must be flushed if branch taken.
- Solutions:
- Stall/Flush: freeze pipeline until branch resolved (simple but slow).
- Branch Prediction: static (predict not-taken) or dynamic (2-bit predictor, BTB).
- Delayed Branch: compiler fills delay slot with useful independent instruction after branch.
- Branch Target Buffer (BTB) and Prefetch.
Additional: Some textbooks add Pipeline Data Hazards sub-class and mention handling via scoreboarding/Tomasulo.
Hazards reduce ideal CPI=1 to CPI >1; effective speedup .
Q7. A non-pipelined processor has a clock rate of 2.5 GHz and an average CPI (cycles per instruction) of 4. An upgrade to the processor introduces a five-stage pipeline. However, due to internal pipeline delays, such as latch delay, the clock rate of the new processor has to be reduced to 2 GHz. (a) What is the speedup achieved for a typical program? (b) What is the MIPS rate for each processor?202214m
Module 3: Pipelining
View this question on its own page →A non-pipelined processor has a clock rate of GHz and an average CPI (cycles per instruction) of . An upgrade to the processor introduces a five-stage pipeline. However, due to internal pipeline delays, such as latch delay, the clock rate of the new processor has to be reduced to GHz.
(a) What is the speedup achieved for a typical program?
(b) What is the MIPS rate for each processor?
Worked Solution(a) Speedup
Let = no. of instructions.
Non-pipelined:
- Clock
Time per instruction .
Pipelined (5-stage, ideal, no hazards):
- Ideal (one instruction completes per cycle in steady state). Ignoring fill/drain overhead for large : .
With fill overhead: where , for .
So speedup in the ideal hazard-free case. If pipeline stalls/hazards raise to e.g. 1.2 then .
Maximum theoretical speedup ignoring clock reduction: ; with clock penalty , net .
(b) MIPS rate
Non-pipelined:
Pipelined (ideal ):
If hazards included, e.g. , . In general .
Throughput gain same as speedup.
Q7a. Explain the basic concepts of pipelining, including speedup and throughput. Discuss pipeline hazards.20257m
Module 3: Pipelining
View this question on its own page →Explain the basic concepts of pipelining, including speedup and throughput. Discuss pipeline hazards.
Worked SolutionPipelining - Basic Concepts
Pipelining is an implementation technique where multiple instructions are overlapped in execution, like an assembly line. An -stage pipeline divides instruction execution into stages (classic RISC: IF-ID-EX-MEM-WB) operating concurrently.
Basic Operation
Each stage has combinational logic + pipeline register/latch. Clock period . While stage processes instruction , stage processes .
For , instructions: non-pipelined time , pipelined time .
Speedup
Ideal speedup = number of stages. With stage imbalance and latch overhead: .Example , : .
Efficiency , Throughput instructions/sec = (one per cycle).
Throughput
Rate of instruction completion. Non-pipelined: , Pipelined (steady): . Improvement factor same as speedup. Supercalar/superpipelined increase further.
Pipeline Hazards - prevent next instruction from executing in next cycle
1. Structural Hazards: Hardware resource conflict (e.g. single memory for IF+MEM, single ALU). Solution: Separate I/D caches (Harvard), duplicate units, stalling (bubble).
2. Data Hazards: Dependency on previous result still in pipe.
- RAW (true)
ADD R1,R2,R3followed bySUB R4,R1,R5(R1 not written back) - WAR, WAW in out-of-order pipes.
Solution: Forwarding/bypassing (EX→EX), compiler code scheduling, pipeline interlock + stall, register renaming.
3. Control Hazards: Branch/jump changes PC, next fetched instructions wrong.
- Unconditional: 1-cycle bubble
- Conditional: taken/not-taken decision at EX/MEM → flush.
Solutions: Stall/flush, branch prediction (static: not-taken/backward-taken; dynamic: 2-bit saturating counter, BTB), delayed branch (branch delay slot, predication), speculative execution.
Additional classification Data hazards = load-use:
LW R1,0(R2); ADD R3,R1,R4requires 1 stall even with forwarding (mem latency).Performance impact: ; .
Ideal pipeline CPI=1, real due to hazards; longer pipe → higher hazard penalty.
Diagram should show 5 stages overlapped in time (Gantt chart) and hazard bubble insertion.
- RAW (true)
Q7b. Describe parallel processors and the problem of cache coherency in shared memory systems.20257m
Module 3: Pipelining
View this question on its own page →Describe parallel processors and the problem of cache coherency in shared memory systems.
Worked SolutionParallel Processors
Parallel processors execute multiple operations concurrently to increase throughput. Classified by Flynn's taxonomy:
- SISD: Single Instruction Single Data - conventional uniprocessor.
- SIMD: Single Instruction Multiple Data - array/vector processors, e.g., GPU, vector supercomputer.
- MISD: Multiple Instruction Single Data - rare, pipelined architectures.
- MIMD: Multiple Instruction Multiple Data - most parallel computers. Two models:
- Shared Memory (Tightly coupled): All processors share a common main memory via interconnection network (bus, crossbar, multistage). Sub-types: UMA (uniform memory access / SMP) - equal access time; NUMA - distributed shared memory, non-uniform latency; COMA/COMA.
- Distributed Memory (Loosely coupled): Each processor has private memory, communicates via message passing.
- Multicore / Multiprocessor: Modern CMPs are MIMD shared-memory on single chip.
Parallelism levels: Job-level, task-level, instruction-level and loop-level.
Cache Coherency Problem in Shared Memory
In shared-memory MIMD, each processor has private cache for latency reduction. Coherency problem: If multiple caches hold a copy of same memory block , and one processor writes , other copies become stale, leading to inconsistent views.
Example: and cache . does in its cache, still sees . Memory may be 5 or 10 depending on write-through/write-back - inconsistency.
Coherence requires: (1) Writes to same location seen in same order by all processors (write serialization), (2) Read returns last written value.
Solutions:
Snooping (Snoopy) Protocol - for bus-based SMPs: Every cache monitors (snoops) bus transactions.
- Write-Invalidate: On write hit, processor broadcasts invalidate to all other caches holding block. Others discard copy. Most common (MESI/MOESI).
- Write-Update (Write-Broadcast): Write is broadcast to update all copies.
Directory-Based Protocol - for scalable networks / NUMA: Central directory keeps state of each block (which caches have copy, dirty/clean). On write, directory sends point-to-point invalidates only to holders. Avoids broadcast overhead.
MESI States (Illinois Protocol):
- M (Modified): Dirty, exclusive.
- E (Exclusive): Clean, exclusive.
- S (Shared): Clean, may be shared.
- I (Invalid): Not valid.
On Read Miss → BusRd, on Write → BusRdX / BusUpgr, state transitions enforce coherence.
Coherence is handled in hardware; software must ensure consistency model (sequential consistency, etc.).
Q8(a). The stage delays in a four-stage pipeline are 800, 500, 400 and 300 picoseconds. The first stage (with delay 800 picoseconds) is replaced with a functionally equivalent design involving two stages with respective delays 600 and 350 picoseconds. What would be the throughput increase (in percentage) of the pipeline?20237m
Module 3: Pipelining
View this question on its own page →The stage delays in a four-stage pipeline are 800, 500, 400 and 300 picoseconds. The first stage (with delay 800 picoseconds) is replaced with a functionally equivalent design involving two stages with respective delays 600 and 350 picoseconds. What would be the throughput increase (in percentage) of the pipeline?
Worked SolutionGiven stage delays: , , , ps. Pipeline clock (+ latch overhead ignored).
Before modification:
Throughput instructions per ps.After splitting first stage into ps + ps, stages become: .
Throughput increase:
Speedup .
If latch overhead (e.g., 20ps) included, then , , increase for ps. Ideal approx 33.33% increase.
Note: Total latency increases slightly ( ps → ps) but steady-state throughput improves due to smaller max stage delay (pipeline bottleneck reduced).
Q8b. What are hazards in pipeline architecture? Explain its types with suitable examples.20197m
Module 3: Pipelining
View this question on its own page →What are hazards in pipeline architecture? Explain its types with suitable examples.
Worked SolutionHazards in Pipeline Architecture (7 Marks)
Pipelining overlaps fetch-decode-execute stages to increase throughput (ideal CPI=1). Hazards prevent next instruction from executing in designated cycle, causing stalls/bubbles.
1. Structural Hazards – Resource Conflict
Two instructions need same hardware at same time.
Example: Single memory for instruction + data. Stage IF and MEM both need memory in same cycle. Solution: separate I-Cache/D-Cache (Harvard) or stall.
Other examples: Single ALU used for EX and address calculation; insufficient registers ports.2. Data Hazards – Data Dependency
Occurs when instruction depends on result of previous instruction not yet completed. Three types:a) RAW (Read After Write) – True Dependency: reads register writes.
ADD R1,R2,R3 ; R1 written SUB R4,R1,R5 ; R1 read – needs forwarding/stallMost common. Solved by forwarding/bypassing, operand forwarding, compiler reordering, stalling.
b) WAR (Write After Read) – Anti-Dependency:
ADD R4,R1,R5 SUB R1,R2,R3 ; writes R1 before first reads itNot in classic 5-stage in-order pipeline but appears in out-of-order execution. Solved by register renaming.
c) WAW (Write After Write) – Output Dependency:
ADD R1,R2,R3 SUB R1,R4,R5 ; both write R1Also for out-of-order. Solved by renaming.
3. Control Hazards (Branch Hazards)
Caused by branches/jumps – next PC unknown until branch resolved.BEQ R1,R2, LABEL ; whether to take branch known in EX/MEM ADD R3,R4,R5 ; next instruction fetched incorrectly if branch takenPenalty = flush pipeline. Solutions:
- Stall until decision known
- Branch prediction (static: predict not taken; dynamic: 1-bit/2-bit predictor, BTB)
- Delayed branch (fill delay slot with useful/no-op instruction)
- Speculative execution
All hazards reduce speedup: .
Q9a. What is an array processor? Explain SIMD array processor with a suitable example.20197m
Module 3: Pipelining
View this question on its own page →What is an array processor? Explain SIMD array processor with a suitable example.
Worked SolutionArray Processor and SIMD Array Processor [7M]
Classification (Flynn):
SISD (Single Instruction Single Data - uniprocessor), SIMD (Single Instruction Multiple Data - array/vector), MISD, MIMD (multiprocessor).What is Array Processor?
Processor that performs same operation on multiple data elements simultaneously via array of Processing Elements (PEs). Specially for vector/matrix operations: image processing, scientific simulation, ML.Also called Vector processor if pipelined single ALU, Array processor if many ALUs.
SIMD Array Processor Architecture:
+-------------------+ | Control Unit (CU)/| | Instruction Unit |--- Master Control (Fetch/Decode) +---------+---------+ | broadcast +-------------+-------------+ | | | PE0 PE1 .... PE_{n-1} |ALU|RAM| |ALU|RAM| |ALU|RAM| \ | / +---- Interconnection N/w ----+ (Mesh, Cube, Bus, Crossbar) | Shared Memory / I/OComponents:
- Master Control Unit / Front-end CPU: Fetches/decodes instructions, executes scalar instructions, broadcasts vector instruction and address to all PEs.
- N Processing Elements (PEs): Each has own ALU, local memory/registers, and indexing logic. Identical. e.g. 64 to 65536 PEs.
- Interconnection Network: Permits data exchange between PEs: nearest neighbour mesh, hypercube, crossbar. Needed for permutations (shuffle, transpose).
- Mask register: Enables/disables subset of PEs for conditional execution (
if).
Execution: Single instruction stream -> all enabled PEs execute lock-step synchronously on their own data stream element. E.g.
Instruction: C[i] = A[i] + B[i] for i=0..1023 CU broadcasts ADD PE0: C0 = A0+B0 PE1: C1 = A1+B1 (...1024 parallel) ...Time taken = 1 vector instruction vs 1024 SISD loop iterations.
Example:
- ILLIAC IV (historical): 64 PEs in 8x8 mesh, CU broadcast, used for air dynamics.
- BSP (Burroughs Scientific Processor): 16 PEs.
- Modern: GPU (NVIDIA) - each SM is SIMD (warp of 32 threads executes same instruction - SIMT variant), Intel AVX-512 (vector width 16 floats), Connection Machine CM-2 (65536 bit-serial PEs).
Another example: Adding two matrices: distribute rows to 4 PEs, single
ADDdoes 16 additions in parallel.Advantages:
- Huge speedup for data-parallel problems: .
- Simple control (single fetch unit), regular structure, high throughput per cost.
Limitations:
- Only data-parallel problems benefit; branching causes idle PEs (divergence).
- Requires alignment of data; communication overhead via network.
- Amdahl's law: scalar part limits. I/O handling through CU bottleneck.
vs MIMD: Multiple instruction streams (multicore) more general but complex control.