You are on page 1of 26

Syllabus Topic

Basic Concepts of Pipelining Instruction pipelining Hazards

Parallel computers are those system that emphasize parallel processing. On the basis of architectural features parallel computing is mainly divided into :Pipelining Vector Processing Array Processing Multiprocessor Systems

Basic Concepts of Pipelining

It 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. A pipeline can be visualizes as a collection of processing segments through which binary information flows. Each segment performs partial processing dictated by the way the task is partitioned. The result obtained from the computation in each segment is transferred to the next segment in the pipeline.

The simplest way of viewing the pipeline structure is that each segment consists of an input register followed by a combinational circuit. The register holds the data and the combinational circuit performs the sub operation in the particular segment. The output of the combinational circuit in a given segment is applied to the input of the next segment. A clock is applied to all registers after enough time has elapsed to perform all segment activity

Suppose that we want to perform the combined multiply and add operations with a stream of numbers. Ai * Bi + Ci for i=1,2,37

Each sub operation is to be implemented in a segment within a pipeline. Each segment has one or two registers and a combinational circuit. R1 through R5 are registers that receive new data with every clock pulse.

The multiplier and adder are combinational circuits The sub operations performed in each segment of the pipeline as follows:
R1<- Ai, R2<- Bi Input Ai and Bi R3<- R1*R2, R4<- Ci Multiply and input C R5<-R3+R4 Add Ci to the product The five registers are loaded with new data every clock pulse

The first clock pulse transfers A1 and B1 into R1 and R2. The second clock pulse transfers the product of R1 and R2 into R3 and C1 into R4. The same clock pulse transfers A2 and B2 into R1 and R2. The third clock pulse operates on all three segments simultaneously. It places A3 and B3 into R1 and R2, transfers the product of R1 and R2 into R3, transfers C2 into R4, and places the sum of R3 and R4 into R5. It take three clock pulses to fill up the pipe and retrieve the first output from R5.

From there on, each clock produces a new output and moves the data one step down the pipeline. This happens as long as new input data flow into the system. When no input data are available , the clock must continue until the last output emerges out of the pipeline.

Limitations of pipeline Different segments may take different times to complete their sub operation The clock cycle must be chosen to equal the time delay of the segment with the maximum propagation time. This causes all other segments to waste time while waiting for the next clock.

There are two areas of computer design where the pipeline organization is applicable.
Arithmetic Pipeline Instruction Pipeline

An Arithmetic pipeline divides an arithmetic operation into sub operation for execution in the pipeline segments. An Instruction pipeline operates on a stream of instructions by overlapped the fetch, decode and execute phases of instruction cycle

Instruction Pipelining

An instruction pipeline reads consecutive instruction from the memory while previous instruction are being executed in other segments. This causes the instruction fetch and execution phases to overlap and perform simultaneous operations.

One possible digression associated with such a scheme is that an instruction may cause a branch out of sequence. In that case the pipeline must be emptied and all instructions that have been read from memory after the branch instruction must be discarded

Segments required to process each complex instruction are:


1. Fetch the instruction from the memory. 2. Decode the instruction. Calculate the effective address. 3. Fetch the operands from the memory. Execute the instruction 4. Store the result in the proper place

In non pipelined computers, these four steps must be completed, before the next instruction can be issued. But in pipelined computer, successive instructions are executed in an overlapped fashion

In non pipelined computers all the above steps for the execution of an instruction are first completed, then the next instruction would be fetched from the memory for execution. In a pipelined computer, while an instruction is fetched, the other is decoded. It is also possible that the operand is being fetched for the fourth instruction , the third instruction is being executed. The instructing fetching unit, the instructing decoding unit, operand fetching unit and the execution unit, all would operate simultaneously in a pipelined operation.

In the above figure four stage pipelining is illustrated. It is assumed that all 4 stages would need equal durations for execution. Suppose that there are five instruction and each instruction four stages. Also each stage consume one unit of time. Therefore total consumed would be 20units, i.e. multiple of 5 instructions * 4 stages * 1 unit of time.

By using instruction pipelining it would reduce the total time required to execute 5 instruction to 8 units.

Hazards

There are three major difficulties that cause the instruction pipeline to deviate from its normal operation
1. Resource Conflict: caused by access to memory by two segments at the same time. Most of these conflicts can be resolved by using separate instruction and data memories.

2. Data Dependency conflict arise when an instruction

depends on the result of previous instruction, but this result is not yet available. i.e. a collision occurs when an instruction cannot proceed because previous instruction did not complete certain operations and the data that are not yet available. For example, an instruction in the FO segment may need to fetch an operand that is being generated at the same time by the previous instruction segment in EX. Therefore, the second instruction must wait for data to become available by the first instruction

3. Branch difficulties arise from branch and other instructions that change the value of PC. Branch instruction breaks the normal sequence of the instruction stream, causing difficulties in the operation of the instruction pipeline. Branch instruction can be conditional or unconditional. Unconditional branch always alter the sequential program flow by loading the PC with the target address. In a conditional branch, the control selects the target instruction if the condition is satisfied or the next sequential instruction if the condition is not satisfied.

You might also like