Docsity

Control Transfer Instructions and Branching: Impact on Pipeline Execution and Performance, Essays (high school) of Abnormal Psychology

Partial preview of the text

Download Control Transfer Instructions and Branching: Impact on Pipeline Execution and Performance and more Essays (high school) Abnormal Psychology in PDF only on Docsity!

PROCESSING CONTROL

TRANSFER INSTRUCTIONS

Chapter No. 8

Control Transfer Instructions

 (^) data hazards are a big enough problem that lots of resources have been devoted to over coming them but unfortunately, the real obstacle and limiting factor in maintaining a good rate of execution in a pipeline are control dependencies  (^) branches are 1 out of every 5 or 6 inst.  (^) In an n-issue processor, they’ll arrive n times faster  (^) A “control dependence” determines the ordering of an instruction with respect to a branch instruction so that the non-branch instruction is executed only when it should be

How Control Instruction Can Be Defined?

 (^) Instructions normally fetched and executed from sequential memory locations  (^) PC is the address of the current instruction, and nPC is the address of the next instruction (nPC = PC + 4)  (^) Branches and control transfer instructions change nPC to something else  (^) Branches modify, conditionally or unconditionally, the value of the PC.

Types of Branches

Conditional jumps

i

jle 24

i

i

jmp 2c

i

i

i

i

i

i

jle 24

i

i

jmp 2c

i

i

i

i

i

Basic

blocks

Basic

blocks

1c 20 24 28 2c 30 34

How Architectures Checks the Results

of Operations?

Example (Result State Concept)

add r1, r2, r3 // r1<- r2 + r beq zero // test for result equals to zero and,if // ‘yes’ branch to location zero div r5, r4, r1 // r5 <- r4 / r . . . zero: // processing the case if divisor equals to // zero

Example (Result State Concept)

teq r1 // test for (r1)=0 and update result state // accordingly beq zero // test for results equals to zero and, if yes, // branch to the location zero div r5, r4, r1 // r5 <- r4/ r . . . zero: // processing the case if divisor equals to // zero

Example (Use Two Separate

Instructions )

add r1, r2, r3; // r1<- r2 + r cmpeq r7, r1; // r7 <- true, if (r1)=0, else NOP bt r7,zero // branch to ‘zero’:if (r7)=true, else NOP div r5, r4, r1 // r5 <- r4 / r . . . zero:

Example (Use Single Instruction)

add r1, r2, r3 // r1<- r2 + r beq r1, zero // test for (r1)=0 and branch if true div r5, r4, r1 // r5 <- r4 / r . . . zero:

Branch Statistics (taken/not taken)

Branch Problem

Performance Measures of Branch

Processing

Performance Measures of Branch

Processing

 (^) In order to evaluate compare branch processing a performance measure branch penalty is used  (^) branch penalty  (^) the number of additional delay cycles occurring until the target instruction is fetched over the natural 1-cycle delay  (^) consider effective branch penalty P for taken and not taken branches is: P = ft * Pt + fnt * Pnt