Professional Documents
Culture Documents
Unit 41
Unit 41
Arvind Vishnubhatla
• Execution control refers to
the rules or mechanisms
used in a processor for
determining the next
instruction to execute.
AGENDA
• Hardware looping
• Interrupt handling
• Stacks and
• Relative branch
support.
Hardware Looping
Hardware Looping
• DSP algorithms frequently involve the
repetitive execution of a small number of
instructions—so-called inner loops or
kernels.
• FIR and IIR filters, FFTs, matrix
multiplication, and a host of other
application kernels are all performed by
repeatedly executing the same instruction
or sequence of instructions.
• DSP processors have evolved to include
features to efficiently handle this sort of
repeated execution.
A natural approach to looping
A natural approach to looping
• Uses a branch instruction to jump back to
the start of the loop.
• Branch instructions typically require
several instruction cycles to execute.
• Especially for small loops, the execution
overhead of the branch instruction may be
considerable.
• Second, because most loops execute a
fixed number of times, the processor must
usually use a register to maintain the loop
index, that is, the count of the number of
times the processor has been through the
loop.
• The processor's data path must then be
used to increment or decrement the index
and test to see if the loop condition has
been met.
• If not, a conditional branch brings the
processor back to the top of the loop.
• All of these steps add overhead to the loop
and use precious registers
DSP processors evolution
• DSP processors have evolved to avoid
these problems via hardware looping, also
known as zero-overhead looping.
• Hardware loops are special hardware
control constructs that repeat either a
single instruction or a group of instructions
some number of times.
• The key difference between hardware
loops and software loops is that hardware
loops lose no time incrementing or
decrementing counters, checking to see if
the loop is finished, or branching back to
the top of the loop.
• For example an FIR filter implemented in
assembly language on two DSP processors, one
with software looping and one with hardware
looping.
• The software loop takes roughly three times as
long to execute, assuming that all instructions
execute in one instruction cycle.
• In fact, branch instructions usually take several
cycles to execute, so the hardware looping
advantage is usually even larger.
MOVE #16,B
LOOP MAC (R0)+,(R4)+,A
:
DEC B
JNE LOOP
RPT #16
MAC (R0)+,(R4)+,A
RPT #16
MAC (R0)+,(R4)+,A