unit4 VTU format.pdf

Embed Size (px)

Citation preview

  • 7/27/2019 unit4 VTU format.pdf

    1/100

    UNIT#4

    Instruction and programming

    4.1Assembly language instructions can be classified as:

    Arithmetic operations.

    Load and store instructions.

    Logical operations.

    Program-control operations

    Operators Used in Instruction Set:

    Table 4.1. Operator used in instruction set

    4.1.1 Arithmetic operations:

  • 7/27/2019 unit4 VTU format.pdf

    2/100

    Add Instructions:

    Syntax Expression

    ADD Smem, src src src = src + Smem

    ADD Smem, TS, src src = src + Smem

  • 7/27/2019 unit4 VTU format.pdf

    3/100

    ADD: Add to Accumulator

    Syntax :1: ADD Smem, src

    2: ADD Smem, TS, src

    3: ADD Smem, 16, src [, dst ]4: ADD Smem [, SHIFT], src [, dst ]5: ADD Xmem, SHFT, src

    6: ADD Xmem, Ymem, dst

    7: ADD #lk [, SHFT], src [, dst ]8: ADD #lk, 16, src [, dst ]

    9: ADD src [, SHIFT], [, dst ]

    10: ADD src, ASM [, dst ]Operands :

    Smem: Single data-memory operand

    Xmem, Ymem: Dual data-memory operands

    src, dst: A (accumulator A)B (accumulator B)

    32 768 lk32 767

    16 SHIFT 150 SHFT 15

    Execution :

    1: (Smem) + (src) src2: (Smem)

  • 7/27/2019 unit4 VTU format.pdf

    4/100

    Example 1 ADD *AR3+, 14, A

    Before Instruction After Instruction

  • 7/27/2019 unit4 VTU format.pdf

    5/100

    Example 2. ADD A, 8, B

    Before Instruction After Instruction

    ADDC : Add to Accumulator With Carry

    Syntax: Syntax: ADDC Smem, src

    Operands: Smem: Single data-memory operand

    Src: A (accumulator A)B (accumulator B)

    Execution: (Smem) + (src) + (C) src

    Status Bits Affected by OVM, C

    Affects C and OVsrc

    Example: ADDC *+AR2(5), A

    ADDM: Add Long-Immediate Value to Memory

    Syntax: ADDM #lk, Smem

    Operands: Smem: Single data-memory operand

    32 768 lk 32 767

    Execution: #lk + (Smem) Smem

    Status Bits: Affected by OVM and SXM

    Affects C and OVA

  • 7/27/2019 unit4 VTU format.pdf

    6/100

    Example 1: ADDM 0123Bh, *AR4+Example 2: ADDM 0FFF8h, *AR4+

    ADDS: Add to Accumulator with Sign-Extension Suppressed

  • 7/27/2019 unit4 VTU format.pdf

    7/100

    Example:

    SUB: Subtract From Accumulator

  • 7/27/2019 unit4 VTU format.pdf

    8/100

    Example:

  • 7/27/2019 unit4 VTU format.pdf

    9/100

    SUBB: Subtract From Accumulator with Borrow

    SUBC: Subtract Conditionally

  • 7/27/2019 unit4 VTU format.pdf

    10/100

    SUBS: Subtract with accumulator with sign extension suppressed

  • 7/27/2019 unit4 VTU format.pdf

    11/100

    MPY: Multiply With/Without Rounding

  • 7/27/2019 unit4 VTU format.pdf

    12/100

  • 7/27/2019 unit4 VTU format.pdf

    13/100

    MPYA: Multiply by Accumulator A

    MPYU:Multiply Unsigned

  • 7/27/2019 unit4 VTU format.pdf

    14/100

    SQUR: Square

  • 7/27/2019 unit4 VTU format.pdf

    15/100

    SQURA: Square and Accumulate

  • 7/27/2019 unit4 VTU format.pdf

    16/100

    SQURS: Square and Subtract

  • 7/27/2019 unit4 VTU format.pdf

    17/100

    MAC[R]: Multiply Accumulate With/Without Rounding

  • 7/27/2019 unit4 VTU format.pdf

    18/100

    MACA[R]: Multiply by Accumulator A and Accumulate With/Without Rounding

  • 7/27/2019 unit4 VTU format.pdf

    19/100

    MACD: Multiply by Program Memory and Accumulate With Delay

  • 7/27/2019 unit4 VTU format.pdf

    20/100

    MACP: Multiply by Program Memory and Accumulate

  • 7/27/2019 unit4 VTU format.pdf

    21/100

    MACSU: Multiply Signed by Unsigned and Accumulate

  • 7/27/2019 unit4 VTU format.pdf

    22/100

    MACSU: Multiply Signed by Unsigned and Accumulate

    MAS[R] :Multiply and Subtract With/Without Rounding

  • 7/27/2019 unit4 VTU format.pdf

    23/100

    MASA[R] :Multiply by Accumulator A and Subtract With/Without Rounding

  • 7/27/2019 unit4 VTU format.pdf

    24/100

    MAX :Accumulator Maximum

    MIN : Accumulator Minimum

  • 7/27/2019 unit4 VTU format.pdf

    25/100

    ABDST: Absolute Distance

    ABS: Absolute Value of Accumulator

  • 7/27/2019 unit4 VTU format.pdf

    26/100

    CMPL :Complement Accumulator

    CMPM :Compare Memory With Long Immediate

  • 7/27/2019 unit4 VTU format.pdf

    27/100

    CMPS :Compare, Select and Store Maximum

  • 7/27/2019 unit4 VTU format.pdf

    28/100

    EXP: Accumulator Exponent

  • 7/27/2019 unit4 VTU format.pdf

    29/100

    SAT :Saturate Accumulator

    NORM: Normalization

  • 7/27/2019 unit4 VTU format.pdf

    30/100

    4.1.2 Logical Operations:

    AND: AND With Accumulator

  • 7/27/2019 unit4 VTU format.pdf

    31/100

    ANDM:AND Memory With Long Immediate

    OR: OR with Accumulator

  • 7/27/2019 unit4 VTU format.pdf

    32/100

    ORM: OR Memory With Constant

    XOR: Exclusive OR With Accumulator

  • 7/27/2019 unit4 VTU format.pdf

    33/100

    XORM: Exclusive OR Memory with Constant

  • 7/27/2019 unit4 VTU format.pdf

    34/100

    ROL: Rotate Accumulator Left

    ROLTC: Rotate Accumulator Left Using TC

  • 7/27/2019 unit4 VTU format.pdf

    35/100

    ROR: Rotate Accumulator Right

    SFTA: Shift Accumulator Arithmetically

  • 7/27/2019 unit4 VTU format.pdf

    36/100

    SFTC: Shift Accumulator Conditionally

  • 7/27/2019 unit4 VTU format.pdf

    37/100

    SFTL: Shift Accumulator Logically

  • 7/27/2019 unit4 VTU format.pdf

    38/100

    BIT :Test Bit

  • 7/27/2019 unit4 VTU format.pdf

    39/100

    BITF: Test Bit Field Specified by Immediate Value

  • 7/27/2019 unit4 VTU format.pdf

    40/100

    BITT :Test Bit Specified by T

    4.1.3.Load and Store operations:

    LD: Load Accumulator with Shift

  • 7/27/2019 unit4 VTU format.pdf

    41/100

    LD :Load T/DP/ASM/ARP

  • 7/27/2019 unit4 VTU format.pdf

    42/100

    LDM: Load Memory-Mapped Register

  • 7/27/2019 unit4 VTU format.pdf

    43/100

    LD||MAC[R] :Load Accumulator With Parallel Multiply Accumulate With/Without

    Rounding

  • 7/27/2019 unit4 VTU format.pdf

    44/100

    LD||MAS[R]: Load Accumulator With Parallel Multiply Subtract With/WithoutRounding

  • 7/27/2019 unit4 VTU format.pdf

    45/100

    LDR: Load Memory Value in Accumulator High With Rounding

  • 7/27/2019 unit4 VTU format.pdf

    46/100

    LDU :Load Unsigned Memory Value

    LMS: Least Mean Square

  • 7/27/2019 unit4 VTU format.pdf

    47/100

    LTD :Load T and Insert Delay

    ST : Store T, TRN, or Immediate Value Into Memory

  • 7/27/2019 unit4 VTU format.pdf

    48/100

    STH : Store Accumulator High Into Memory

  • 7/27/2019 unit4 VTU format.pdf

    49/100

    STL: Store Accumulator Low Into Memory

  • 7/27/2019 unit4 VTU format.pdf

    50/100

    ST||ADD : Store Accumulator With Parallel Add

    ST||LD: Store Accumulator with Parallel Load

  • 7/27/2019 unit4 VTU format.pdf

    51/100

    ST||MAC[R]: Store Accumulator With Parallel Multiply Accumulate With/Without

    Rounding

  • 7/27/2019 unit4 VTU format.pdf

    52/100

    ST||MAS[R]: Store Accumulator With Parallel Multiply Subtract With/Without

    Rounding

  • 7/27/2019 unit4 VTU format.pdf

    53/100

    ST||MPY: Store Accumulator With Parallel Multiply

  • 7/27/2019 unit4 VTU format.pdf

    54/100

    ST||SUB: Store Accumulator With Parallel Subtract

    STRCD: Store T Conditionally

  • 7/27/2019 unit4 VTU format.pdf

    55/100

    4.1.4. Miscellaneous Load-Type and Store-Type Instructions

    MVDD: Move Data From Data Memory to Data Memory With X, Y addressing

  • 7/27/2019 unit4 VTU format.pdf

    56/100

    MVDK: Move Data From Data Memory to Data Memory With Destination Addressing

  • 7/27/2019 unit4 VTU format.pdf

    57/100

    MVDM: Move Data From Data Memory to Memory-Mapped Register

    MVDP: Move Data from Data Memory to Program Memory

  • 7/27/2019 unit4 VTU format.pdf

    58/100

    MVKD: Move Data From Data Memory to Data Memory With Source Addressing

  • 7/27/2019 unit4 VTU format.pdf

    59/100

    MVMD: Move Data From Memory-Mapped Register to Data Memory

  • 7/27/2019 unit4 VTU format.pdf

    60/100

    MVMM: Move Data From Memory-Mapped Register to Memory-Mapped Register

    MVPD: Move Data From Program Memory to Data Memory

  • 7/27/2019 unit4 VTU format.pdf

    61/100

    PORTR: Read Data from Port

    PORTW: Write Data to Port

  • 7/27/2019 unit4 VTU format.pdf

    62/100

    READA: Read Program Memory addressed by Accumulator A and Store in Data

    Memory

  • 7/27/2019 unit4 VTU format.pdf

    63/100

    WRITA: Write Data to Program Memory Addressed by Accumulator A

  • 7/27/2019 unit4 VTU format.pdf

    64/100

    Branch Instructions

    B[D]: Branch Unconditionally

    BACC[D]: Branch to Location Specified by Accumulator

  • 7/27/2019 unit4 VTU format.pdf

    65/100

    BANZ[D]: Branch on Auxiliary Register Not Zero

    BC[D]: Branch Conditionally

  • 7/27/2019 unit4 VTU format.pdf

    66/100

    FB[D]: Far Branch Unconditionally

    FBACC[D]: Far Branch to Location Specified by Accumulator

  • 7/27/2019 unit4 VTU format.pdf

    67/100

    CALA[D]: Call Subroutine at Location Specified by Accumulator

  • 7/27/2019 unit4 VTU format.pdf

    68/100

    CALL[D]: Call Unconditionally

    CC[D]: Call Conditionally

  • 7/27/2019 unit4 VTU format.pdf

    69/100

  • 7/27/2019 unit4 VTU format.pdf

    70/100

    FCALA[D]: Far Call Subroutine at Location Specified by Accumulator

  • 7/27/2019 unit4 VTU format.pdf

    71/100

    FCALL[D]: Far Call Unconditionally

  • 7/27/2019 unit4 VTU format.pdf

    72/100

    4.1.5.Interrupt Instructions:

    INTR: Software Interrupt

  • 7/27/2019 unit4 VTU format.pdf

    73/100

    TRAP: Software Interrupt

    4.1.6. Return Instructions

    FRET[D]: Far Return

  • 7/27/2019 unit4 VTU format.pdf

    74/100

    FRETE[D]: Enable Interrupts and Far Return From Interrupt

    RC[D]: Return Conditionally

  • 7/27/2019 unit4 VTU format.pdf

    75/100

  • 7/27/2019 unit4 VTU format.pdf

    76/100

    RET[D]: Return

    RETE[D]: Enable Interrupts and Return From Interrupt.

  • 7/27/2019 unit4 VTU format.pdf

    77/100

    RETF[D]: Enable Interrupts and Fast Return From Interrupt

    4.1.7. Repeat Instructions

    RPT: Repeat Next Instruction

  • 7/27/2019 unit4 VTU format.pdf

    78/100

    RPTB[D]: Block Repeat

    RPTZ: Repeat Next Instruction and Clear Accumulator

  • 7/27/2019 unit4 VTU format.pdf

    79/100

    4.1.8.Stack-Manipulating Instructions

    FRAME: Stack Pointer Immediate Offset

    POPD: Pop Top of Stack to Data Memory

  • 7/27/2019 unit4 VTU format.pdf

    80/100

    POPM: Pop Top of Stack to Memory-Mapped Register

    PSHD: Push Data-Memory Value onto Stack

  • 7/27/2019 unit4 VTU format.pdf

    81/100

    PSHM: Push Memory-Mapped Register onto Stack

  • 7/27/2019 unit4 VTU format.pdf

    82/100

    4.1.9. Miscellaneous Program-Control Instructions

    SSBX: Set Status Register Bit

    RSBX: Reset Status Register Bit

    NOP: No Operation

  • 7/27/2019 unit4 VTU format.pdf

    83/100

    RESET: Software Reset

    4.2. Programming Examples

    Assembly Files

    Describe steps to create executable output files

    Create an assembly file containing:

    Code

    Constants (initialized data)

    Variables

    Create a linker command file which:

  • 7/27/2019 unit4 VTU format.pdf

    84/100

    Identifies input and output files

    Describes a systems available memory

    Indicates where code and data shall be located

    Develop multi-file systems

    Figure 4.1. Assembly conventions diagram.

    Any ASCII text is O.K

    Use .asm extension

    Instructions & directives cannot be in first column

    Comments O.K any column after semicolon

    Mnemonics

    Lines of 320 code

    Generally written in upper case

    Become components of program memory

    Directives

    Begin with a period (.) and are lower case

    Can create constants and variables

  • 7/27/2019 unit4 VTU format.pdf

    85/100

    May occupy no memory space when used to control ASM

    and LNK process

    Table 4.2.Different COFF data types

    The .bss Directive:

    Only directive with assembly label defined in theoperandfield

    Use separate .bss statements for each

    named variable

  • 7/27/2019 unit4 VTU format.pdf

    86/100

    Remember .bss by thinking::

    Block - reserves ablock of memory

    Symbol - beginning at addresssymbol

    Size - of the specifiedsize

    Example: Create a 5-word array x

    Table 4.3.Different Assembler Directives

    Table 4.4.Different Named section

  • 7/27/2019 unit4 VTU format.pdf

    87/100

    Table 4.5. Summary of COFF Directive

    Example: 1.write a program to find the sum of a series of signed numbers stored at

    successive locations in the data memory and places the result in the accumulator.

    Solution:

    AR1as pointer to the numbers.

    AR2 as counter for the numbers.

    Accumulator value set to zero.

    Sign extension mode is selected.

    Add each number into accumulator.

    Increment the pointer & decrement the counter.

    Repeat until count in AR2 reaches zero.

  • 7/27/2019 unit4 VTU format.pdf

    88/100

    Accumulator contains the sum of number.

    This program computes the signed sum of data memory locations from address 410h

    to 41fh.The result is placed in A.A=dmad(410h)+dmad(411h)+..+ dmad(41fh)

    .mmregs

    .global _c_int000

    .text

    ._c_int00:

    STM #10h, AR2 :initialize counter AR2=10h

    STM #410h, AR2 :Initialize Pointer AR2=410hLD #0h, A :Initialize sum A=0

    SSBX SXM :Select sign extension mode

    START:ADD *AR1+, A :Add the next data value

    BANZ START, *AR2- :Repeat if not done

    NOP :No operation

    .end

    Eaxmple2: Program to computes multiply and accumulate using direct addressing mode:

    Y (n) =h0x(n)+h1x(n-1)+h2x(n-2)

    Solution: data memory

    h0x(n),h1x(n-1)&h2x(n-2)are computed using MPY instruction

    :(T)*(dmad)Acc A or B

    Accumulator contain output value

    Acc (15-0)dmad

  • 7/27/2019 unit4 VTU format.pdf

    89/100

    Acc (31-16)dmad+1

    .global _c_int00

    X .usect Input Samples, 3

    Y .usect outout, 2

    h .usect coefficient, 3.text

    _c_int00:

    SSBX SXM ;Select sign extension mode

    LD #h, DP ;Select the data page for coefficientsLD @h, T ;get the coefficient h(0)

    LD #x, DP ;select the data page for input samples

    MPY @x, A ; A = x(n) * h(0)

    LD #h, DP ; select the data page for coefficientsLD @h+1, T ; get the coefficient h(1)

    LD #x, DP ;select the data page for input singals

    MPY @x+1, B ; B = x(n-1) * h(1)ADD A, B ; B = x(n)*h(0) + x(n-1)*h(1)

    LD #h, DP ; select the data page for coefficients

    LD @h+2, T ; get the coefficient h(2)LD #x, DP ;select the data page for input samples

    MPY @x+2, B ; B = x(n-2) * h(1)

    ADD A, B ; B = x(n)*h(0)+ x(n-1)*h(1) + x(n-2) * h(2)

    LD #y, DP ; select the data page for outputs

    STL B, @y ; save low part of outputSTH B, @y+1 ; save high part of output

    NOP ; No operation

    .end

  • 7/27/2019 unit4 VTU format.pdf

    90/100

    Example3: Program computes multiply and accumulate using indirect addressing mode

    .global _c_int00

    h .int 10, 20, 30

    .text

    _c_int00:SSBX SXM ; Select sign extension mode

    STM #310H, AR2 ; Initialize pointer AR2 for x(n) stored at

    310HSTM @h, AR3 ; Initialize pointer AR3 for coefficients

    MPY *AR2+,*AR3+, A ; A = x(n) * h(0)

    MPY *AR2+,*AR3+, B ; A = x(n-1) * h(1)ADD A, B ; B = x(n) * h(0) + x(n-1) * h(1)

    MPY *AR2+,*AR3+, A ; A = x(n-2) * h(2)

    ADD A, B ; B = x(n) * h(0) + x(n-1) * h(1) + x(n-2) * h(2)

    STL B, *AR2+ ; Save low part of result

    STH B, * AR2+ ; Save high part of result

    NOP ; No operation

    .end

    Example4: Program computes multiply and accumulate using MAC instruction :

    .global _c_int00

    .data

    .bss x, 3

    .bss y, 2

    h .int 10, 20, 30

    .text

    _c_int00:

    SSBX SXM ; Select sign extension mode

    STM #x, AR2 ; Initialize AR2 to point to x(n)

  • 7/27/2019 unit4 VTU format.pdf

    91/100

    STM #h, AR3 ; Initialize AR3 to point to h(0)LD #0H, A ; Initialize result in A = 0

    RPT #2 ; Repeat the next operation 3 timesMAC *AR2+,*AR3+,A ; y(n) computed

    STM #y, AR2 ; Select the page for y(n)STL A, *AR2+ ; Save the low part of y(n)

    STL A, *AR2+ ; Save the high part of y(n)

    NOP ; No operation.end

    4.3. On chip peripherals:

    It facilitates interfacing with external devices.

    The peripherals are:

    General purpose I/O pins

    A software programmable wait state generator.

    Hardware timer

    Host port interface (HPI)

    Clock generator

    Serial port

    4.3.1 It has two general purpose I/O pins:

    BIOinput pin used to monitor the status of external devices.

    XF output pin, software controlled used to signal external

    devices

    4.3.2. Software programmable wait state generator:

    Extends external bus cycles up to seven machine cycles.

  • 7/27/2019 unit4 VTU format.pdf

    92/100

    4.3.3. Hardware Timer

    An on chip down counter

    Used to generate signal to initiate any interrupt or any other process

    Consists of 3 memory mapped registers:

    The timer register (TIM)

    Timer period register (PRD)

    Timer controls register (TCR)

    Pre scaler block (PSC).

    TDDR (Time Divide Down ratio)

    TIN &TOUT

    The timer register (TIM) is a 16-bit memory-mapped register that decrements atevery pulse from the prescaler block (PSC). The timer period register (PRD) is a 16-bit

    memory-mapped register whose contents are loaded onto the TIM whenever the TIM

    decrements to zero or the device is reset (SRESET). The timer can also be independentlyreset using the TRB signal. The timer control register (TCR) is a 16-bit memory-mapped

    register that contains status and control bits. Table shows the functions of the various bits

    in the TCR. The prescaler block is also an on-chip counter. Whenever the prescaler bitscount down to 0, a clock pulse is given to the TIM register that decrements the TIMregister by 1. The TDDR bits contain the divide-down ratio, which is loaded onto the

    prescaler block after each time the prescaler bits count down to 0. That is to say that the

    4-bit value of TDDR determines the divide-by ratio of the timer clock with respect to thesystem clock. In other words, the TIM decrements either at the rate of the system clock or

    at a rate slower than that as decided by the value of the TDDR bits. TOUT and TINT are

    the output signal generated as the TIM register decrements to 0. TOUT can trigger thestart of the conversion signal in an ADC interfaced to the DSP. The sampling frequencyof the ADC determines how frequently it receives the TOUT signal. TINT is used to

    generate interrupts, which are required to service a peripheral such as a DRAM controller

    periodically. The timer can also be stopped, restarted, reset, or disabled by specific statusbits.

  • 7/27/2019 unit4 VTU format.pdf

    93/100

    Bit Name Function

    15-12 Reserved Reserved; always read as 0.

    11 Soft Used in conjunction with the free bit to determine the state of the timerSoft=0,the timer stops immediately.

    Soft=1,the timer stops when the counter decrements to 0.

    10 Free Use in conjunction with the soft bit

    Free=0,the soft bit selects the timer mode

    free=1,the timer runs free

    Bit Name Function

    9-6 PSC Timer prescaler counter, specifies the count for the on-chip timer

    5 TRB Timer reload. Reset the on-chip timer.

    4 TSS Timer stop status, stop or starts the on-chip timer.

    3-0 TDDR Timer divide-down ration

    Table 4.6. Pin details of software wait state generator

  • 7/27/2019 unit4 VTU format.pdf

    94/100

    Figure 4.2.Logical block diagram of timer circuit.

    4.3.4. Host port interface (HPI):

    Allows to interface to an 8bit or 16bit host devices or a host processor

    Signals in HPI are:

    Host interrupt (HINT)

    HRDY

    HCNTL0 &HCNTL1

    HBIL

    HR/

  • 7/27/2019 unit4 VTU format.pdf

    95/100

    4.3. A generic diagram of the host port interface (HPI)

    Important signals in the HPI are as follows:

    The 16-bit data bus and the 18-bit address bus. The host interrupt, Hint, for the DSP to signal the host when it attention is

    required.

    HRDY, a DSP output indicating that the DSP is ready for transfer.

    HCNTL0 and HCNTL1, control signal that indicate the type of transfer tocarry out. The transfer types are data, address, etc.

    HBIL. If this is low it indicates that the current byte is the first byte; if it ishigh, it indicates that it is second byte.

    HR/W indicates if the host is carrying out a read operation or a write

    operation

    4.3.5. Clock Generator:

    The clock generator on TMS320C54xx devices has two options-an external clock

    and the internal clock. In the case of the external clock option, a clock source is

    directly connected to the device. The internal clock source option, on the otherhand, uses an internal clock generator and a phase locked loop (PLL) circuit. The

    PLL, in turn, can be hardware configured or software programmed. Not all

  • 7/27/2019 unit4 VTU format.pdf

    96/100

    devices of the TMS320C54xx family have all these clock options; they vary from

    device to device.

    4.3.6. Serial I/O Ports:

    Three types of serial ports are available:

    Synchronous ports.

    Buffered ports.

    Time-division multiplexed ports.

    The synchronous serial ports are high-speed, full-duplex ports and that provide direct

    communications with serial devices, such as codec, and analog-to-digital (A/D)converters. A buffered serial port (BSP) is synchronous serial port that is provided with

    an auto buffering unit and is clocked at the full clock rate. The head of servicing

    interrupts. A time-division multiplexed (TDM) serial port is a synchronous serial portthat is provided to allow time-division multiplexing of the data. The functioning of each

    of these on-chip peripherals is controlled by memory-mapped registers assigned to the

    respective peripheral.

    4.4. Interrupts of TMS320C54xx Processors:

    Many times, when CPU is in the midst of executing a program, a peripheral

    device may require a service from the CPU. In such a situation, the main program may be

    interrupted by a signal generated by the peripheral devices. This results in the processor

    suspending the main program in order to execute another program, called interruptservice routine, to service the peripheral device. On completion of the interrupt service

    routine, the processor returns to the main program to continue from where it left.

    Interrupt may be generated either by an internal or an external device. It may also

    be generated by software. Not all interrupts are serviced when they occur. Only those

    interrupts that are called nonmaskable are serviced when ever they occur. Otherinterrupts, which are called maskable interrupts, are serviced only if they are enabled.

    There is also a priority to determine which interrupt gets serviced first if more than one

    interrupts occur simultaneously.

    Almost all the devices of TMS320C54xx family have 32 interrupts. However, thetypes and the number under each type vary from device to device. Some of theseinterrupts are reserved for use by the CPU.

    4.5. Pipeline operation of TMS320C54xx Processors:

    The CPU of 54xx devices have a six-level-deep instruction pipeline. The six

    stages of the pipeline are independent of each other. This allows overlapping execution of

  • 7/27/2019 unit4 VTU format.pdf

    97/100

    instructions. During any given cycle, up to six different instructions can be active, each at

    a different stage of processing. The six levels of the pipeline structure are programprefetch, program fetch, decode, access, read and execute.

    1 During program prefetch, the program address bus, PAB, is loaded with the

    address of the next instruction to be fetched.2 In the fetch phase, an instruction word is fetched from the program bus, PB,

    and loaded into the instruction register, IR. These two phases from theinstruction fetch sequence.

    3 During the decode stage, the contents of the instruction register, IR are

    decoded to determine the type of memory access operation and the controlsignals required for the data-address generation unit and the CPU.

    4 The access phase outputs the read operands on the data address bus, DAB. If

    a second operand is required, the other data address bus, CAB, also loaded

    with an appropriate address. Auxiliary registers in indirect addressing modeand the stack pointer (SP) are also updated.

    5

    In the read phase the data operand(s), if any, are read from the data buses, DBand CB. This phase completes the two-phase read process and starts the two-phase write processes. The data address of the write operand, if any, is loaded

    into the data write address bus, EAB.

    6 The execute phase writes the data using the data write bus, EB, and completesthe operand write sequence. The instruction is executed in this phase.

    Figure 4.4.Pipeline operation of TMS320C54xx Processors

  • 7/27/2019 unit4 VTU format.pdf

    98/100

    Figure 4.5.Pipe flow diagram

    Eaxmple1: Show the pipeline operation of the following sequence of instructions if theinitial value of AR3 is 80 & the values stored in memory location 80, 81, 82 are 1, 2 & 3.

    LD *AR3+, A

    ADD #1000h, ASTL A, *AR3+

    Figure 4.6. Pipeline operation for above example1

  • 7/27/2019 unit4 VTU format.pdf

    99/100

    Show the pipeline operation of the following sequence of instructions if the initial value

    of AR1,AR3,A are 84,81,1 & the values stored in memory location 81,82,83,84 are2,3,4,6.Also provide the values of registers AR3,AR1,T & accumulator A ,after

    completion of each cycle.

    ADD *AR3+,A

    LD *AR1+, T

    MPY *AR3+, B

    ADD B, A,.

    ..

    Figure 4.7. Pipeline operation for above example2

  • 7/27/2019 unit4 VTU format.pdf

    100/100