ADSP-218x: DSP Hardware Reference
ADSP-218x: DSP Hardware Reference
Part Number
82-002010-01
Analog Devices, Inc.
a
Digital Signal Processor Division
One Technology Way
Norwood, Mass. 02062-9106
Copyright Information
©1996–2001 Analog Devices, Inc., ALL RIGHTS RESERVED. This
document may not be reproduced in any form without prior, express writ-
ten consent from Analog Devices, Inc.
Printed in the USA.
Disclaimer
Analog Devices, Inc. reserves the right to change this product without
prior notice. Information furnished by Analog Devices is believed to be
accurate and reliable. However, no responsibility is assumed by Analog
Devices for its use; nor for any infringement of patents or other rights of
third parties which may result from its use. No license is granted by impli-
cation or otherwise under the patent rights of Analog Devices, Inc.
INTRODUCTION
Purpose ......................................................................................... 1-1
Audience ...................................................................................... 1-1
Overview ...................................................................................... 1-2
ADSP-218x Family Processors ................................................. 1-4
Functional Units ..................................................................... 1-6
Memory and System Interface .................................................. 1-9
Instruction Set ...................................................................... 1-10
DSP Performance .................................................................. 1-11
Core Architecture ........................................................................ 1-12
Computational Units ............................................................. 1-14
Address Generators and Program Sequencer ........................... 1-15
Buses ..................................................................................... 1-16
On-chip Peripherals .................................................................... 1-17
Serial Ports ............................................................................ 1-17
Timer .................................................................................... 1-17
DMA Ports ........................................................................... 1-18
COMPUTATIONAL UNITS
Overview ...................................................................................... 2-1
Binary String .......................................................................... 2-1
Unsigned Binary Numbers ...................................................... 2-2
Signed Numbers: Twos-Complement ....................................... 2-2
Fractional Representation: 1.15 ............................................... 2-2
ALU Arithmetic ...................................................................... 2-3
MAC Arithmetic ..................................................................... 2-4
Shifter Arithmetic ................................................................... 2-4
Arithmetic Formats Summary .................................................. 2-5
PROGRAM SEQUENCER
Overview ...................................................................................... 3-1
Program Sequencer Structure ........................................................ 3-2
Next Address Select Logic ........................................................ 3-3
Program Counter Register and Stack ........................................ 3-4
Loop Counter Register and Stack ............................................ 3-5
Loop Comparator and Stack .................................................... 3-6
Program Control Instructions ..................................................... 3-11
JUMP Instruction ................................................................. 3-11
Direct JUMP Instructions ................................................. 3-11
Register Indirect JUMP Instructions ................................. 3-11
CALL Instruction ................................................................. 3-13
DO UNTIL Loops ................................................................ 3-13
IDLE Instruction .................................................................. 3-15
Slow IDLE Instruction ..................................................... 3-15
SERIAL PORTS
Overview ...................................................................................... 5-1
Basic Description .......................................................................... 5-1
Interrupts ............................................................................... 5-5
Operation ............................................................................... 5-5
SPORT Programming ................................................................... 5-6
Configuration ......................................................................... 5-6
Receiving and Transmitting Data ............................................. 5-9
TIMER
Overview ...................................................................................... 6-1
Timer Architecture ........................................................................ 6-2
Resolution .................................................................................... 6-4
Timer Operation ........................................................................... 6-4
Enabling the Timer ....................................................................... 6-6
SYSTEM INTERFACE
Overview ...................................................................................... 7-1
Pin Descriptions ........................................................................... 7-1
Pin Descriptions for 128-LQFP Package Processors .................. 7-3
Pin Descriptions for 100-LQFP Package Processors .................. 7-7
Common-Mode Pins ........................................................... 7-9
Memory Mode Pins .......................................................... 7-12
Active or Passive Mode Pin Configuration ......................... 7-13
Terminating Unused Pins .................................................. 7-14
Recommendations for Unused Pins ................................... 7-18
Clock Signals .............................................................................. 7-19
Synchronization Delay ........................................................... 7-22
1/2x Clock Considerations .................................................... 7-22
Resetting the Processor ................................................................ 7-23
Software-Forced Rebooting ......................................................... 7-24
Register Values for BDMA Booting ........................................ 7-30
MEMORY INTERFACE
Overview ...................................................................................... 8-1
Program Memory and Data Memory ........................................ 8-1
Byte Memory Space ................................................................. 8-2
I/O Memory Space .................................................................. 8-2
Memory Buses ......................................................................... 8-2
External Memory Spaces .......................................................... 8-3
Composite Memory Select ....................................................... 8-3
External Overlay Memory ........................................................ 8-3
Internal Direct Memory Access Port ......................................... 8-4
Memory Modes ....................................................................... 8-4
DMA PORTS
Overview ...................................................................................... 9-1
BDMA Port .................................................................................. 9-2
BDMA Port Functional Description ........................................ 9-4
BDMA Control Registers ........................................................ 9-5
Byte Memory Word Formats ................................................. 9-14
BDMA Booting .................................................................... 9-15
Development Software Features for BDMA Booting .......... 9-20
NUMERIC FORMATS
Overview ...................................................................................... A-1
Unsigned or Signed: Twos-Complement Format ............................ A-1
Integer or Fractional Format ......................................................... A-2
CONTROL/STATUS REGISTERS
Overview ..................................................................................... B-1
Memory-Mapped Registers ........................................................... B-3
Non-Memory Mapped Registers ................................................. B-17
INDEX
Purpose
The ADSP-218x DSP Hardware Reference provides architectural and
design information about the ADSP-218x family of digital signal proces-
sors (DSPs). The architectural descriptions cover functional blocks,
busses, and ports. The ADSP-218x DSP Instruction Set Reference manual
covers programming information. The ADSP-218x data sheets for each
member of the family cover timing, electrical, and packaging specifica-
tions, as well as, many other topics related to the features and design of the
specific processor.
Audience
This manual is developed primarily for DSP designers and programmers.
The manual assumes that the audience is familiar with signal processing
concepts and has a working knowledge of microcomputer technology and
DSP-related mathematics.
Overview
The ADSP-218x family is a collection of programmable single-chip
microprocessors that share a common base architecture optimized for dig-
ital signal processing (DSP) and other high-speed numeric processing
applications.
These processors can be used in such diverse applications as:
• Speaker phones
• Smart phones
• Smart-card readers
• POS terminals
• Digital speech interpolation
• Video conferencing
• Data encryption
• ISDN modems
• Pattern matching
• Global positioning
• Navigation
1 L indicates that the processor operates at 3.3 V. These processors are not tolerant to 5 V inputs.
2 M indicates that the processor core operates at 2.5 V and that the external I/O can operate
at 2.5 V or 3.3 V. The external I/O is tolerant to up to 3.6 V inputs with a supply voltage
of 2.5 V or 3.3 V. However, it is not tolerant to 5 V inputs.
3 N indicates that the processor core operates at 1.8 V and that the external I/O can operate
at 1.8 V, 2.5 V or 3.3 V. The external I/O is tolerant to up to 3.6 V inputs with a supply
voltage of 1.8 V, 2.5 V or 3.3 V. However, it is not tolerant to 5 V inputs.
Functional Units
The ADSP-218x architecture includes the following main functional
units:
• Computational Units—Every processor in the ADSP-218x family
contains three independent, full-function computational units: an
arithmetic/logic unit (ALU), a multiplier/accumulator (MAC) and
a barrel shifter. The computational units process 16-bit data directly
and also provide hardware support for multiprecision computa-
tions.
• DMA Ports—The Internal DMA Port (IDMA) and Byte DMA Port
(BDMA) in the ADSP-218x processors allow efficient data transfers
to and from internal memory. The IDMA port is a slave port inter-
face that has a 16-bit multiplexed address and data bus, which also
supports 24-bit Program Memory accesses. The IDMA port is com-
pletely asynchronous and can be written to while the ADSP-218x is
operating at full speed. The Byte Memory DMA port is a master
port that allows boot loading and storing of program instructions
and data at or during runtime.
The ADSP-218x family architecture exhibits a high degree of parallelism,
tailored to DSP requirements. In a single cycle, any device in the family
can:
• Generate the next program address
• Fetch the next instruction
• Perform one or two data moves
• Update one or two data address pointers
• Perform a computation
In that same cycle, processors can also:
• Receive and/or transmit data through the serial ports
• Receive or transmit data through the internal DMA port
• Receive or transmit data via through byte DMA port
• Decrement timer
Instruction Set
The ADSP-218x family shares a single unified instruction set designed for
upward compatibility with higher-integration devices.
The ADSP-218x family instruction set provides flexible data moves. Mul-
tifunction instructions combine one or more data moves with a
computation. Every instruction can be executed in a single processor
cycle. The assembly language uses an algebraic syntax for readability and
ease of coding. A comprehensive set of software and hardware tools sup-
ports program development. The instruction set is detailed in the
ADSP-218x DSP Instruction Set Reference.
DSP Performance
Signal processing applications make special performance demands which
distinguish DSP architectures from other microprocessor and microcon-
troller architectures. Not only must instruction execution be fast, but
DSPs must also perform well in each of the following areas:
• Fast and Flexible Arithmetic—The ADSP-218x family base architec-
ture provides single-cycle computation for multiplication, multipli-
cation with accumulation, arbitrary amounts of shifting, and
standard arithmetic and logical operations. In addition, the arith-
metic units allow for any sequence of computations so that a given
DSP algorithm can be executed without being reformulated.
• Extended Dynamic Range—Extended sums-of-products, common in
DSP algorithms, are supported in the multiply/accumulate units of
the ADSP-218x family. A 40-bit accumulator provides eight bits of
protection against overflow in successive additions to ensure that no
loss of data or range occurs; 256 overflows would have to occur
before any data is lost. Special instructions are provided for imple-
menting block floating-point scaling of data.
• Single-Cycle Fetch of Two Operands—In extended sums-of-products
calculations, two operands are needed on each cycle to feed the cal-
culation. All members of the ADSP-218x family are able to sustain
two-operand data throughput, whether the data is stored on-chip or
off.
• Hardware Circular Buffers—A large class of DSP algorithms, includ-
ing digital filters, requires circular data buffers. The ADSP-218x
family base architecture includes hardware to handle address pointer
wraparound, simplifying the implementation of circular buffers
both on- and off-chip, and reducing overhead (thereby improving
performance).
Core Architecture
This section gives a summary of the ADSP-218x family core architecture.
Each component of the core architecture is described in detail in this man-
ual. The following list identifies the ADSP-218x family’s core
architectural components and specifies the chapters that cover each
component:
• Arithmetic/logic unit (ALU)—Chapter 2, Computational Units
• Multiplier/accumulator (MAC)—Chapter 2, Computational Units
• Barrel shifter—Chapter 2, Computational Units
• Program sequencer—Chapter 3, Program Sequencer
• Status registers and stacks—Chapter 3, Program Sequencer
• Data Address generators (DAGs)—Chapter 4, Data Address Gener-
ators
• PMD-DMD bus exchange (PX registers)—Chapter 4, Data Address
Generators
Figure 1-1 shows the ADSP-218x family core architecture. The sections
that follow provide a brief summary of each core unit.
PROGRAM
DAT A DAT A SEQ UENCER
ADDRES S ADDRES S
GENE RATO R GENE RATO R
#1 #2
14 PM A BUS
14 DMA BUS
24 PM D BUS
16 DMD BUS
R BUS 16
Computational Units
Every processor in the ADSP-218x family contains three independent,
full-function computational units: an arithmetic/logic unit (ALU), a mul-
tiplier/accumulator (MAC) and a barrel shifter. The computation units
process 16-bit data directly and provide hardware support for multipreci-
sion computation as well.
The ALU performs a standard set of arithmetic and logic operations in
addition to division primitives. The MAC performs single-cycle multiply,
multiply/add and multiply/subtract operations. The shifter performs logi-
cal and arithmetic shifts, normalization, denormalization, and
derive-exponent operations. The shifter implements numeric format con-
trol including multiword floating-point representations. The
computational units are arranged side-by-side, instead of serially, so that
the output of any unit may be the input of any unit on the next cycle. The
internal result (R) bus directly connects the computational units to make
this possible.
All three units contain input and output registers that are accessible from
the internal Data Memory data (DMD) bus. Computational operations
generally take their operands from input registers and load the result into
an output register. The registers act as a stopover point for data between
memory and the computational circuitry. This feature introduces one
level of pipelining on input and one level on output. The R bus allows the
result of a previous computation to be used directly as the input to
another computation. This avoids excessive pipeline delays when a series
of different operations are performed.
Buses
The processors have five internal buses:
• Program Memory Address (PMA) and Data Memory Address
(DMA) buses— Used internally for the addresses associated with
Program and Data Memory.
• Program Memory Data (PMD) and Data Memory Data (DMD)
buses — Used for the data associated with memory spaces. These
buses are multiplexed into a single external address bus and a single
external data bus; the BMS, DMS and PMS signals select the different
address spaces.
• Result (R) bus—Transfers intermediate results directly between the
various computational units.
The PMA bus is 14 bits wide allowing direct access of up to 16 K words of
mixed instruction code and data. The PMD bus is 24 bits wide to accom-
modate the 24-bit instruction width.
The DMA bus is 14 bits wide allowing direct access of up to 16 K words
of data. The Data Memory data (DMD) bus is 16 bits wide. The DMD
bus provides a path for the contents of any register in the processor to be
transferred to any other register or to any Data Memory location in a sin-
gle cycle. The Data Memory address comes from two sources: an absolute
value specified in the instruction code (direct addressing) or the output of
a data address generator (indirect addressing). Only indirect addressing is
supported for data fetches from Program Memory.
The Program Memory data (PMD) bus can also be used to transfer data to
and from the computational units through direct paths or via the
PMD-DMD bus exchange unit. The PMD-DMD bus exchange unit per-
mits data to be passed from one bus to the other. It contains hardware to
overcome the 8-bit width discrepancy between the two buses, when
necessary.
On-chip Peripherals
This section describes the additional functional units which are included
in the ADSP-218x family processors.
Serial Ports
The ADSP-218x processors have two bidirectional, double-buffered serial
ports (SPORTs) for serial communications. The SPORTs are synchronous
and use framing signals to control data flow. Each SPORT can generate its
serial clock internally or use an external clock. The framing sync signals
may be generated internally or by an external device. Word lengths may
vary from three to sixteen bits. One serial port, SPORT0, has a multi-
channel capability that allows the receiving or transmitting of arbitrary
data words from a 24-word or 32-word bitstream. The other serial port,
SPORT1, may optionally be configured as two additional external inter-
rupt pins (IRQ1 and IRQ0)and the Flag Out (FO) and Flag In (FI) pins.
Timer
The programmable interval timer provides periodic interrupt generation.
An 8-bit prescaler register allows the timer to decrement a 16-bit count
register over a range from each cycle to every 256 cycles. An interrupt is
generated when this count register decrements to zero. The count register
is automatically reloaded from a 16-bit period register after the timer
interrupt is generated; the count resumes immediately.
DMA Ports
The ADSP-218x contains two DMA ports, an Internal DMA (IDMA)
port and a Byte DMA (BDMA) port. The IDMA port provides an effi-
cient means of communication between a host system and the DSP. The
port is used to access the on-chip Program Memory and Data Memory of
the DSP with only one cycle per word of overhead. The IDMA port has a
16-bit multiplexed address and data bus and supports 24-bit Program
Memory. The IDMA port is completely asynchronous and can be written
to while an ADSP-218x family processor is operating at full speed.
The internal memory address is latched and then automatically incre-
mented after each IDMA transaction. An external device can therefore
access a block of sequentially addressed memory by specifying only the
starting address of the block.
The Byte Memory DMA controller allows loading and storing of program
instructions and data using the Byte Memory space. The BDMA circuitry
is able to access the Byte Memory space while the processor is operating
normally and steals only one processor cycle per 8-, 16-, or 24-bit word
transferred.
Development Tools
The ADSP 218x is supported by VisualDSP®, an easy-to-use program-
ming environment, comprised of an Integrated Development
Environment (IDE) and Debugger. VisualDSP lets you manage projects
from within a single, integrated interface. Because the project develop-
ment and debug environments are integrated, you can move easily
between editing, building, and debugging activities.
Debugger
The Debugger has an easy-to-use, common interface for all processor sim-
ulators and emulators available through Analog Devices and third parties
or custom developments. The Debugger has many features that greatly
reduce debugging time. You can view C source interspersed with the
resulting Assembly code. You can profile execution of a range of instruc-
tions in a program; set simulated watch points on hardware and software
registers, Program and Data Memory; and trace instruction execution and
memory accesses. These features enable you to correct coding errors, iden-
tify bottlenecks, and examine DSP performance.
You can use the custom register option to select any combination of regis-
ters to view in a single window. The Debugger can also generate inputs,
outputs, and interrupts so you can simulate real world application
conditions.
EZ-KIT Lite
The EZ-KIT Lite allows users to investigate ADSP-218x family processors
and begin to develop applications. It consists of a stand-alone ADSP-218x
processor-based evaluation board with fully functional code generation
debug software. It contains a complete set of development tools, including
a C compiler, assembler, linker, and the latest evaluation suite of
VisualDSP® development environment. (All software tools are limited to
use with the EZ-KIT Lite product.)
Demonstration programs are shipped with the product and include com-
mon signal processing algorithms, such as convolution and Fibonacci
calculations. Also included are programs that demonstrate the use of
ADSP-218x hardware features, such as interrupts, overlays, timers, and an
on-board codec.
EZ-ICE
The ADSP-218x EZ-ICE is a serial emulator that provides a controlled
environment for observing, debugging, and testing activities in a target
system. The EZ-ICE connects directly to the target processor through the
emulation interface port. Its key features include the following:
• Support for all ADSP-218x processors
• High-speed RS232 serial port
• Shielded enclosure with reset switch accessibility
• I/O voltage setting confirmation LEDs
• Support for 1.8, 2.5, 3.3, and 5.0 volt DSPs
• CE certified
For additional information about EZ-ICE and how to use it, see “Target
System Hardware” in Chapter 7, System Interface.
Two API tools, Target Wizard and API Tester, are also available for use
with the API set. These tools help speed the time-to-market for vendor
products. Target Wizard builds the programming shell based on API fea-
tures the vendor requires. The API tester exercises the individual features
independently of VisualDSP. Third parties can use a subset of these APIs
that meet their application needs. The interfaces are fully supported and
backward compatible.
Further details and ordering information are available in the VisualDSP
Development Tools data sheet. This data sheet can be requested from any
Analog Devices sales office or distributor.
Information Online
Analog Devices is online on the internet at http://www.analog.com. Our
Web pages provide information on the company and products, including
access to technical information and documentation, product overviews,
and product announcements.
You may also obtain additional information about Analog Devices and its
products in any of the following ways:
• Visit our World Wide Web site at www.analog.com
• FAX questions or requests for information to 1(781)461-3010.
• Access the DSP Division File Transfer Protocol (FTP) site at ftp
ftp.analog.com or ftp 137.71.23.21 or ftp://ftp.analog.com.
Customer Support
You can reach our Customer Support group in the following ways:
• E-mail questions to dsp.support@analog.com or
dsp.europe@analog.com (European customer support)
Related Documents
For more information about Analog Devices DSPs and development
products, see the following documents:
• DSP Microcomputer Data Sheets for the ADSP-218x Family Mem-
bers
• ADSP-218x DSP Instruction Set Reference
• ADSP-2100 Family DSP Applications, Vol. 1 and Vol. 2
• VisualDSP User’s Guide for ADSP-218x & ADSP-219x Family DSPs
• C Compiler & Library Manual for ADSP-218x & ADSP-219x Family
DSPs
Conventions
The following are conventions that apply to all chapters. Note that addi-
tional conventions, which apply only to specific chapters, appear
throughout this document.
Example Description
CLKOUT, RESET Pin names appear in UPPERCASE and keyword font; active
low signals appear with an OVERBAR.
Example Description
Click Here In the online version of this document, a cross reference acts as a
hypertext link to the item being referenced. Click on blue refer-
ences (Table, Figure, or section names) to jump to the location.
Overview
This chapter describes the architecture and function of the ADSP-218x
processors’ three computational units: the arithmetic/logic unit, the mul-
tiplier/accumulator and the barrel shifter.
Every device in the ADSP-218x family is a 16-bit, fixed-point processor.
Most operations assume a twos-complement number representation, while
others assume unsigned numbers or simple binary strings. Special features
support multiword arithmetic and block floating-point. Details concern-
ing the various number formats supported by the ADSP-218x family are
given in Appendix A, “Numeric Formats”.
In ADSP-218x family arithmetic, signed numbers are always in twos-com-
plement format. The processors do not use signed-magnitude,
ones-complement, BCD or excess-n formats.
Binary String
This is the simplest binary notation; sixteen bits are treated as a bit pat-
tern. Examples of computation using this format are the logical
operations: NOT, AND, OR, XOR. These ALU operations treat their
operands as binary strings with no provision for sign bit or binary point
placement.
Table 2-1 gives examples of 1.15 numbers and their decimal equivalents:
0x0001 0.000031
0x7FFF 0.999969
0xFFFF -0.000031
0x8000 -1.000000
ALU Arithmetic
All operations on the ALU treat operands and results as simple 16-bit
binary strings, except the signed division primitive (DIVS). Various status
bits treat the results as signed: the overflow (AV) condition code, and the
negative (AN) flag.
The logic of the overflow bit (AV) is based on twos-complement arith-
metic. It is set if the MSB changes in a manner not predicted by the signs
of the operands and the nature of the operation. For example, adding two
positive numbers must generate a positive result; a change in the sign bit
signifies an overflow and sets AV. Adding a negative and a positive may
result in either a negative or positive result, but cannot overflow.
The logic of the carry bit (AC) is based on unsigned-magnitude arithmetic.
It is set if a carry is generated from bit 16 (the MSB). The (AC) bit is most
useful for the lower word portions of a multiword operation.
MAC Arithmetic
The multiplier produces results that are binary strings. The inputs are
“interpreted” according to the information given in the instruction itself
(signed times signed, unsigned times unsigned, a mixture, or a rounding
operation). The 32-bit result from the multiplier is assumed to be signed,
in that it is sign-extended across the full 40-bit width of the MR register set.
The ADSP-218x family supports two modes of format adjustment: the
fractional mode for fractional operands, 1.15 format (1 signed bit, 15 frac-
tional bits), and the integer mode for integer operands, 16.0 format.
When the processor multiplies two 1.15 operands, the result is a 2.30
(2 sign bits, 30 fractional bits) number. In the fractional mode, the MAC
automatically shifts the multiplier product (P) left one bit before transfer-
ring the result to the multiplier result register (MR). This shift causes the
multiplier result to be in 1.31 format, which can be rounded to 1.15 for-
mat. Figure 2-7 on page 2-26 shows this.
In the integer mode, the left shift does not occur. For example, if the oper-
ands are in the 16.0 format, the 32-bit multiplier result would be in 32.0
format. A left shift is not needed; it would change the numerical represen-
tation. Figure 2-8 on page 2-26 shows this.
Shifter Arithmetic
Many operations in the shifter are explicitly geared to signed (twos-com-
plement) or unsigned values: logical shifts assume unsigned-magnitude or
binary string values and arithmetic shifts assume twos-complement.
The exponent logic assumes twos-complement numbers. The exponent
logic supports block floating-point, which is also based on twos-comple-
ment fractions.
ALU
MAC, Fractional
Shifter
ALU Structure
Figure 2-2 shows a block diagram of the ALU.
The ALU is 16 bits wide with two 16-bit input ports, X and Y, and one
output port, R. The ALU accepts a carry-in signal (CI) which is the carry
bit from the processor arithmetic status register (ASTAT). The ALU gener-
ates six status signals: the zero (AZ) status, the negative (AN) status, the
carry (AC) status, the overflow (AV) status, the X-input sign (AS) status, and
the quotient (AQ) status. All arithmetic status signals are latched into the
arithmetic status register (ASTAT) at the end of the cycle. Please see the
ADSP-218x DSP Instruction Set Reference for information on how each
instruction affects the ALU flags.
The X input port of the ALU can accept data from two sources: the AX reg-
ister file or the result (R) bus. The R bus connects the output registers of
all the computational units, permitting them to be used as input operands
directly. The AX register file is dedicated to the X input port and consists
of two registers, AX0 and AX1. These AX registers are readable and writable
from the DMD bus. The instruction set also provides for reading these
registers over the PMD bus, but there is no direct connection; this opera-
tion uses the PMD-DMD bus exchange unit. The AX register file outputs
are dual-ported so that one register can provide input to the ALU while
either one simultaneously drives the DMD bus.
The Y input port of the ALU can also accept data from two sources: the AY
register file and the ALU feedback (AF) register. The AY register file is ded-
icated to the Y input port and consists of two registers, AY0 andAY1. These
registers are readable and writable from the DMD bus and writable from
the PMD bus. The instruction set also provides for reading these registers
over the PMD bus, but there is no direct connection; this operation uses
the PMD-DMD bus exchange unit. The AY register file outputs are also
dual-ported: one AY register can provide input to the ALU while either one
simultaneously drives the DMD bus.
The output of the ALU is loaded into either the ALU feedback (AF) regis-
ter or the ALU result (AR) register or it is discarded. The AF register is an
ALU internal register that allows the ALU result to be used directly as the
ALU Y input. The AR register can drive both the DMD bus and the R bus.
It is also loadable directly from the DMD bus. The ADSP-218x processor
instruction set also provides for reading AR over the PMD bus, but there is
no direct connection; this operation uses the PMD-DMD bus exchange
unit.
Any of the registers associated with the ALU can be both read and written
in the same cycle. Registers are read at the beginning of a processor clock
cycle and written at the end of a processor clock cycle. A register read,
therefore, reads the value loaded at the end of a previous cycle. A new
value written to a register cannot be read out until a subsequent cycle.
This allows an input register to provide an operand to the ALU at the
beginning of the cycle and be updated with the next operand from mem-
ory at the end of the same cycle. It also allows a result register to be stored
in memory and updated with a new result in the same cycle. See “Multi-
function Instructions” in the ADSP-218x DSP Instruction Set Reference for
an illustration of this same-cycle read and write.
The ALU contains a duplicate bank of registers (shown in Figure 2-2 on
page 2-8) behind the primary registers. There are actually two sets of AR,
AF, AX, and AY register files. Only one bank is accessible at a time. The
additional bank of registers can be activated (such as during an interrupt
service routine) for extremely fast context switching. A new task, like an
interrupt service routine, can be executed without transferring current
states to storage.
The selection of the primary or alternate bank of registers is controlled by
bit 0 in the processor mode status register (MSTAT). If this bit is a 0, the
primary bank is selected; if it is a 1, the secondary bank is selected.
Standard Functions
Table 2-3 lists the standard ALU functions.
Function Description
Function Description
Source for X Input Port Source for Y Input Port Destination for R
Output Port
AR AF AF
SR0, SR12
Multiprecision Capability
Multiprecision operations are supported in the ALU with the carry-in sig-
nal and ALU carry (AC) status bit. The carry-in signal is the AC status bit
that was generated by a previous ALU operation. The “add with carry”
(+ C) operation is intended for adding the upper portions of multipreci-
sion numbers. The “subtract with borrow” (C – 1 is effectively a
“borrow”) operation is intended for subtracting the upper portions of
multiprecision numbers.
0 0 ALU Output
0 1 ALU Output
The operation of the ALU saturation mode is different from the Multi-
plier/Accumulator saturation ability, which is enabled only on an
instruction by instruction basis. For the ALU, enabling saturation means
that all subsequent operations are processed this way.
When the ALU saturation mode is used, only the AR register saturates; if
the AF register is the destination, wrap-around will occur but the flags will
reflect the saturated result.
Division
The ALU supports division. The divide function is achieved with addi-
tional shift circuitry not shown in Figure 2-2 on page 2-8. Division is
accomplished with two special divide primitives. These are used to imple-
ment a non-restoring conditional add-subtract division algorithm. The
division can be either signed or unsigned; however, the dividend and divi-
sor must both be of the same type. Appendix A details various exceptions
to the normal division operation as described in this section.
15
LE FT SH IF T
L
A X0 A X1 A Y1 AF S A Y0
B
16 L O W ER
D IV IDE N D
MUX MUX
UPPER
D IV IDE N D
MSB
D IV ISO R MSB
AQ
R -B U S X Y
A LU
R = P A SS Y
15 L SB S
When dividing unsigned numbers, the DIVS operation is not used. Instead,
the AQ bit in the arithmetic status register (ASTAT) should be initialized to
zero by manually clearing it. The AQ bit indicates to the following opera-
tions that the quotient should be assumed positive.
The second division primitive is the “divide-quotient” (DIVQ) instruction
which generates one bit of quotient at a time and is executed repeatedly to
compute the remaining quotient bits. For unsigned single precision
divides, the DIVQ instruction is executed 16 times to produce 16 quotient
bits. For signed single precision divides, the DIVQ instruction is executed
15 times after the sign bit is computed by the DIVS operation.
DIVQ instruction shifts the AY0 register left by one bit so that the new quo-
tient bit can be moved into the LSB position. The status of the AQ bit
generated from the previous operation determines the ALU operation to
calculate the partial remainder. If AQ = 1, the ALU adds the divisor to the
partial remainder in AF. If AQ = 0, the ALU subtracts the divisor from the
partial remainder in AF. The ALU output R is offset loaded into AF just as
with the DIVS operation. The AQ bit is computed as the exclusive-OR of
the divisor MSB and the ALU output MSB, and the quotient bit is this
value inverted. The quotient bit is loaded into the LSB of the AY0 register
which is also shifted left by one bit. The DIVQ operation is illustrated in
Figure 2-4.
15
LE F T SH IFT
A X1 AF S A Y0
A X0
B
LOW ER
D IV IDE N D
P AR T IA L
R EM A IN D ER
MUX
16
D IV ISO R MSB
R -BU S X Y AQ
A LU
R =Y+X IF A Q= 1
R =Y-X IF A Q =0
1 MSB
15 L SB S
The format of the quotient for any numeric representation can be deter-
mined by the format of the dividend and divisor. For example, let NL
represent the number of bits to the left of the binary point and NR repre-
sent the number of bits to the right of the binary point of the dividend.
Let DL represent the number of bits to the left of the binary point and DR
represent the number of bits to the right of the binary point of the divisor.
Then, the quotient has NL–DL+1 bits to the left of the binary point and
NR–DR–1 bits to the right of the binary point.
Some format manipulation may be necessary to guarantee the validity of
the quotient. For example, if both operands are signed and fully fractional
(dividend in 1.31 format and divisor in 1.15 format) the result is fully
fractional (in 1.15 format) and therefore the dividend must be smaller
than the divisor for a valid result.
To divide two integers (dividend in 32.0 format and divisor in 16.0 for-
mat) and produce an integer quotient (in 16.0 format), you must shift the
dividend one bit to the left (into 31.1 format) before dividing. Additional
discussion and code examples can be found in the ADSP-218x Instruction
Set Reference.
D IV ID E N D B B B B B .B B B B B B B B B B B B B B B B B B B B B B B B B B B
N L B IT S N R B IT S
D IV IS O R BB.BBBBBBBBBBBBBB
D L B IT S D R B IT S
Q U O T IE N T B B B B .B B B B B B B B B B B B
(N L – D L + 1 ) B IT S (N R – D R – 1 ) B IT S
ALU Status
The ALU status bits in the ASTAT register are defined below. Complete
information about the ASTAT register and specific bit mnemonics and posi-
tions is provided in the Program Control chapter.
AZ Zero Logical NOR of all the bits in the ALU result register. True if ALU out-
put equals zero.
AN Negative Sign bit of the ALU result. True if the ALU output is negative.
AV Overflow Exclusive-OR of the carry outputs of the two most significant adder
stages. True if the ALU overflows.
AS Sign Sign bit of the ALU X input port. Affected only by the ABS instruc-
tion.
AQ Quotient Quotient bit generated only by the DIVS and DIVQ instructions.
MAC Structure
Figure 2-6 shows a block diagram of the multiplier/accumulator.
N O TE : T he M R 2 re gis te r
is 8 b its alig ne d o n the
low e r 8 b its of b oth th e R
a nd D M D bus e s
The multiplier has two 16-bit input ports, X and Y, and a 32-bit product
output port, P. The 32-bit product is passed to a 40-bit adder/subtracter,
which adds or subtracts the new product from the content of the multi-
plier result (MR) register or passes the new product directly to MR. The MR
register is 40 bits wide. In this manual, we refer to the entire register as MR.
The register actually consists of three smaller registers: MR0 and MR1 which
are 16 bits wide and MR2 which is 8 bits wide.
The adder/subtracter is greater than 32 bits to allow for intermediate over-
flow in a series of multiply/accumulate operations. The multiply overflow
(MV) status bit is set when the accumulator has overflowed beyond the
32-bit boundary; that is, when there are significant (non-sign) bits in the
top nine bits of the MR register (based on twos-complement arithmetic).
The input/output registers of the MAC are similar to the ALU. The X
input port can accept data from either the MX register file or from any reg-
ister on the result (R) bus. The R bus connects the output registers of all
the computational units, permitting them to be used as input operands
directly. There are two registers in the MX register file, MX0 and MX1. These
registers can be read and written from the DMD bus. The MX register file
outputs are dual-ported so that one register can provide input to the mul-
tiplier while either one simultaneously drives the DMD bus.
The Y input port can accept data from either the MY register file or the MF
register. The MY register file has two registers, MY0 and MY1; these registers
can be read and written from the DMD bus and written from the PMD
bus. The instruction set also provides for reading these registers over the
PMD bus, but there is no direct connection; this operation uses the
PMD-DMD bus exchange unit. The MY register file outputs are also
dual-ported so that one register can provide input to the multiplier while
either one simultaneously drives the DMD bus.
MAC Operations
This section explains the functions of the MAC, its input formats and its
handling of overflow and saturation.
Standard Functions
Table 2-7 lists the functions performed by the MAC.
Function Description
Function Description
MR = MR – xop * yop Multiply X and Y operands and subtract result from MR.
The ADSP-218x family provides two modes for the standard multi-
ply/accumulate function: fractional mode for fractional numbers (1.15),
and integer mode for integers (16.0).
Fractional mode is selected by default upon reset or by the DIS M_MODE
instruction. Integer mode is selected by the ENA M_MODE instruction. These
instructions set or clear bit 4 of MSTAT. This bit is set to 0 for fractional
mode and 1 for integer mode. In either mode, the multiplier output P is
fed into a 40-bit adder/subtracter, which adds or subtracts the new prod-
uct with the current contents of the MR register to form the final 40-bit
result R.
In the fractional mode, the 32-bit P output is format adjusted, that is,
sign-extended and shifted one bit to the left before being added to MR. For
example, bit 31 of P lines up with bit 32 of MR (which is bit 0 of MR2) and
bit 0 of P lines up with bit 1 of MR (which is bit 1 of MR0). The LSB is
zero-filled. The fractional multiplier result format is shown in Figure 2-7.
P SIGN M U LTIPL IE R P O UT PU T
31 31 31 31 31 31 31 31 30 29 28 27 26 25 24 23 22 21 20 19 18 1 7 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
In the integer mode, the 32-bit P register is not shifted before being added
to MR. Figure 2-8 shows the integer-mode result placement.
31 31 31 31 31 31 31 31 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Input Formats
To facilitate multiprecision multiplications, the multiplier accepts X and
Y inputs represented in any combination of signed twos-complement for-
mat and unsigned format, as shown in Table 2-8:
The input formats are specified as part of the instruction. These are
dynamically selectable each time the multiplier is used.
The (signed x signed) mode is used when multiplying two signed single
precision numbers or the two upper portions of two signed multiprecision
numbers.
The (unsigned x signed) and (signed x unsigned) modes are used when
multiplying the upper portion of a signed multiprecision number with the
lower portion of another or when multiplying a signed single precision
number by an unsigned single precision number.
The (unsigned x unsigned) mode is used when multiplying unsigned sin-
gle precision numbers or the non-upper portions of two signed
multiprecision numbers.
Source for X Input Port Source for Y Input Port Destination for R
Output Port
AR MF MF
SR0, SR1
MR Register Operation
As described, and shown on the block diagram, the MR register is divided
into three sections: MR0 (bits 0-15), MR1 (bits 16-31), and MR2 (bits 32-39).
Each of these registers can be loaded from the DMD bus and output to
the R bus or the DMD bus.
The 8-bit MR2 register is tied to the lower 8 bits of these buses. When MR2
is output onto the DMD bus or the R bus, it is sign extended to form a
16-bit value. MR1 also has an automatic sign-extend capability. When MR1
is loaded from the DMD bus, every bit in MR2 will be set to the sign bit
(MSB) of MR1, so that MR2 appears as an extension of MR1. To load the MR2
register with a value other than MR1’s sign extension, you must load MR2
after MR1 has been loaded. Loading MR0 affects neither MR1 nor MR2; no sign
extension occurs in MR0 loads.
! The
The
MF register cannot be saturated.
MV flag is
set/cleared after MAC operations only. When the MR0,
MR1, or MR2 registers are loaded by Move instructions, the instruc-
tion MR = MR can be used to update the MV flag.
Table 2-10 summarizes the MR saturation operation.
0 0 or 1 no change
Overflowing beyond the MSB of MR2 should never be allowed. The true
sign bit of the result is then irretrievably lost and saturation may not pro-
duce a correct value. It takes more than 255 overflows (MV type) to reach
this state, however.
Rounding Mode
The accumulator has the capability for rounding the 40-bit result R at the
boundary between bit 15 and bit 16. Rounding can be specified as part of
the instruction code. The rounded output is directed to either MR or MF.
When rounding is invoked with MF as the output register, register contents
in MF represent the rounded 16-bit result. Similarly, when MR is selected as
the output, MR1 contains the rounded 16-bit result; the rounding effect in
MR1 affects MR2 as well and MR2 and MR1 represent the rounded 24-bit
result.
The accumulator uses an unbiased rounding scheme. The conventional
method of biased rounding is to add a 1 into bit position 15 of the adder
chain. This method causes a net positive bias since the midway value
(when MR0=0x8000) is always rounded upward. The accumulator elimi-
nates this bias by forcing bit 16 in the result output to zero when it detects
this midway point. This has the effect of rounding odd MR1 values upward
and even MR1 values downward, yielding a zero large-sample bias assuming
uniformly distributed values.
Using x to represent any bit pattern (not all zeros), here are two examples
of rounding. The example in Figure 2-9 shows a typical rounding opera-
tion for MR; these also apply for SR.
...MR2..|.......MR1......|.......MR0......
Unrounded value: xxxxxxxx|xxxxxxxx00100101|1xxxxxxxxxxxxxxx
Add 1 and carry: ........|................|1...............
Rounded value: xxxxxxxx|xxxxxxxx00100110|0xxxxxxxxxxxxxxx
The compensation to avoid net bias becomes visible when the lower 15
bits are all zero and bit 15 is one (the midpoint value) as shown in
Figure 2-10.
...MR2..|.......MR1......|.......MR0......
Unrounded value: xxxxxxxx|xxxxxxxx01100110|1000000000000000
Add 1 and carry: ........|................|1...............
MR bit 16=1: xxxxxxxx|xxxxxxxx01100111|0000000000000000
Rounded value: xxxxxxxx|xxxxxxxx01100110|0000000000000000
Biased Rounding
The BIASRND bit in the SPORT0 autobuffer control register enables biased
rounding. When the BIASRND bit is cleared (=0), the RND option in mul-
tiplier instructions uses the normal unbiased rounding operation (as
discussed in “Rounding Mode” on page 2-30). When the BIASRND bit is
set to 1, the DSP uses biased rounding instead of unbiased rounding.
When operating in biased rounding mode, all rounding operations with
MR0 set to 0x8000 round up, rather than only rounding odd MR1 values up.
For an example, see Figure 2-11
This mode only has an effect when the MR0 register contains 0x8000; all
other rounding operations work normally. This mode allows more effi-
cient implementation of bit-specified algorithms that use biased rounding,
for example the GSM speech compression routines. Unbiased rounding is
preferred for most algorithms.
MR before RND
Biased RND result
Unbiased RND result
Barrel Shifter
The barrel shifter (shifter) provides a complete set of shifting functions for
16-bit inputs, yielding a 32-bit output. These include arithmetic shift,
logical shift and normalization. The shifter also performs derivation of
exponent and derivation of common exponent for an entire block of num-
bers. These basic functions can be combined to efficiently implement any
degree of numerical format control, including full floating-point
representation.
Shifter Structure
Figure 2-12 shows a block diagram of the shifter. The shifter can be
divided into the following components: the shifter array, the OR/PASS
logic, the exponent detector, and the exponent compare logic.
The shifter array is a 16x32 barrel shifter. It accepts a 16-bit input and can
place it anywhere in the 32-bit output field, from off-scale right to
off-scale left, in a single cycle. This gives 49 possible placements within
the 32-bit field. The placement of the 16 input bits is determined by a
control code (C) and a HI/LO reference signal.
The shifter array and its associated logic are surrounded by a set of regis-
ters. The shifter input (SI) register provides input to the shifter array and
the exponent detector. The SI register is 16 bits wide and is readable and
writable from the DMD bus. The shifter array and the exponent detector
also take as inputs AR, SR or MR via the R bus. The shifter result (SR) regis-
ter is 32 bits wide and is divided into two 16-bit sections, SR0 and SR1.
The SR0 and SR1 registers can be loaded from the DMD bus and output to
either the DMD bus or the R bus. The SR register is also fed back to the
OR/PASS logic to allow double-precision shift operations.
The SE register (“shifter exponent”) is 8 bits wide and holds the exponent
during the normalize and denormalize operations. The SE register is load-
able and readable from the lower 8 bits of the DMD bus. It is a
twos-complement, 8.0 value.
The SB register (“shifter block”) is important in block floating-point oper-
ations where it holds the block exponent value, that is, the value by which
the block values must be shifted to normalize the largest value. The SB reg-
ister is 5 bits wide and holds the most recent block exponent value. The SB
register is loadable and readable from the lower 5 bits of the DMD bus. It
is a twos-complement, 5.0 value.
Whenever the SE or SB registers are output onto the DMD bus, they are
sign-extended to form a 16-bit value.
DMD BUS 16
MUX SI
REGISTER
SB
REGISTER
MUX
SS
X
EXPONENT
COMPARE
DETECTOR
I X
HI / LO R SHIFTER
8 ARRAY
C
O
32
MUX MUX 32
OR / PASS
SE
REGISTER
16 16
NEGATE
8
MUX MUX
16 16 MUX
R - BUS
16
Any of the SI, SE or SR registers can be read and written in the same cycle.
Registers are read at the beginning of the cycle and written at the end of
the cycle. All register reads, therefore, read values loaded at the end of a
previous cycle. A new value written to a register cannot be read out until a
subsequent cycle. This allows an input register to provide an operand to
the shifter at the beginning of the cycle and be updated with the next
operand at the end of the same cycle. It also allows a result register to be
stored in memory and updated with a new result in the same cycle. See
“Multifunction Instructions” in the ADSP-218x DSP Instruction Set Refer-
ence for an illustration of this same-cycle read and write.
The shifter contains a duplicate bank of registers behind the primary regis-
ters (see Figure 2-12). There are actually two sets of SE, SB, SI, SR1, and
SR0 registers. Only one bank is accessible at a time. The additional bank of
registers can be activated for extremely fast context switching. A new task,
such as an interrupt service routine, can then be executed without trans-
ferring current states to storage.
The selection of the primary or alternate bank of registers is controlled by
the ena sec_reg and dis sec_reg assembly instructions or by bit zero in
the MSTAT register. The alternate bank of registers is activated by the
ena sec_reg instruction or by setting bit zero of MSTAT to a 1. The primary
bank of registers is activated by executing the dis sec_reg instruction or
by clearing bit zero of MSTAT. Upon reset, the primary bank of registers is
active by default.
The shifting of the input is determined by a control code (C) and a HI/LO
reference signal. The control code is an 8-bit signed value which indicates
the direction and number of places the input is to be shifted. Positive
codes indicate a left shift (upshift) and negative codes indicate a right shift
(downshift). The control code can come from three sources: the content
of the shifter exponent (SE) register, the negated content of the SE register
or an immediate value from the instruction.
The HI/LO signal determines the reference point for the shifting. In the HI
state, all shifts are referenced to SR1 (the upper half of the output field),
and in the LO state, all shifts are referenced to SR0 (the lower half). The
HI/LO reference feature is useful when shifting 32-bit values since it allows
both halves of the number to be shifted with the same control code. The
HI/LO reference signal is selectable each time the shifter is used.
The shifter fills any bits to the right of the input value in the output field
with zeros, and bits to the left are filled with the extension bit (X). The
extension bit can be fed by three possible sources depending on the
instruction being performed. The three sources are the MSB of the input,
the AC bit from the arithmetic status register (ASTAT) or a zero.
Figure 2-13 on page 2-37 shows the shifter array output as a function of
the control code and HI/LO signal.
The OR/PASS logic allows the shifted sections of a multiprecision num-
ber to be combined into a single quantity. In some shifter instructions, the
shifted output may be logically ORed with the contents of the SR register;
the shifter array is bitwise ORed with the current contents of the SR regis-
ter before being loaded there. When the [SR OR] option is not used in the
instruction, the shifter array output is passed through and loaded into the
shifter result (SR) register unmodified.
The exponent detector derives an exponent for the shifter input value.
The exponent detector operates in one of three ways, which determine
how the input value is interpreted. In the HI state, the input is interpreted
as a single precision number or the upper half of a double precision num-
ber. The exponent detector determines the number of leading sign bits
and produces a code that indicates how many places the input must be
up-shifted to eliminate all but one of the sign bits. The code is negative so
that it can become the effective exponent for the mantissa formed by
removing the redundant sign bits.
In the HI-extend state (HIX), the input is interpreted as the result of an add
or subtract performed in the ALU which may have overflowed. Therefore
the exponent detector takes the arithmetic overflow (AV) status into con-
sideration. If AV is set, then a +1 exponent is output to indicate an extra bit
is needed in the normalized mantissa (the ALU Carry bit); if AV is not set,
then HI-extend functions exactly like the HI state. When performing a
derive exponent function in HI or HI-extend modes, the exponent detector
also outputs a shifter sign (SS) bit which is loaded into the arithmetic sta-
tus register (ASTAT). The sign bit is the same as the MSB of the shifter
input except when AV is set; when AV is set in HI-extend state, the MSB is
inverted to restore the sign bit of the overflowed value.
In the LO state, the input is interpreted as the lower half of a double preci-
sion number. In the LO state, the exponent detector interprets the SS bit in
the arithmetic status register (ASTAT) as the sign bit of the number. The SE
register is loaded with the output of the exponent detector only if SE con-
tains –15. This occurs only when the upper half–which must be processed
first–contained all sign bits. The exponent detector output is also offset by
–16 to account for the fact that the input is actually the lower half of a
32-bit value. Figure 2-14 gives the exponent detector characteristics for all
three modes.
The exponent compare logic is used to find the largest exponent value in
an array of shifter input values. The exponent compare logic in conjunc-
tion with the exponent detector derives a block exponent. The comparator
compares the exponent value derived by the exponent detector with the
value stored in the shifter block exponent ( SB) register and updates the SB
register only when the derived exponent value is larger than the value in SB
register. See the examples shown in the following sections.
1 DDDDDDDD DDDDDDDD +1
SNDDDDDD DDDDDDDD 0 0 SNDDDDDD DDDDDDDD 0
SSNDDDDD DDDDDDDD -1 0 SSNDDDDD DDDDDDDD -1
SSSNDDDD DDDDDDDD -2 0 SSSNDDDD DDDDDDDD -2
SSSSNDDD DDDDDDDD -3 0 SSSSNDDD DDDDDDDD -3
SSSSSNDD DDDDDDDD -4 0 SSSSSNDD DDDDDDDD -4
SSSSSSND DDDDDDDD -5 0 SSSSSSND DDDDDDDD -5
SSSSSSSN DDDDDDDD -6 0 SSSSSSSN DDDDDDDD -6
SSSSSSSS NDDDDDDD -7 0 SSSSSSSS NDDDDDDD -7
SSSSSSSS SNDDDDDD -8 0 SSSSSSSS SNDDDDDD -8
SSSSSSSS SSNDDDDD -9 0 SSSSSSSS SSNDDDDD -9
SSSSSSSS SSSNDDDD -10 0 SSSSSSSS SSSNDDDD -10
SSSSSSSS SSSSNDDD -11 0 SSSSSSSS SSSSNDDD -11
SSSSSSSS SSSSSNDD -12 0 SSSSSSSS SSSSSNDD -12
SSSSSSSS SSSSSSND -13 0 SSSSSSSS SSSSSSND -13
SSSSSSSS SSSSSSSN -14 0 SSSSSSSS SSSSSSSN -14
SSSSSSSS SSSSSSSS -15 0 SSSSSSSS SSSSSSSS -15
LO Mode
Shifter Operations
The shifter performs the following functions (instruction mnemonics
shown in parentheses):
• Arithmetic Shift (ASHIFT)
• Logical Shift (LSHIFT)
• Normalize ( NORM)
• Derive Exponent (EXP)
• Block Exponent Adjust (EXPADJ)
These basic shifter instructions can be used in a variety of ways, depending
on the underlying arithmetic requirements. The following sections present
single and multiple precision examples for these functions:
• Derivation of a Block Exponent
• Immediate Shifts
• Denormalization
• Normalization
The shift functions (arithmetic shift, logical shift, and normalize) can be
optionally specified with [SR OR] and HI/LO modes to facilitate multipreci-
sion operations. [SR OR] logically ORs the shift result with the current
contents of SR. This option is used to join two 16-bit quantities into a
32-bit value in SR. When [SR OR] is not used, the shift value is passed
through to SR directly. The HI and LO modifiers reference the shift to the
upper or lower half of the 32-bit SR register. These shift functions take
inputs from either the SI register or any other result register and load the
32-bit shifted result into the SR register.
SI SR (SR0, SR1)
AR
SR0, SR1
Immediate Shifts
An immediate shift simply shifts the input bit pattern to the right (down-
shift) or left (upshift) by a given number of bits. Immediate shift
instructions use the data value in the instruction itself to control the
amount and direction of the shifting operation. (See the ADSP-218x DSP
Instruction Set Reference for examples of this instruction.) The data value
controlling the shift is an 8-bit signed number. The SE register is not used
or changed by an immediate shift.
The following example shows the input value downshifted relative to the
upper half of SR (SR1). This is the (HI) version of the shift:
SI=0xB6A3;
SR=LSHIFT SI BY –5 (HI);
Here is the same input value shifted in the other direction, referenced to
the lower half (LO) of SR:
SI=0xB6A3;
SR=LSHIFT SI BY 5 (LO);
This example shows an arithmetic shift of the same input and shift code:
SI=0xB6A3;
SR=ASHIFT SI BY –5 (HI);
Denormalize
Denormalizing refers to shifting a number according to a predefined expo-
nent. The operation is effectively a floating-point to fixed-point
conversion.
Denormalizing requires a sequence of operations. First, the SE register
must contain the exponent value. This value may be explicitly loaded or
may be the result of some previous operation. Next the shift itself is per-
formed, taking its shift value from the SE register, not from an immediate
data value.
Two examples of denormalizing a double-precision number are given
below. The first shows a denormalization in which the upper half of the
number is shifted first, followed by the lower half. Since computations
may produce output in either order, the second example shows the same
operation in the other order, i.e. lower half first.
Always select the arithmetic shift for the higher half (HI) of the twos-com-
plement input (or logical for unsigned). Likewise, the first half processed
does not use the [SR OR] option.
Modifier = HI, No [SR OR], Shift operation = Arithmetic, SE = –3
First Input: 10110110 10100011 (upper half of desired result)
SR: 11110110 11010100 01100000 00000000
Now the lower half is processed. Always select a logical shift for the lower
half of the input. Likewise, the second half processed must use the [SR OR]
option to avoid overwriting the previous half of the output value.
Modifier = LO, [SR OR], Shift operation = Logical, SE = –3
Second Input: 01110110 01011101 (lower half of desired result)
SR: 11110110 11010100 01101110 11001011
Here is the same input processed in the reverse order. The higher half is
always arithmetically shifted and the lower half is logically shifted. The
first input is passed straight through to SR, but the second half is ORed to
create a double-precision value in SR.
Modifier = LO, No [SR OR], Shift operation = Logical, SE = –3
First Input: 01110110 01011101 (lower half of desired result)
SR: 00000000 00000000 00001110 11001011
Normalize
Numbers with redundant sign bits require normalizing. Normalizing a
number is the process of shifting a twos-complement number within a
field so that the rightmost sign bit lines up with the MSB position of the
field and recording how many places the number was shifted. The opera-
tion can be thought of as a fixed-point to floating-point conversion,
generating an exponent and a mantissa.
Normalizing is a two-stage process. The first stage derives the exponent.
The second stage does the actual shifting. The first stage uses the EXP
instruction which detects the exponent value and loads it into the SE regis-
ter. This instruction ( EXP) recognizes a (HI) and (LO) modifier. The second
stage uses the NORM instruction. The NORM instruction recognizes (HI) and
(LO) and also has the [SR OR] option. The NORM instruction uses the
negated value of the SE register as its shift control code. The negated value
is used so that the shift is made in the correct direction.
SE set to: –3
For a single precision input, the normalize operation can use either the
(HI) or ( LO) modifier, depending on whether you want the result in SR1 or
SR0, respectively.
Double precision values follow the same general scheme. The first stage
detects the exponent and the second stage normalizes the two halves of the
input. For double precision, however, there are two operations in each
stage.
For the first stage, the upper half of the input must be operated on first.
This first exponent derivation loads the exponent value into SE. The sec-
ond exponent derivation, operating on the lower half of the number will
not alter the SE register unless SE = –15. This happens only when the first
half contained all sign bits. In this case, the second operation will load a
value into SE. (See Figure 2-14 on page 2-39) This value is used to control
both parts of the normalization that follows.
For the second stage, now that SE contains the correct exponent value, the
order of operations is immaterial. The first half (whether HI or LO) is nor-
malized without the [SR OR] and the second half is normalized with [SR
OR] to create one double-precision value in SR. The ( HI) and (LO) modifiers
identify which half is being processed.
SE unchanged, still -3
3. Normalize, Modifier=HI, No [SR OR], SE = –3
First Input: 11110110 11010100
If the upper half of the input contains all sign bits, the SE register value is
determined by the second derive exponent operation as shown in the fol-
lowing example.
1. Detect Exponent, Modifier = HI
First Input: 11111111 11111111 (Must be upper half)
SE set to: -15
All values of SE less than –15 (resulting in a shift of +16 or more) upshift
the input completely off scale.
4. Normalize, Modifier=LO, [ SR OR], SE = –19 (negated)
Second Input: 11110110 11010100
The HIX operation executes properly whether or not there has actually
been an overflow. Consider this example:
AR = 11100011 01011011
AV = 0, indicating no overflow
AC = 0, not meaningful if AV = 0
1. Detect Exponent, Modifier = HIX
SE set to –2
Overview
This chapter describes the program sequencer of the ADSP-218x family
processors. The program sequencer circuitry controls the flow of program
execution. It contains an interrupt controller and status and condition
logic.
The program sequencer generates a stream of instruction addresses and
provides flexible control of program flow. It allows sequential instruction
execution, zero-overhead looping, sophisticated interrupt servicing, and
single-cycle branching with jumps and calls (both conditional and
unconditional).
This chapter discusses each function on the program sequencer. It also dis-
cusses both the program sequencer logic and the following instructions
used to control program flow:
• DO UNTIL
• JUMP
• CALL
DM D B U S
F RO M IN S TR UC TIO N RE G IS TE R
CO UN T
CO ND IT IO N CO D E
S T AC K
AD DR E S S O F JUM P /CA LL
F UN CT IO N F IE L D
M UX AD DR E S S O F L AS T
IN ST R UC TIO N IN L O O P
&
T E RM INA T IO N
CN T R
(CO UN T E R ) CO ND IT IO N
CE O UT
S T AT US LOOP
S T AC K S T AC K
M UX
CO ND IT IO N LOOP
L O G IC CO M P AR AT O R
S T AT US
AR IT HM E T IC RE G IS T E RS
S T AT US
(fro m A LU )
P RO G RAM
PC
IN TE R RU PT CO UN T E R
S T AC K
IN TE R RU PT S CO NT R O L L E R
IN CRE M E NT M UX
fro m
F I P in
NE X T
AD DR E S S
NE X T A DDR E S S M U X S O U RC E
S E L EC T
PM A B U S
The sections that follow describe the functions shown in the diagram in
detail.
The interrupt controller provides the next program memory address when
servicing an interrupt. Upon recognizing a valid interrupt, the processor
jumps to the interrupt vector location corresponding to the active inter-
rupt request.
Another possible source for the next address is one of the I4-I7 index reg-
isters of DAG2 (Data Address Generator 2), used when a register indirect
jump is executed, as shown in the following instruction:
JUMP (I4);
In this example, the PC is loaded from DAG2 via the PMA bus. (See
Chapter 4, “Data Address Generators” for detailed information about the
data address generators.)
The output of the next address multiplexer is fed back to the PC, which
normally reloads it at the end of each processor cycle. In the case of a reg-
ister indirect jump, however, DAG2 drives the PMA bus with the next
instruction address and the PC is loaded directly from the PMA bus.
The count stack is a 14-bit by 4-word stack that allows nesting of loops by
storing temporarily dormant loop counts. When a new value is loaded
into the counter from the DMD bus, the current counter value is auto-
matically pushed onto the count stack. The count stack is automatically
popped whenever the CE status is tested and is true, thereby resuming exe-
cution of the outer loop (if any). The count stack may also be popped
manually if an early exit from a loop is taken.
There are two exceptions to the automatic pushing of the count stack. A
counter load from the DMD bus does not cause a count stack push if
there is no valid value in the counter, because a stack location would be
wasted on the invalid counter value. There is no valid value in the counter
after a system reset and also after the CE condition is tested when the count
stack is empty. The count stack empty status bit in the SSTAT register indi-
cates when the stack is empty.
The second exception is provided explicitly by the special purpose syntax
OWRCNTR (overwrite counter). Writing a value to OWRCNTR overwrites the
counter with the new value, and nothing is pushed onto the count stack.
OWRCNTR cannot be read (i.e. used as a source register) and must not be
written in the last instruction of a DO UNTIL loop.
The loop stack stores the last instruction addresses and termination condi-
tions of temporarily dormant loops. Up to four levels can be stored. The
only extra cycle associated with the nesting of DO UNTIL loops is the execu-
tion of the DO UNTIL instruction itself, since the pushing and popping of
all stacks associated with the looping hardware is automatic.
When using the counter expired (CE) status as the termination condition
for the loop, an additional cycle is required for the initial loading of the
counter. Table 3-1 shows the termination conditions that can be used
with DO UNTIL.
EQ Equal Zero AZ = 1
AC ALU Carry AC = 1
AV ALU Overflow AV = 1
MV MAC Overflow MV = 1
CE Counter Expired
FOREVER Always
! For a return instruction, control is passed back to the top of the loop
since the PC stack contains the beginning address of the loop.
" Caution
or
is required when ending a loop with a , , ,
JUMP CALL RETURN
instruction, or when making a premature exit from a loop.
IDLE
Since none of the loop sequencing mechanisms are active while the
jump/call/return is being performed, the loop, PC, and counter
stacks are left with the looping information (since they are not
popped).
JUMP Instruction
The ADSP-218x processors have two types of JUMP instructions: direct
JUMP instruction and register indirect JUMP instructions.
JUMP (I4);
CNTR = 10000;
do outer_loop until ce;
...
CNTR = DM(mycounter); /* values between 1 and 2^16 –1
allowed */
do inner_loop until ce;
inner_loop: <instr_a>;
<instr_b>
...
outer_loop: <instr_x>
CNTR = 10000;
do outer_loop until ce;
...
jump (i4);
<instr_a>;
<instr_a>;
<instr_a>;
<instr_a>;
inner_loop: <instr_b>
...
outer_loop: <instr_x>
CALL Instruction
The CALL instruction executes in a similar fashion to the JUMP instruction.
The address of the subroutine is embedded in the CALL instruction word
and, once extracted from the instruction register, is fed back the PC for the
next cycle. In addition, the current value of the program counter is incre-
mented and pushed onto the PC stack. Upon return from the subroutine,
the PC stack is popped into the program counter and execution resumes
with the instruction following the CALL.
DO UNTIL Loops
The most common form of a DO UNTIL loop uses the counter register as a
loop iteration counter. When the counter is used to control loop iteration,
counter expired (CE) must be used as the DO UNTIL termination condition.
A simple example of this type of loop is shown in Listing 3-3.
When the
CNTR=10;
instruction itself only sets up the conditions for looping; no other opera-
tion occurs while the instruction is executed. This occurs only once, at the
beginning of the first time through the loop.
Execution of the DO UNTIL instruction pushes the address of the instruc-
tion immediately following the DO UNTIL onto the PC stack (by pushing
the incremented PC). On the same cycle, the loop stack is pushed with the
address of the end-of-loop instruction and the termination condition.
As execution continues within the loop, the loop comparator checks each
instruction’s address against the address of the loop’s last instruction.
Until that address is reached, normal execution continues.
Each time the end of the loop is reached, the loop comparator determines
that the currently executing instruction is the last in the loop. This affects
the next address select logic of the program sequencer: instead of using the
incremented PC for the next address, the loop termination condition is
evaluated. If the termination condition is false, execution continues with
the first instruction of the loop (the top of the PC stack is taken as the
next address). Note that the PC and loop stacks are not popped, only read.
On the final pass through the loop, the termination condition is true. The
PC stack is popped and execution continues with the instruction immedi-
ately following the last instruction of the loop. The loop stack and count
stack are also popped on this cycle.
! The do-loop hardware tests at the end of the loop only. When
CE
is programmed to zero, the loop is repeated 2 times.
CNTR
14
IDLE Instruction
The IDLE instruction causes the processor to wait indefinitely in a low
power state until an interrupt occurs. When an unmasked interrupt
occurs, it is serviced; execution then continues with the instruction fol-
lowing the IDLE instruction.
where n = 16, 32, 64, or 128. This instruction keeps the processor fully
functional, but operating at the slower clock rate. While it is in this state,
the processor’s other internal clock signals, such as SCLK, CLKOUT, and
timer clock, are reduced by the same ratio. The default form of the
instruction, when no clock divisor is given, is the standard IDLE
instruction.
When the IDLE (n) instruction is used, it effectively slows down the pro-
cessor’s internal clock and thus its response time to incoming interrupts.
The interrupt response time is increased because the instruction cycle is
extended by the clock divisor n. When an enabled interrupt is received,
the processor will remain in the idle state for up to a maximum of n pro-
cessor cycles before resuming normal operation (n = 16, 32, 64, or 128).
When the IDLE (n) instruction is used in systems that have an externally
generated serial clock (SCLK), the serial clock rate may be faster than the
processor’s reduced internal clock rate. Under these conditions, interrupts
must not be generated at a faster rate than can be serviced, due to the
additional time the processor takes to come out of the idle state (a maxi-
mum of n processor cycles).
Interrupts
The program sequencer’s interrupt controller responds to interrupts by
shifting control to the instruction located at the appropriate interrupt vec-
tor address. Table 3-2 shows the interrupts and associated vector addresses
for the ADSP-218x family processors.
IRQ2 0x0004
The interrupt vector locations are spaced four program memory locations
apart—this allows short interrupt service routines to be coded in place,
with no jump to the service routine required. For interrupt service rou-
tines with more than four instructions, however, program control must be
transferred to the service routine by means of a jump instruction placed at
the interrupt vector location.
After an interrupt has been serviced, an RTI (Return From Interrupt)
instruction returns control to the main program by popping the top value
on the PC stack into the PC; the status stack is also popped to restore the
previous processor state.
Interrupts can also be forced under software control; see the discussion of
the IFC register below.
Configuring Interrupts
The following registers are used to configure interrupts:
• ICNTL—Determines whether interrupts can be nested and config-
ures the external interrupts IRQ2, IRQ1, IRQ0 as edge-sensitive or
level-sensitive
• IMASK—Enables or disables (i.e. masks) each individual interrupt
(both external and internal).
• IFC—Forces an interrupt or clears a pending edge-sensitive inter-
rupt.
The IRQ2, IRQ1, IRQ0 interrupts may be either edge-sensitive or level-sensi-
tive, as selected in the ICNTL register. The ADSP-218x family has three
additional interrupt pins: IRQE, IRQL1, and IRQL2. The IRQE input is
edge-sensitive, while the IRQL1 and IRQL2 inputs are level-sensitive.
For edge-sensitive IRQx interrupts, an interrupt request is latched inter-
nally whenever a falling edge (high-to-low transition) occurs at the input
pin. The latch remains set until the interrupt is serviced; it is then auto-
matically cleared. A pending edge-sensitive interrupt can also be cleared in
software by setting the corresponding clear bit in the IFC register.
Edge-sensitive interrupt inputs generally require less external hardware
than level-sensitive inputs, and allow signals such as sampling-rate clocks
to be used as interrupts.
A level-sensitive interrupt must remain asserted until the interrupt is ser-
viced. The interrupting device must then deassert the interrupt request so
that the interrupt is not serviced again. Level-sensitive inputs, however,
allow many interrupt sources to use the same input by combining them
logically to produce a single interrupt request. Level-sensitive interrupts
are not latched.
Your program can also determine whether or not interrupts can be nested.
In non-nesting mode, all interrupt requests are automatically masked out
when an interrupt service routine is entered. In nesting mode, the proces-
sor allows higher-priority interrupts to be recognized and serviced.
1 ijklmnopqr 0000000000
2 ijklmnopqr 0000000000
3 ijklmnopqr 0000000000
4 ijklmnopqr 0000000000
5 ijklmnopqr 0000000000
6 ijklmnopqr 0000000000
7 ijklmnopqr 0000000000
8 ijklmnopqr 0000000000
1 ijklmnopqr ijklmnop00
2 ijklmnopqr ijklmno000
3 ijklmnopqr ijklmn0000
4 ijklmnopqr ijklm00000
5 ijklmnopqr ijkl000000
6 ijklmnopqr ijk0000000
7 ijklmnopqr ij00000000
8 ijklmnopqr i000000000
The interrupt nesting enable bit (in ICNTL) determines the state of IMASK
upon entering the interrupt, as shown in Table 3-3
Interrupts are enabled by default after reset. The DIS INTS instruction
causes all interrupts (including powerdown) to be masked out regardless
of the contents of IMASK. The ENA INTS instruction allows all unmasked
interrupts to be serviced again.
Disabling interrupts does not affect serial port autobuffering or DMA
operations.
Interrupt Latency
For the timer, IRQx, and SPORT interrupts, latency is at least three full
cycles from the time when an interrupt occurs to the time when the first
instruction of the service routine is executed. This latency is shown in
Figure 3-2. Two cycles are required to synchronize the interrupt inter-
nally, assuming that setup and hold times are met (for the IRQx input
pins).
Since interrupts are only serviced on instruction boundaries, before execu-
tion continues, the instruction(s) executed during these two cycles must
be fully completed, including any extra cycles inserted due to Bus
Request/Bus Grant or memory wait states.
C LK O U T
IN TE R RU P T
IN ST R UC T IO N FIR S T INS T R O F
N –2 N–1 N NO P
E X EC U TIN G S ER V R O U TIN E
AD D RE S S FO R
IN ST R UC T IO N N –1 N N+ 1 INT E RR U P T I+1
F E TC H V EC TO R I
The third cycle of latency is needed to fetch the first instruction stored at
the interrupt vector location. During this cycle, the processor executes a
NOP instead of the instruction that would normally have been executed.
On the next cycle, execution continues at the first instruction of the inter-
rupt service routine. The address of the aborted instruction is pushed onto
the PC stack; it will be fetched when the interrupt service routine is
completed.
For a pending interrupt that is masked, the latency from execution of the
instruction that unmasks the interrupt (in IMASK) to the first instruction of
the service routine is one cycle.
Register Description
7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0
SS MV AQ AS AC AV AN AZ
ALU OVERFLOW
ALU CARRY
ALU QUOTIENT
MAC OVERFLOW
Loading any ALU, MAC, or Shifter input or output registers directly from
the DMD bus does not affect any of the arithmetic status bits. Executing
the ALU instruction PASS sets the AZ and AN bits for a given X or Y oper-
and and clears AC.
7 6 5 4 3 2 1 0
0 1 0 1 0 1 0 1
P C S TA C K EM P TY
P C STA C K O V ER FL O W
C O U NT S TA C K EM P TY
C O U NT STA C K OV ER FL O W
S TA T US S TA C K E M P TY
S TA T US ST A C K OV ER FL O W
L O O P ST A C K EM P TY
L O O P STA C K OV ER FL O W
6 5 4 3 2 1 0
0 0 0 0 0 0 0
D A TA RE G IST ER B A NK SE LE C T (S EC _R E G)
0 = P RIM A RY , 1 = S E C ON D A R Y
B IT RE VE R SE M O DE EN AB LE (D A G 1) (B IT_R EV )
A LU O V ER FL O W LA TC H M O DE EN AB LE (A V _LA TC H )
A R S A TU RA TIO N M O D E E N AB LE (A R _S AT )
M A C R E S U LT PLA C EM E NT (M _M O DE )
0 = FR A CT ION A L , 1 = INT EG E R
T IM ER EN A BL E (TIM ER )
G O M O DE E N AB LE (G _ M O DE )
Unlike other status registers, the MSTAT register can also be altered with the
Mode Control instructions, ENA and DIS. The Mode Control instructions
provide a high-level, self-documenting method of configuring the proces-
sors’ operating modes. Although the use of the ENA and DIS assembly
instructions are the preferred method, the MSTAT register can also be mod-
ified by writing a new value to it with a MOVE instruction. Refer to the
description of the Mode Control instructions in the ADSP-218x DSP
Instruction Set Reference for further details.
To enable the bit reverse mode, for example, the following instruction
could be used:
ENA BIT_REV;
The bit-reverse mode, when enabled, bitwise reverses all addresses gener-
ated by data address generator 1 (DAG1). This is useful for reordering the
input or output data of an FFT algorithm.
The ADSP-218x family processors include a secondary register set that
can be used to provide a fresh set of ALU, MAC, and Shifter registers at
any time. For example, it can be used for this purpose during execution of
a subroutine.
The data register bank select bit of MSTAT determines which set of data reg-
isters is active (0=primary, 1=secondary). The secondary register set
duplicates all of the input and result registers of the computation units,
ALU, MAC, and Shifter, as shown in Table 3-6
AX0 MX0 SI
AX1 MX1 SE
AY0 MY0 SB
AF MF SR0
AR MR0
MR1
MR2
For example, the following mode control instruction switches from the
processor’s primary register set to its secondary register set:
ENA SEC_REG;
while the following instruction switches back to the primary register set:
DIS SEC_REG;
The ALU overflow latch mode causes the AV status bit to “stick” once it is
set. In this mode, AV will be set by an overflow and will remain set even if
subsequent ALU operations do not generate overflows. AV can then be
cleared only by writing a zero into it.
AR saturation mode, when enabled, causes AR to be saturated to the maxi-
mum positive (0x7FFF) or negative (0x8000) values whenever an ALU
overflow occurs.
The MAC result placement mode determines whether the multiplier oper-
ates in integer or fractional format. This mode is discussed in Chapter 2,
“Computational Units”.
Setting the timer enable bit causes the timer to begin decrementing. Clear-
ing this bit halts the timer.
Enabling Go mode allows the processor to continue executing instructions
from internal program memory during a bus grant. The processor will
halt, waiting for the buses to be released, only when an access of external
memory is required. When Go mode is disabled, the processor always
halts during bus grant. (For more information, see the section, “Bus
Request/Grant” in Chapter 7, “System Interface” .
Conditional Instructions
The condition logic circuit of the program sequencer determines whether
a conditional instruction is executed, for example a jump, call, or arith-
metic operation. It also controls implicit loop sequencing operations based
upon the loop continuation condition on top of the loop stack. The con-
dition logic takes raw status information from ASTAT and the down
counter and derives a set of sixteen composite status conditions.
The status conditions and corresponding assembly language syntax are
listed in Table 3-7. These status conditions are used with the IF condition
clause available on some instructions. In addition, the status of the FI pin
(Flag In) can also be used as a condition for JUMP and CALL instructions.
EQ Equal Zero AZ = 1
AC ALU Carry AC = 1
AV ALU Overflow AV = 1
MV MAC Overflow MV = 1
TOPPCSTACK Instruction
A special version of the Register-to-Register Move instruction, Type 17, is
provided for reading (popping) or writing (pushing) the top value of the
PC stack.
Only the registers listed in Table 3-8 may be used in the special
TOPPCSTACK instructions.
AX0 I0 I4
AX1 I1 I5
MX0 I2 I6
MX1 I3 I7
AY0 M0 M4
AY1 M1 M5
MY0 M2 M6
MY1 M3 M7
AR L0 L4
MR0 L1 L5
MR1 L2 L6
MR L3 L7
SI
SE
SR0
SR1
" type! TOPPCSTACK may not be used as a register in any other instruction
TOPPCSTACK Restrictions
There are several restrictions on the use of the special TOPPCSTACK instruc-
tions, as follows:
• The pop and read TOPPCSTACK instruction may not be placed directly
before an RTI instruction (return from interrupt). A NOP must be
inserted in between:
reg = TOPPCSTACK;
NOP; /* allow pop to occur correctly */
RTI; /* another pop happens automatically */
• The pop and read TOPPCSTACK instruction may not be the last or
next-to-last instruction in a Do Until loop. Neither instruction 1
nor instruction 2 may be the pop/read TOPPCSTACK instruction in the
following code:
DO loop UNTIL CE;
AX0=DM(I5,M5);
...
instruction 2;
loop: instruction 1;
Overview
This chapter describes the units that control the movement of data to and
from the processor and from one data bus to another within the processor.
These units include the following:
• Data address generators (DAGs)
• Program Memory Data (PMD) bus and Data Memory Data
(DMD) bus exchange unit
The software also provides a method for managing the placement of the
buffer in memory. Only the initializing of DAG registers must be explic-
itly programmed (see “Indirect Addressing” on page 4-4 and “Modulo
Addressing (Circular Buffers)” on page 4-5).
DAG Registers
Figure 4-1, shows a block diagram of a single data address generator.
There are three register files: the modify (M) register file, the index (I) reg-
ister file, and the length (L) register file. Each of the register files contains
four 14-bit registers that can be read from and written to via the DMD
bus.
DM D B U S
FR OM
IN STR UC TION MUX
2 14 14 14 14 FR OM
IN STR UC TION
2
L I M
M O DU LUS
RE GIS T ER S RE GIS T ER S RE GIS TER S
4 X 14 LO GIC 4 X 14 4 X 14
14 AD D
BIT
DA G1 ON LY
RE VE RS E
AD DR E SS
Indirect Addressing
The ADSP-218x family processors allow two addressing modes for Data
Memory fetches: direct and register indirect. Indirect addressing is accom-
plished by loading an address into an I (index) register and specifying one
of the available M (modify) registers.
The L registers are provided to facilitate wraparound addressing of circular
data buffers. A circular buffer is only implemented when an L register is
set to a non-zero value. For linear (i.e. non-circular) indirect addressing,
the L register corresponding to the I register used must be set to zero.
I3=0x3800;
M2=0;
L3=0;
AX0=DM(I3,M2);
where:
I=current address
M=modify value (signed)
B=base address
L=buffer length
M + I=modified address
This condition insures that the next address cannot wrap around the
buffer more than once in one operation.
Bit-Reverse Addressing
The bit-reverse logic is primarily intended for use in FFT computations
where inputs are supplied or the outputs generated in bit-reversed order.
Bit-reversing is available only on addresses generated by DAG1. The pivot
point for the reversal is the midpoint of the 14-bit address, between bits 6
and 7. This is illustrated in the following chart.
Individual address lines (ADDR ) N
Normal Order 13 12 11 10 09 08 07 06 05 04 03 02 01 00
Bit-reversed 00 01 02 03 04 05 06 07 08 09 10 11 12 13
where N is the number of bits you wish to output reversed. For a complete
example of this, refer to Section 6.6.5.2 “Modified Butterfly” in
Chapter 6, “One-Dimensional FFTs” of the applications handbook Digi-
tal Signal Processing Applications Using the ADSP-2100 Family (Volume 1).
This directive declares an array of 128 16-bit values located in Data Mem-
ory. The following is an example of the way in which you can reference
the array’s address and length, respectively:
I0=coefficients; /* point to address of buffer */
L0=0; /* set L register to zero */
MX0=DM(I0,M0); /* load MX0 from buffer */
These instructions load a value into MX0 from the beginning of the coeffi-
cients buffer in Data Memory. With the automatic post-modify of the
DAGs, you could execute the second of these instructions in a loop and
continuously advance through the buffer.
Alternatively, when you only need to address the first location, you can
directly use the buffer name as a label in many circumstances such as
MX0=DM(coefficients);
Circular Buffers
A common requirement in DSPs is the circular buffer. The circular buffer
is directly implemented by the processors’ DAGs, using the L (length) reg-
isters. First, you must declare the buffer as circular:
.VAR/CIRC coefficients[128];
This identifies it to the linker for placement on the proper address bound-
ary. Next, you must initialize the L register and, in the example below, the
I register and M register:
PM D B US
24
8 (L O W E R ) 16 (U P P E R ) 16 (U P P E R )
8 (L O W E R )
PX
M E
8
U G
X I
S
T
E
R
8 16 16
8 (L O W E R )
16
DMD BU S
In this example, the 16 bits of AX0 are stored into the upper 16 bits
of a 24-bit Program Memory word. The 8 bits of PX are automati-
cally stored to the 8 lower bits of the memory word.
From the DMD bus, the PX register may be:
1. Loaded with a data move instruction, explicitly specifying the PX
register as the destination. The lower 8 bits of the data value are
used and the upper 8 are discarded.
PX = AX0;
Whenever any register is written out to Program Memory, the source reg-
ister supplies the upper 16 bits. The contents of the PX register are
automatically added as the lower 8 bits. If these lower 8 bits of data to be
transferred to Program Memory (through the PMD bus) are important,
you should load the PX register from the DMD bus before the Program
Memory write operation.
Overview
Synchronous serial ports, or SPORTs, support a variety of serial data com-
munications protocols. They can provide a direct interconnection between
processors in a multiprocessor system.
All ADSP-218x family processors contain two serial ports, SPORT0 and
SPORT1. These serial ports have some similarities and some differences.
This chapter provides a detailed description of the SPORTs and explains
the differences between the two.
Basic Description
Each SPORT has a five-pin interface:
A SPORT receives serial data on its DR input and transmits serial data on
its DT output. It can receive and transmit simultaneously for full duplex
operation. The data bits are synchronous to the serial clock SCLK, which is
an output if the processor generates this clock or an input if the clock is
generated externally. Frame synchronization signals RFS and TFS are used
to indicate the start of a serial data word or stream of serial words.
Figure 5-1, shows a simplified block diagram of a single SPORT.
DMD BUS
16
16 16
TXN CO M P A N D IN G RXN
T R A N S M IT D A T A RE C E IV E D A T A
HARDW ARE
RE G IS T E R RE G IS T E R
16
16
SE R IA L
TR A N S M IT S H IF T R E G IS T E R CONTROL RE C E IV E S H IF T R E G IS T E R
IN T E R N A L
SE R IA L
CLOC K
GENERATO R
DT TFS SCLK RFS DR
Interrupts
Each SPORT has a receive interrupt and a transmit interrupt. The priority
of these interrupts is shown in Table 5-2.
For complete details about how interrupts are handled, see “Interrupts” in
Chapter 3, “Program Sequencer.”
Operation
Writing to a SPORT’s TX register readies the SPORT for transmission; the
TFS signal initiates the transmission of serial data. Once transmission has
begun, each value written to the TX register is transferred to the internal
transmit shift register and subsequently the bits are sent, MSB first. Each
bit is shifted out on the rising edge of SCLK.
After the first bit (MSB) of a word has been transferred, the SPORT gen-
erates the transmit interrupt. The TX register is now available for the next
data word, even though the transmission of the first word is ongoing.
SPORT Programming
To the programmer, the SPORT can be viewed as two functional sections.
The configuration section is a block of control registers (mapped to Data
Memory) that the program must initialize before using the SPORTs. The
data section is a register file used to transmit and receive values through
the SPORT.
Configuration
Sport configuration is accomplished by setting bit and field values in con-
figuration registers. These registers are memory mapped in Data Memory
space. SPORT0 configuration registers occupy locations 0x3FF3 to
0x3FFA; SPORT1 configuration registers occupy locations 0x3FEF to
0x3FF2. The contents of these registers are summarized in Table 5-3 and
in the register summary in Appendix B, “Control/Status Registers.” The
effects of the various settings are described at length in the sections that
follow.
Address Contents
Address Contents
In the second method, the DAG (I) index register must contain the Data
Memory address of the configuration register to be written. The modify
(M) register, which updates the I register after the write, must also contain
a valid value. And the length (L) register that has the same number as the I
register must be initialized to zero so that the circular buffer capability is
not active. For example:
AX1 = 0;
I0 = 0x3FF2;
M0 = 1;
L0 = 0;
AX0 = 0x6B27;
DM(I0,M0) = AX0; /* the constant 0x6B27 is written */
from ALU register AX0 to
address pointed to by I0;
pointer then modified by M0 */
DM(I0,M0) = AX1; /* address 0x3FF3 is set to 0 */
Either method works. This method is, however, more prone to error
because the registers are written indirectly. You must make sure that the I
register contains the intended value before the write.
Because the SPORTs are interrupt driven, these instructions would typi-
cally be executed within a interrupt service routine in response to a
SPORT interrupt.
SPORT Enable
SPORTs are enabled through bits in the System Control register, as
shown in Figure 5-2. This register is mapped to Data Memory address
0x3FFF. Bit 12 enables SPORT0 if it is a 1, and bit 11 enables SPORT1 if
it is a 1. Both of these bits are cleared at reset, disabling both SPORTs.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
S PO R T1 C on fig ure
1 = serial po rt, 0 = FI, F O, IR Q 0, IR Q 1, S C LK
S PO R T1 E nable
1 = enabled , 0 = d isab led
S PO R T0 E nable
1 = enabled , 0 = d isab led
Serial Clocks
Each SPORT operates on its own serial clock signal. The serial clock
(SCLK) can be internally generated or received from an external source.
The ISCLK bit, bit 14 in either the SPORT0 or SPORT1 Control register,
determines the SCLK source for the SPORT (see Figure 5-3 on page 5-12).
If this bit is a 1, the processor generates the SCLK signal; if it is a 0, the pro-
cessor expects to receive an external clock signal on SCLK. At reset, ISCLK is
cleared, so both serial ports are in the external clock mode. When ISCLK is
set, internal generation of the SCLK signal begins on the next instruction
cycle, whether or not the corresponding SPORT is enabled. As a result,
you can use unused SPORTs as timers, counters, or clock dividers if you
wish.
The maximum frequency of an externally generated clock can be deduced
from 1/tSCK, as specified in the data sheet for the processor. The frequency
of an internally generated clock is a function of the processor clock fre-
quency (as seen at the CLKOUT pin) and the value of the 16-bit serial clock
divide modulus register SCLKDIV (0x3FF5 for SPORT0 and 0x3FF1 for
SPORT1).
CLKOUT frequency
SCLK frequency = ----------------------------------------------------------------------------
2 × ( SCLKDIV + 1 )
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Table 5-5 shows how some common SCLK frequencies correspond to val-
ues of SCLKDIV. (The values assume a CLKOUT frequency of 73.728 MHz.)
30719 1200 Hz
3839 9600 Hz
575 64 kHz
23 1.536 MHz
17 2.048 MHz
5 6.144 MHz
Note that the serial clock of SPORT1 (the SCLK pin) still functions when
the port is being used in its alternate configuration (as FO, FI and two
interrupts). In this case, SCLK is unresponsive to an external clock, but can
internally generate a clock signal as described above.
Word Length
Each SPORT independently handles words of 3 to 16 bits. The data is
right-justified in the SPORT data registers if it is fewer than 16 bits long.
The serial word length (SLEN) field in each SPORT Control register deter-
mines the word length according to this formula:
Serial Word Length = SLEN + 1
For example, if you are using 8-bit serial words, set SLEN to 7 (0111
binary). The SLEN field is comprised of bits 3-0 in the SPORT Control
register (0x3FF6 for SPORT0 and 0x3FF2 for SPORT1) (see Figure 5-4).
S LE N (Seria l W o rd Leng th – 1)
Do not set SLEN to zero or one; these SLEN values are not permitted.
Frame Synchronization
Word framing signals are optional. If the receive frame sync required
(RFSR) or transmit frame sync required (TFSR) bit in the SPORT Control
register is a 0, a frame sync signal is necessary to initiate communications
but is ignored after the first bit is transferred. Words are then transferred
continuously, unframed. If the RFSR or TFSR bit is a 1, a frame sync signal
is required at the start of every data word.
The RFSR bit is bit 13 in the SPORT Control register (0x3FF6 for
SPORT0 and 0x3FF2 for SPORT1), and the TFSR bit is bit 11. These bits
are both cleared at reset, so that communication in both directions on
both serial ports is unframed (see Figure 5-5).
If frame sync signals are generated externally, then RFS and TFS are inputs,
and the external source controls data transmission and reception. The
SPORT will wait for a transmit frame sync before transmitting data and
for a receive frame sync before receiving data. If frame sync signals are
generated internally, however, then RFS and TFS are outputs, and the pro-
cessor controls the timing of data operations.
For example, to allow 256 SCLK cycles between RFS assertions, set RFSDIV
to 255 (0xFF).
Values of RFSDIV+1 that are less than the word length are not
recommended.
Note that frame sync signals may be generated internally even when SCLK
is supplied externally. This provides a way to divide external clocks for any
purpose.
You can also use one frame sync to generate a single signal for both trans-
mit and receive data. For example, an internally generated RFS (output)
could be connected to an externally generated TFS (input) on the same
SPORT for simultaneous transmit and receive operations. This intercon-
nection is especially useful for combo coder/decoder (codec) interfaces.
In the alternate framing mode, the framing signal should be asserted in the
same SCLK cycle as the first bit of a word. Received data bits are latched on
the falling edge of SCLK and transmitted bits are driven on the rising edge
of SCLK, but the framing signal is checked only on the first bit. Internally
generated frame sync signals remain asserted for the length of the serial
word. Externally generated frame sync signals are only checked during the
first bit time.
Framing modes for receiving and transmitting data are independent. If the
receive frame sync width ( RFSW) bit or transmit frame sync width (TFSW)
bit in the SPORT Control register is a 0, normal framing is enabled. If the
RFSW or TFSW bit is a 1, alternate framing is used. The RFSW bit is bit 12 in
the SPORT Control register (0x3FF6 for SPORT0 and 0x3FF2 for
SPORT1), and the TFSW bit is bit 10. These bits are both cleared at reset,
so that normal framing in both directions is enabled. (see Figure 5-7).
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
TF S W 0 = No rm al Tran sm it Fram in g
1 = Alterna te Tran sm it F ram ing
R FS W 0 = No rm a l R eceiv e Fram in g
1 = Alter nate Rece ive Fram ing
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
INV R FS 0 = Activ e H ig h R F S
1 = Active Lo w R F S
Configuration Example
The example code in Listing 5-1 illustrates how to configure the SPORTs.
This example configures both SPORT0 and SPORT1. SPORT0 is config-
ured for an internally generated serial clock (SCLK), internally generated
frame synchronization, and µ-law companded 8-bit data. This is a typical
setup for communication with a combination codec. SPORT1 is config-
ured for an externally generated serial clock, externally generated frame
synchronization, non-companded 16-bit data and autobuffering. This
setup could be used to transfer data between processors in a multiproces-
sor system.
Only the needed memory mapped registers are initialized. Notice that the
SPORTs are configured before they are enabled and that any extraneous
latched interrupts are cleared before interrupts are enabled.
/* SPORT1 inits */
AX0 = 0x0017;
DM(0x3FEF) = AX0; /* enable SPORT1 autobuffering
TX autobuffer uses I0 and M0
RX autobuffer uses I1 and M1 */
AX0 = 0x280F;
DM(0x3FF2) = AX0; /* external serial clock, RFS and TFS
RFS and TFS are required, normal
framing, no companding and 16 bits */
/* SPORT0 inits */
/* Assumes a CLKOUT of 75.728 MHz.
Internally generated SCLK will be
2.048 MHz, and framing sync of 8 kHz. */
AX0 = 255;
DM(0x3FF4) = AX0; /* RFSDIV = 256, 256 SCLKs between
frame syncs: 8 kHz framing */
AX0 = 17;
DM(0x3FF5) = AX0; /* SCLK = 2.048 MHz */
AX0 = 0x6B27;
DM(0x3FF6) = AX0; /* internal SCLK, RFS and TFS
normal framing, mu-law companding
8 bit words */
/* SPORT ENABLE */
IFC = 0x1E; /* clear any extraneous SPORT interrupts */
ICNTL = 0; /* interrupt nesting disabled */
AX0 = 0x1C1F; /* both SPORTs enabled, BWAIT and */
DM(0x3FFF) = AX0; /* PWAIT left as default */
IMASK = 0x1E; /* SPORT interrupts are enabled */
Timing Examples
This section contains examples of some combinations of the various fram-
ing options. The timing diagrams show relationships between signals, but
are not scaled to show the actual timing parameters of the processor. Con-
sult the appropriate DSP data sheet for actual timing parameters and
values.
The examples assume a word length of four bits, that is, SLEN = 3. Framing
signals are active high, that is, INVRFS = 0 and INVTFS = 0.
The value of the SPORT Control register (0x3FF6 for SPORT0 and
0x3FF2 for SPORT1) is shown for each example. In these binary values,
1= high, 0 = low, and X can be either. The underlined bit values are the
bits that set the modes illustrated in the example.
Figures 5-9 through 5-14 show framing for receiving data. In Figure 5-9
and Figure 5-10, the normal framing mode is shown for noncontinuous
data (any number of SCLK cycles between words) and continuous data (no
SCLK cycles between words). Figure 5-11 and Figure 5-12 show noncon-
tinuous and continuous receiving in the alternate framing mode. In all
four figures, both the input timing requirement for an externally gener-
ated frame sync and the output timing characteristic of an internally
generated frame sync are shown. Note that the output meets the input
timing requirement; thus, on processors with two SPORTs, one SPORT
could provide RFS for the other.
S CL K
R FS
O U TP UT
R FS
INP U T
DR
B3 B2 B1 B0 B3 B2 B1 B0
S PO R T C on tr ol R egister:
Intern al Fram e Syn c 0X 10 XX X 1 X 0X X 00 11
E xternal Fram e S yn c 0X 10 X XX 0 X 0X X 00 11
B oth Intern al Fram ing O p tion and External Fram ing O p tion Sh ow n
S CL K
R FS
O UT PU T
R FS
INP U T
DR B3 B2 B1 B0 B3 B2 B1 B0 B3 B2
S PO R T Co ntr ol Register:
Internal Fram e Syn c 0X 10 XX X 1 X 0X X 00 11
E xternal Fram e S yn c 0X 10 XX X 0 X 0X X 00 11
B oth Internal Fram in g O ptio n and E xtern al Fram in g O ptio n Sh ow n
S CL K
R FS
O U TP UT
R FS
INP U T
DR
B3 B2 B1 B0 B3 B2 B1 B0
S PO R T C ontr ol Register :
Intern al Fram e Syn c 0X 11 XX X 1 X0X X 00 11
E xternal Fram e S yn c 0X 11 XX X 0 X0X X 00 11
B oth Intern al Fram in g O ption and Extern al Fram in g O ption Sh ow n
S CL K
R FS
O U TP UT
R FS
INP U T
DR
B3 B2 B1 B0 B3 B2 B1 B0
S PO R T C on trol R egister :
Intern al Fram e Syn c 0X 11 XX X 1 X 0X X 00 11
E xternal Fram e S yn c 0X 11 XX X 0 X0X X 00 11
B oth Intern al Fram ing O ption and External Fram ing O ption Sh ow n
Figure 5-13 and Figure 5-14 show the receive operation with normal
framing and alternate framing, respectively, in the unframed mode. There
is a single the frame sync signal that occurs only at the start of the first
word, either one SCLK before the first bit (normal) or at the same time as
the first bit (alternate). This mode is appropriate for multiword bursts
(continuous reception).
S CL K
R FS
DR
B3 B2 B1 B0 B3 B2 B1 B0 B3 B2
S PO R T C ontr ol Register :
Intern al Fram e Syn c 0X 00 XX X 1 X0X X 00 11
E xternal Fram e S yn c 0X 00 XX X 0 X0X X 00 11
S CL K
R FS
DR
B3 B2 B1 B0 B3 B2 B1 B0 B3 B
2
S PO R T C ontr ol Register :
Intern al Fram e Syn c 0X 01 XX X 1 X0X X 00 11
E xternal Fram e S yn c 0X 01 XX X 0 X0X X 00 11
Figures 5-15 through 5-20 show framing for transmitting data and are
very similar to Figures 5-9 to 5-14. In Figure 5-15 and Figure 5-16, the
normal framing mode is shown for noncontinuous data and continuous
data. Figure 5-17 and Figure 5-18 show noncontinuous and continuous
transmission in the alternate framing mode. As with receive timing, the
TFS output meets the TFS input timing requirement.
S CL K
TF S
O U TP UT
TF S
INP U T
DT B3 B2 B1 B0 B3 B2 B1 B0
S PO R T C ontr ol Register :
Intern al Fram e Syn c 0X XX 10 1X 0 X XX 0 011
E xternal Fram e S yn c 0X XX 1 0 0X 0 X XX 0 011
B oth Intern al Fram in g O ption and Extern al Fram in g O ption Sh ow n
S CL K
TF S
O U TP UT
TF S
INP U T
DT B3 B2 B1 B0 B3 B2 B1 B0 B3 B2
S PO R T C on tr ol R egister :
Intern al Fram e Syn c 0X X X 101X 0X XX 0 011
E xternal Fram e S yn c 0X X X 100X 0X XX 0 011
B oth Intern al Fram ing O ption and External Fram ing O ption Sh ow n
S CL K
TF S
O U TP UT
TF S
INP U T
DT
B3 B2 B1 B0 B3 B2 B1 B0
S PO R T C on tr ol R egister:
Intern al Fram e S yn c 0X X X 111X 0X XX 0 011
E xtern al Fram e S yn c 0X X X 110X 0X XX 0 011
B oth Intern al Fram ing O p tion and External Fram ing O p tion Sh ow n
N ote: Th ere is an asynchro no u s delay betw een TF S in pu t and D T . See th e ap pro priate
data sheet fo r specification s.
S CL K
TF S
O UT PU T
TF S
INP U T
DT B3 B2 B1 B0 B3 B2 B1 B0
S PO R T Co ntr ol Register:
Internal Fram e Syn c 0X XX 1 11 X 0 X XX 0 011
E xternal Fram e S yn c 0X XX 1 10 X 0 X XX 0 011
B oth Internal Fram in g O ptio n and E xtern al Fram in g O ptio n Sh ow n
N ote: Th ere is an asynchron ou s delay betw een T FS in pu t and D T. See th e ap pro priate
data sheet fo r specifications.
Figures 5-19 and 5-20 show the transmit operation with normal framing
and alternate framing, respectively, in the unframed mode. There is a sin-
gle the frame sync signal that occurs only at the start of the first word,
either one SCLK before the first bit (normal) or at the same time as the first
bit (alternate).
S CL K
TF S
DT
B3 B2 B1 B0 B3 B2 B1 B0 B3 B2
S PO R T C on tr ol R egister :
Intern al Fram e Syn c 0X X X 001X 0X XX 0 011
E xternal Fram e S yn c 0X X X 000X 0X XX 0 011
S CL K
TF S
DT B3 B2 B1 B0 B3 B2 B1 B0 B3 B2
S PO R T Co ntrol Register :
Internal Fram e Syn c 0X XX 011X 0X XX 0 011
E xternal Fram e S yn c 0X XX 010X 0X XX 0 011
N ote: Th ere is an asynchron ou s delay betw een T FS in pu t and D T. See th e ap pro priate
data sheet fo r specifications.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
When companding is enabled, valid data in the RX0 or RX1 register is the
right-justified, sign-extended, expanded value of the eight LSBs received.
Likewise, a write to TX0 or TX1 causes the 16-bit value to be compressed to
eight LSBs (sign-extended to the width of the transmit word) before being
written to the internal transmit register. If the magnitude of the 16-bit
value is greater than the 13-bit A-law or 14-bit µ-law maximum, the value
is automatically compressed to the maximum positive or negative value.
Use the same procedure to expand data, but use RXn instead of TXn.
RX0 = AX0; /* compressed data written to receive
register */
NOP; /* any instruction */
AX1 = RX0; /* expanded - linear value transferred to
AX1 */
Autobuffering
In normal operation, a SPORT generates an interrupt when it has received
or has started to transmit a data word. Autobuffering provides a mecha-
nism for receiving or transmitting an entire block of serial data before an
interrupt is generated. Service routines can operate on the entire block of
data, rather than on a single word, reducing overhead significantly. Auto-
buffering is available on both SPORT0 and SPORT1.
Autobuffering uses the circular buffer addressing capability of the DAGs.
With autobuffering enabled, each serial data word is transferred (or if
multichannel operation is enabled, each active word is transferred) to or
from Data Memory in a single overhead cycle. (Autobuffering to Program
Memory is not supported.) This overhead cycle occurs independently of
the instructions being executed and effectively suspends execution for one
cycle (or more, if wait states are required) when it happens. No interrupt
is generated for these individual data word transfers.
The autobuffer transfer cannot be duplicated by any instruction. How-
ever, an equivalent assembly language instruction would be:
DM(I,M) = RX0
or Equivalent Instructions Only
TX0 = DM(I,M)
The I and M registers used in the transfer are selected by fields in the
SPORT’s Autobuffer Control register.
The processor waits for the current instruction to finish before inserting
the overhead cycle. A delay in the autobuffer transfer occurs if the transfer
is required during an instruction executing in multiple cycles (for wait
states, for example). If the transfer is required when the processor is wait-
ing in an IDLE state, the transfer is executed and the processor returns to
IDLE.
When a data word transfer causes the circular buffer pointer to wrap
around, the SPORT interrupt is generated. The receive interrupt occurs
after the complete buffer has been received. The transmit interrupt occurs
when the last word is loaded into TXn, prior to transmission.
Aside from the completion of an instruction requiring multiple cycles and
IDMA and BDMA cycles, the automatic transfer of individual data words
has the highest priority of any operation short of RESET, including all
interrupts. (For more information on the priority chain hierarchy of the
ADSP-218x family, please see “Priority Chain” in Chapter 9, “DMA
Ports.”) Thus, it is possible for an autobuffer transfer to increase the
latency of an interrupt response if the interrupt happens to coincide with
the transfer. Up to four autobuffered transfers can occur; in the case that
two or more are needed in the same cycle, they have the following priority,
which is the same as the SPORT interrupt priority:
Highest SPORT0 Transmit
SPORT0 Receive
SPORT1 Transmit
Lowest SPORT1 Receive
In the worst case that all four autobuffer transfers are required at about the
same time, interrupt latency would increase by the time it takes for all the
transfers to occur, which is affected by wait states and bus request.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
TIR E G TM R E G R IR E G R M R EG
TB U F
R BU F
(R eceive Au to bu ffering E n ab le)
The I and M registers used for autobuffering are identified by fields in the
Autobuffer Control register. TIREG and TMREG are binary values that
indicate the numbers of the I and M registers, respectively, associated with
the transmit buffer. The rules governing the pairing of I and M registers are
the same as for other DAG operations: the I and M registers must be in the
same DAG, numbered either 0-3 for DAG1 or 4-7 for DAG2. Conse-
quently, three bits identify the I register, but only two bits are necessary to
indicate the M register because the third bit (MSB) of the M register number
must be the same as for the I register.
Likewise, RIREG and RMREG indicate the numbers of the I and M regis-
ters, respectively, associated with the receive buffer.
The TBUF and RBUF bits enable transmit autobuffering and receive auto-
buffering, respectively. These bits are cleared to zeros at reset and after a
reboot. Consequently, autobuffering in progress cannot continue through
a reboot operation; you must re-enable autobuffering after a reboot.
Autobuffering Example
Listing 5-2 provides an example that sets up SPORT1 for autobuffering
operation. The code assumes that the processor is running with a clockout
frequency of 73.728 MHz. The SPORT will automatically transmit values
from the circular buffer named tx_buffer. It will receive values as they are
sent to the SPORT and automatically transfer the data into the buffer
named rx_buffer. A transmit interrupt will be generated once all of the
tx_buffer values have been transferred to TX1, but before the last value has
been loaded into the transmit shift register. A receive interrupt will be
generated once the rx_buffer has been completely filled.
.SECTION/DM data1;
.VAR/CIRC tx_buffer[10];
.VAR/CIRC rx_buffer[10];
.SECTION/PM program;
.global sport1_inits;
sport1_inits:
I0 = tx_buffer; /* I0 contains address of
tx_buffer */
M0 = 1; /* fill every location */
L0 = length (tx_buffer); /* L0 set to length of
tx_buffer */
I1 = rx_buffer; /* I1 points to
rx_buffer */
L1 = length (rx_buffer); /* L1 set to length of
rx_buffer */
/* set up interrupts */
/* enable SPORT1 */
AX0 = DM(I0,M0);
TX1 = AX0;
RTS;
Multichannel Function
SPORT0 supports a multichannel function. In the multichannel mode of
operation, serial data is time-division multiplexed. Each subsequent word
belongs to the next consecutive channel so that, for example, a 24-word
block of data contains one word for each of 24 channels. SPORT0 sup-
ports 32 or 24 channels and can automatically select words for particular
channels while ignoring the others.
In single-channel mode, receive and transmit framing identifies the start
of a single word or continuous stream, with independent receive and
transmit operation. In the multichannel mode, the receive frame sync sig-
nal ( RFS0) identifies the start of a 24- or 32-word block of serial data with
the receiver and transmitter operating in parallel. TFS0 has an alternate
function, described below.
Multichannel Setup
Multichannel operation is enabled by bit 15 in SPORT0’s Control regis-
ter (0x3FF6). When this bit is a 1, multichannel mode is enabled, and
some control bits in the SPORT0 Control register are redefined. Bits
affected by multichannel mode are shown in Figure 5-23. At reset, bit 15
is cleared, disabling multichannel mode and enabling normal operation.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
MFD
IN V T D V (In v e rt T ra n s m it D a ta V a lid )
(M u ltic h a n n e l
F ra m e D e la y )
M C L (M u ltic h a n n e l L e n g th )
MCE 0 = 2 4 W o rd s
(M u ltic h a n n e l E n a b le ) 1 = 3 2 W o rd s
1 = M u ltic h a n n e l O p e ra tio n
The state of the multichannel length bit MCL, bit 9, determines whether
there are 24 or 32 channels, i.e. whether the block length is 24 or 32
words. A 0 selects 24-word blocks; a 1, 32-word blocks. In multichannel
mode, the word length is still set by the SLEN field in the SPORT Control
register and can be 3 to 16 bits.
The multichannel frame delay (MFD) is a 4-bit field specifying (in binary)
the number of serial clock cycles between the frame sync signal and the
first data bit. This allows the processor to work with different types of T1
interface devices. Figure 5-24 shows a variety of delays.
S CL K 9 8 7 6 5 4 3 2 1
FIRS T
BIT
R FS M FD =9
R FS M FD =8
R FS M FD =7
R FS M FD =6
R FS M FD =5
R FS M FD =1
R FS M FD =0
0x3FFA
Receive
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 W ord
Enables
0x3FF9
1 = Chann el Enabled
0 = Channel Ignored
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0x3FF8
Transm it
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 W ord
Enables
0x3FF7
Multichannel Operation
Received words for channels that are not enabled are ignored; that is, no
interrupts are generated for these words, no autobuffering occurs and no
data is written to the RX0 register. Likewise, there are no interrupts and no
autobuffering for transmit words that are not enabled. During transmit
word time slots for channels that are not enabled, the data transmit (DT)
pin is tristated.
! Itmultichannel
is important that
mode.
RFS does not occur more than once per frame in
S CL K
DR
B3 B2 B1 B0 IGN O R ED B3 B2
R FS
DT
B3 B2 B1 B0 B3 B2
TD V
Companding Delay
Use of the companding circuit introduces latency in two ways. First, com-
pressing or expanding a data value takes a single processor cycle. Second,
SPORT0 has priority over SPORT1 if both require an expansion or com-
pression operation in the same cycle; in this case, SPORT1 must wait one
processor cycle. See the section on companding earlier in this chapter for
more details on companding.
Startup Timing
When a serial port is enabled by a write to the System Control register, it
takes two SCLK cycles before it is actually enabled. On the next (third)
SCLK cycle, the serial port becomes active, looking for a frame sync.
When the a serial port is disabled, if you set up the configuration to gener-
ate an internal SCLK, the pin becomes active before the port is enabled.
Once data is written into the TX register, the processor generates a frame
sync after a synchronization delay. This delay in turn affects the timing of
the serial port transmit interrupt. The latency depends on five factors:
• Frequency of the serial clock
• Whether or not companding is enabled
• Whether or not there is contention for the companding circuit
• Whether the current word has finished transmitting
• Logic level of the SCLK when the data value was loaded into the
transmit register
! Ifmitting
the transmit frame sync is generated externally, data starts trans-
when a frame sync signal is received.
After the TX register is loaded, it takes three complete phases of the serial
clock, HIGH, LOW and HIGH, in that order, to ensure synchronization
(see Figure 5-28).
TX W ritten , S CL K H ig h
T X W r itte n
P ro cesso r Clock
S erial C lock H ig h Lo w H ig h
TF S O U TP UT
(No rm al Fram ing )
TF S O U TP UT
(Altern ate Fra m ing )
TX W ritten , S C LK L ow
TX W ritten
P ro cesso r Clock
S erial C lock H ig h Lo w H ig h
TF S O U TP UT
(No rm al Fram ing )
TF S O U TP UT
(Altern ate Fra m ing )
Once synchronization has been ensured and a frame sync generated, the
most significant bit of the transmit word is shifted out as follows: on the
same rising edge as the frame sync if alternate framing is used and on the
rising edge of the next serial clock if normal framing is used. Therefore,
the worst-case synchronization delay is two SCLK cycles.
There is additional delay if the previous data transmission has not com-
pleted; the TX register cannot be loaded into the transmit shift register
until the previous transmission is complete.
TF S
DT B IT 3 B IT 2 B IT 1 B IT 0
S CL K
R FS
DR B IT 3 B IT 2 B IT 1 B IT 0
SCLK
R FS
DR B IT 3 B IT 2 B IT 1 B IT 0
S CL K
The LSB is received on the falling edge of SCLK. One processor cycle
elapses to allow synchronization to the processor clock. One processor
cycle later, the SPORT attempts to expand the data if companding is
enabled and the other serial port is not using the companding circuitry.
Companding latencies as discussed above occur prior to generation of a
receive interrupt. Servicing the receive interrupt is subject to the same
latencies as other interrupts.
C LK O UT
P ro cess or can
R equ est service the
req uest h ere
S etup T im e
H old Tim e
R equ est
C LK O UT
E XE C A B FE TC H IN T INT
S ync D e lay
R equ est
C LK O UT
E XE C A B A UT O BU F FE R C
S ync D e lay
R equ est
C LK O UT
E XE C A B C A UT O BU FF E R D
C OM P A N D E XP AN D R X
S ync D elay
R eq uest S PO R T0 R eceive
R eq uest S PO R T1 R eceive
C LK O U T
E XE C A B C A UT O B UF FE R A UT O B UF FE R D
C O M PA N D E XP A N D R X 0 E XP A N D R X 1
S ync D e lay
E xpand R X0
E xpand R X1
R X0 A u to bu ffer Transfer
R X1 A u to bu ffer Transfer
C LK O U T
E XE C A U TO B UF FE R D E FE T CH IN T INT
S ync D e lay
Unusual Complications
In most cases the serial port companding, autobuffer, and interrupt laten-
cies are transparent to your application program. When trying to use the
same I register for more than one autobuffer channel, it becomes impor-
tant to make sure that the latencies do not affect the correct order of
operations. For example, if the serial port data is continuous, and the
receiver and transmitter are working with the same frame signal, the order
of the transmit and receive autobuffer or interrupt operations may be
affected by the latencies, as shown in Figure 5-38.
S CL K
DR B IT 3 B IT 2 B IT 1 B IT 0 B IT 3 B IT 2 B IT 1 B IT 0
DT B IT 3 B IT 2 B IT 1 B IT 0 B IT 3 B IT 2 B IT 1 B IT 0
Figure 5-38. Using One Index Register for Transmit and Receive
Autobuffer
If the processor is free to handle the autobuffer requests in the order they
are generated, the receive autobuffer happens first and is then followed by
the transmit autobuffer. The order of these operations may change if the
processor is not available to handle the requests due to any of the previ-
ously mentioned latencies.
In the example shown in Figure 5-35, there are 1½ serial clock cycles
between the requests. If the processor is subject to bus requests, wait
states, or other latencies that are longer than 1½ serial clock cycles, both
autobuffer operations may be held off. Since the transmit autobuffer has a
higher priority, its request will occur first.
Because of the priority of the autobuffer requests, the use of a single I reg-
ister is more difficult or even impossible in some cases. As long as there are
no possible latency cases longer than the difference in the timing of the
requests, it is quite possible to use a single I register for serial port
autobuffering.
Figure 5-39 shows a detailed flow chart for the gated serial clock proce-
dure described above.
S et S LE N field
in S P O RTx_Ctrl_Reg
to (no rm al_w ord_length-2)
in m ain program along with
res t of setup
E nable S P O RT
S it in IDLE loop
waiting for
S P O RTx interrupt
to occur
NO G et YE S Jum p to
Interrupt? IS R
YE S
Change the S LE N to
(norm al_word_length -1)
and ignore the first w ord
rec eived
! Tohigh-bandwidth
determine if reflection appears in a signal, you need to use a
scope with a 1 GHz or greater sampling frequency.
Serial ports are also subject to overshoot. For example, exceeding the max-
imum voltage input specification for the serial port may cause it to lock up
or hang.
1 2 3
SCLK
INPUT
TFS
INPUT
DT
OUTPUT
M SB
FL IN
FL O U T
S CL K S CL K
T FS
SP O R T
T FS
R FS R FS
DR DR
DT DT
Overview
The programmable interval timer can generate periodic interrupts based
on multiples of the processor’s cycle time. When enabled, a 16-bit count
register is decremented every n cycles, where n-1 is a scaling value stored
in an 8-bit register. When the value of the count register reaches zero, an
interrupt is generated and the count register is reloaded from a 16-bit
period register.
The scaling feature of the timer allows the 16-bit counter to generate peri-
odic interrupts over a wide range of periods. Given a processor cycle time
of 80 ns, the timer can generate interrupts with periods of 80 ns up to
5.24 ms with a zero scale value. When scaling is used, time periods can
range up to 1.34 seconds.
Timer interrupts can be masked, cleared and forced in software if desired.
For additional information, refer to the section “Interrupts” in Chapter 3,
“Program Control.”
Timer Architecture
The timer includes two 16-bit registers, TCOUNT and TPERIOD and one 8-bit
register, TSCALE. The extended Mode Control instruction enables and dis-
ables the timer by setting and clearing bit 5 in the Mode Status register,
MSTAT. For a description of the Mode Control instructions, refer to the
ADSP-218x DSP Instruction Set Reference. The timer registers, which are
memory-mapped, are shown in Figure 6-1.
TCOUNT is the count register. When the timer is enabled, it is decremented
as often as once every instruction cycle. When the counter reaches zero, an
interrupt is generated. TCOUNT is then reloaded from the TPERIOD register
and the count begins again.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 TS C AL E S caling R eg ister
0x3FF B
TSCALE stores a scaling value that is one less than the number of cycles
between decrements of TCOUNT. For example, if the value in TSCALE register
is 0, the counter register decrements once every cycle. If the value in
TSCALE is 1, the counter decrements once every 2 cycles. Figure 6-2 shows
the timer block diagram.
DM D Bus 16
8 16
16
CLK OU T
Tim er Enab le and
Decrem en t TCO UN T Zero
Prescale Logic
Tim er
Interrupt
Resolution
TSCALE provides the capability to program longer time intervals between
interrupts, extending the range of the 16-bit TCOUNT register. Table 6-1
shows the range and the relationship between period length and resolution
for TPERIOD = maximum.
Cycle Time = 30 ns
0 1.97 ms 30 ns
255 .5 s 7.65 µs
Timer Operation
Table 6-2 shows the effect of operating the timer with TPERIOD = 5,
TSCALE = 1 and TCOUNT = 5. After the timer is enabled (cycle n–1) the
counter begins. Because TSCALE is 1, TCOUNT is decremented on every other
cycle. The reloading of TCOUNT and continuation of the counting occurs, as
shown, during the interrupt service routine.
n+2 4 No decrement
n+4 3 No decrement
n+6 2 No decrement
n+8 1 No decrement
n+10 0 No decrement
n+12 5 No decrement
n+14 4 No decrement
One interrupt occurs every (TPERIOD +1) * (TSCALE +1) cycles. To set the
first interrupt at a different time interval from subsequent interrupts, load
TCOUNT with a different value from TPERIOD. The formula for the first
interrupt is (TCOUNT+1) * (TSCALE+1).
If you write a new value to TSCALE or TCOUNT, the change is effective imme-
diately. If you write a new value to TPERIOD, the change does not take
effect until after TCOUNT is reloaded.
Listing 6-1. Sample Code for Enabling the Timer and Generating
Interrupts
#include <def2181.h>
.SECTION/PM interrupts;
.SECTION/PM Program;
Start:
/* set TSCALE to decrement every cycle */
AX0 = 0;
DM(Tscale_Reg) = AX0;
/* set TCOUNT to generate first interrupt at 50 cycles */
AX0 = 49;
DM(Tcount_Reg) = AX0;
/* set TPERIOD to reload TCOUNT with 99 at interrupt */
AX0 = 99;
DM(Tperiod_Reg) = AX0;
/* enable the timer interrupt */
IMASK = 0x1;
/* start the count down after executing this */
ENA TIMER;
Interrupt_Hit:RTI;
Overview
This chapter describes the basic system interface features of the
ADSP-218x family processors. The system interface includes various hard-
ware and software features used to control the DSP processor.
Processor control pins include a RESET signal, clock signals, flag inputs and
outputs, and interrupt requests. This chapter describes only the logical
relationships of control signals; consult individual processor data sheets
for actual timing specifications.
Pin Descriptions
This section provides functional descriptions of the ADSP-218x processor
pins. Because processors come in different packages, there are some differ-
ences in the pins contained on each. Table 7-1 shows the package
configurations for each ADSP-218x processor and the sections that follow
identify the pins for each package.
Processor Package
Processor Package
ADSP-2184 100-LQFP
ADSP-2184L1 100-LQFP
ADSP-2185 100-LQFP
ADSP-2187L1 100-LQFP
Processor Package
Data 24 I/O Data I/O Pins for Program and Data Memory
Spaces (8 MSBs are also used as Byte Space
Addresses
SPORT1 5 I/O Serial Port1 or two external IRQs, Flag In and Flag
Out
EE 1 * Emulator only*
VDD 6 Power
GND 11 Ground
VDD 11 Power
GND 22 Ground
* These pins must be connected only to the EZ-ICE connector in the target system. These pins
have no function except during emulation and do not require pull-up or pull-down resistors.
After reset, the PF pins default to inputs and the interrupts are disabled by
the IMASK register’s default value. The pins can be used as PF outputs by
changing the PFTYPE register and leaving the interrupt disabled in IMASK.
If the pins are to be used as interrupts, then the PFTYPE register need not
be changed, but the interrupt must be enabled in the IMASK register.
Common-Mode Pins
Table 7-3 provides a description of the pins that are common to both Full
Memory Mode and Host Memory Mode in 100-LQFP packages. In cases
where pin functionality is reconfigurable, the default state is shown in
plain text; alternate functionality is shown in italics. All pin descriptions
also apply to the processors in 144-Ball Mini-BGA packages unless other-
wise noted.
VDD 6 I Power
GND 10 I Ground
VDD 11 I Power
GND 20 I Ground
GND 10 I Ground
(Applies to all ADSP-218x M and N series processors in 100-Lead LQFP package only)
GND 20 I Ground
(Applies to all ADSP-218x M and N series processors in 144-Ball Mini-BGA package only)
1 Interrupt/Flag Pins retain both functions concurrently. If IMASK is set to enable the correspond-
ing interrupts, then the DSP will vector to the appropriate interrupt vector address when the pin
is asserted, either by external devices, or set as a programmable flag.
2 SPORT configuration determined by the DSP System Control register. Software configurable.
D23:0 24 I/O Data I/O Pins for Program, Data, Byte and I/O
Spaces (8 MSBs are also used as Byte Memory
addresses)
D23:8 16 I/O Data I/O Pins for Program, Data Byte and I/O
spaces
IS 1 I IDMA Select
1 In Host Mode, external peripheral addresses can be decoded using the A0, CMS, PMS,
DMS, and IOMS signals.
The Mode pins can be set for active or passive configuration. An active
configuration means that the Mode pin is used as a Mode pin during reset,
but also functions alternately as a Programmable Flag pin or Interrupt Sig-
nal during runtime. Passive configuration means that the Mode pin is
used only as a Mode pin and has no alternate function during runtime.
A passive configuration is more easily implemented because only a simple
pullup or pulldown resistor is needed to maintain a proper logic level for
the Mode pin. (Tying a Mode pin directly to VDD or GND is also acceptable.)
An Active configuration requires either a weak pullup or pulldown (on the
order of 100 kΩ) or some type of tristate driver or logic gate to allow for
proper operation of the pin during its alternate mode of functioning as a
Programmable Flag pin or Interrupt signal. (A weak pullup or pulldown
resistor is used to reduce the amount of current flow to the input pin of
the DSP and to minimize the amount of current going through an output
driver.) For more information on setting the Mode pins for an active or
passive configuration, please see “Using Mode Pins with RESET and
ERESET Signals” on page 7-64.
! Table 7-6 shows the multiplexed pins for the Host Memory mode
and Full Memory mode of the 100-pin processors. These multi-
plexed pins are grouped in pairs. The pins listed in this table also
apply to the ADSP-2181 and ADSP-2183 processors.
Pin Name I/O Tri-State Reset State Hi-Z* Caused By… Unused
(Z) Configuration
XTAL I I Float
CLKOUT O O Float
Pin Name I/O Tri-State Reset State Hi-Z* Caused By… Unused
(Z) Configuration
BR I I High (Inactive)
BG O (Z) O EE Float
BGH O O Float
Pin Name I/O Tri-State Reset State Hi-Z* Caused By… Unused
(Z) Configuration
DT0 O O Float
DT1/FO O O Float
EE I I Float
EBR I I Float
EBG O O Float
ERESET I I Float
EMS O O Float
EINT I I Float
Pin Name I/O Tri-State Reset State Hi-Z* Caused By… Unused
(Z) Configuration
ECLK I I Float
ELIN I I Float
ELOUT O O Float
NOTES
* Hi-Z = High impedance
1. CLKIN, RESET, and PF3:0/Mode D:Mode A are not included in the table because these pins must
be used.
2. All bidirectional pins have tri-stated outputs. When a pin is configured as an output, the output is Hi-Z
(high impedance) when inactive.
Clock Signals
The ADSP-218x family processors may be operated with a TTL-compati-
ble clock signal input to the CLKIN pin or with a crystal connected between
the CLKIN and XTAL pins. If an external clock is used, XTAL must be left
unconnected. The CLKIN signal may not be halted, changed, or operated
below the specified frequency during normal operation.
The ADSP-218x family processors operate with an input clock frequency
equal to half the instruction rate; for example, a 16.67 MHz input clock
produces a 33 MHz instruction rate (30 ns cycle time). Device timing is
relative to the internal clock rate which is indicated by the CLKOUT signal.
Because these processors include an on-chip oscillator circuit, an external
crystal can be used. The crystal should be connected between the CLKIN
and XTAL pins, with two capacitors connected as shown in Figure 7-1. A
parallel-resonant, fundamental frequency, microprocessor-grade crystal
should be used. The frequency value selected for the crystal should be half
the desired instruction rate.
C LK IN X TA L C LK O UT
AD S P- 21 8X
AD S P- 21 8X
C LK IN X TA L C LK O UT
CL KIN
4 1 2 3 4 1 2 3 4
INT E RNA L
P RO CE SS O R
P RO CE SS O R P RO CE SS O R
S TA TE
CY CL E CY CL E
CL KO UT
Synchronization Delay
Each processor has several asynchronous inputs (interrupt requests, for
example), which can be asserted in arbitrary phase to the processor clock.
The processor synchronizes such signals before recognizing them. The
delay associated with signal recognition is called synchronization delay.
Different asynchronous inputs are recognized at different points in the
processor cycle. Any asynchronous input must be valid prior to the recog-
nition point to be recognized in a particular cycle. If an input does not
meet the setup time on a given cycle, it is recognized either in the current
cycle or during the next cycle if it remains valid.
Edge-sensitive interrupt requests are latched internally so that the request
signal only has to meet the pulse width requirement. To ensure the recog-
nition of any asynchronous input, however, the input must be asserted for
at least one full processor cycle plus setup and hold time. Setup and hold
times are specified in the data sheet for each individual device.
! Ifknow
a clock has not been supplied during , the processor does not
RESET
it has been reset and the registers won’t be initialized to the
proper values.
At powerup, if RESET is held low (asserted) without any input clock
signal, the states of the internal transistors are unknown and uncon-
trolled. This condition could lead to processor damage.
Table 7-8 on page 7-25 shows the RESET state of various registers, includ-
ing the processors’ on-chip memory-mapped status/control registers. The
values of any registers not listed are undefined at reset. The contents of
on-chip memory are unchanged after RESET, except as shown in Table 7-8
on page 7-25 for the data-memory-mapped control/status registers. The
CLKOUT signal continues to be generated by the processor during RESET,
except when disabled.
The contents of the computation unit (ALU, MAC, Shifter) and data
address generator (DAG1, DAG2) registers are undefined following RESET.
When RESET is released, the processor’s booting operation takes place,
depending on the state of the processor’s MMAP pin. (Program booting is
described in Chapter 8, “Memory Interface”.)
In a multiprocessing system with several processors, a synchronous RESET
is required.
! When the power supply and clock remain valid, the content of the
on-chip memory is not changed by a pulsed line. RESET
Software-Forced Rebooting
Software-forced reboots can be accomplished in different ways. A soft-
ware-forced reboot clears the context of the processor and initializes some
registers. A context clear clears the processor stacks and restarts execution
at address 0x0000. Table 7-7 shows the two different ways the
ADSP-218x processor can perform a software reboot.
Powerup Context Setting the PUCR bit in the SPORT1 Autobuffer and
Reset Powerdown Control register causes a reboot on
recovery from powerdown
BDMA Context Setting the BCR bit in the BDMA Control register
Reset before writing to the BDMA Word Count register
(BWCOUNT) causes a reboot. Execution starts after
the BDMA reboot is completed.
Table 7-8 shows the state of the processor registers after a software-forced
reboot. The values of any registers not listed are unchanged by a reboot.
During booting (and rebooting), all interrupts including serial port inter-
rupts are masked and autobuffering is disabled. The serial port(s) remain
active; one transfer—from internal shift register to data register—can
occur for each serial port before there are overrun problems.
The timer runs during a reboot. If a timer interrupt occurs during the
reboot, it is masked. Thus, if more than one timer interrupt occurs during
the reboot, the processor latches only the first.
Status registers
1 These values assume that you have just completed an initial BDMA boot load. For more infor-
mation on BDMA register contents during the boot loading process see Table 7-9. These values
will vary with a processor reboot (other than initial load), since they depend on the previous
values.
Table 7-9. BDMA Registers before and after Initial Boot Loading
BMWAIT BDMA Port Wait States. Set to 7 0xF (M and N series 0xF (M and N series
waits per transfer. DSPs only) DSPs only)
0x7 (All other DSPs) 0x7 (All other DSPs)
Table 7-9. BDMA Registers before and after Initial Boot Loading (Cont’d)
1 Assumes MMAP=0 and BMODE=0 for a BDMA boot (applies to ADSP-2181 and
ADSP-2183 processors) or MODEA=0 and MODEB=0 for all other ADSP-218x processors).
2 Set to 1 to:
(a) Hold off instruction execution during BDMA transfer
(b) Start execution at address PM(0x0000) after BDMA transfer
(c) Leave a BDMA interrupt pending
This sequence of events occurs if BCR is set before BWCOUNT is written, or after the initial boot.
3 Applies only to the following processors: ADSP-2187L/N, ADSP-2188M/N, and
ADSP-2189M/N.
External Interrupts
ADSP-218x family processors have a number of prioritized, individually
maskable, external interrupts, which can be either level- or edge-triggered.
These interrupt request pins are named IRQ0, IRQ1, and IRQ2. The IRQ0
and IRQ1 pins are only available as the (optional) alternate configuration of
SPORT1. The configuration of SPORT1 as either a serial port or as inter-
rupts (and flags) is determined by bit 10 of the processor’s system control
register.
The ADSP-218x processors also have two dedicated level-triggered inter-
rupt request pins and one dedicated edge-triggered interrupt request pin;
these are IRQL0, IRQL1, and IRQE, respectively.
Internal interrupts, including serial port, timer, and DMA, are discussed
in other chapters. Additional information about interrupt masking, set up,
and operation can be found in Chapter 3, Program Sequencer.
Interrupt Sensitivity
Individual external interrupts can be configured in the ICNTL register as
either level-sensitive or edge-sensitive.
Level-sensitive interrupts operate by asserting the interrupt request line
(IRQx) until the request is recognized by the processor. Once recognized,
the request must be deasserted before unmasking the interrupt so that the
DSP does not continually respond to the interrupt.
In contrast, edge-triggered interrupt requests are latched when any
high-to-low transition occurs on the interrupt line. The processor latches
the interrupt so that the request line may be held at any level for an arbi-
trarily long period between interrupts. This latch is automatically cleared
when the interrupt is serviced. Edge-triggered interrupts require less exter-
nal hardware than level-sensitive requests since there is never a need to
hold or negate the request. With level-sensitive interrupts, however, many
interrupting devices can share a single request input; this allows easy sys-
tem expansion.
An interrupt request will be serviced if it is not masked (in the IMASK regis-
ter) and a higher priority request is not pending. Valid requests initiate an
interrupt servicing sequence that vectors the processor to the appropriate
interrupt vector address. See Chapter 3, “Program Sequencer” for the
ADSP-218x processor interrupt vector addresses. There is a synchroniza-
tion delay associated with both external interrupt request lines and
internal interrupts.
If an interrupt occurs during a waitstated external memory access or dur-
ing the extra cycles required to execute an instruction that accesses
external memory more than once, it is not recognized between the cycles,
only before or after. Edge-sensitive interrupts are latched, but not ser-
viced, during bus grant (BG) unless the Go mode is enabled.
Flag Pins
All ADSP-218x processors provide flag pins. The alternate configuration
of SPORT1 includes a Flag In (FI) pin and a Flag Out (FO) pin. The con-
figuration of SPORT1 as either a serial port or as flags and interrupts is
selected by bit 10 of the processor’s System Control register.
The FI pin can be used to control program branching, using the IF
FLAG_IN and IF NOT FLAG_IN conditions of the JUMP and CALL instructions.
These conditions are evaluated based on the last state of the FI pin;
FLAG_IN is true if FI was last sampled as a 1 and false if last sampled as a 0.
FO can be used as a general purpose external signal. The state of FO is also
available as a read-only bit of the SPORT1 control register.
The ADSP-218x processors have three additional flag output pins: FL0,
FL1, and FL2. These flags (and FO) can be controlled in software to signal
events or conditions to any external device such as a host processor. The
Modify Flag Out instruction, which is conditional, can perform SET,
RESET and TOGGLE actions — this instruction allows programs executing on
the DSP processor to control the state of its flag output pins. Note that if
the condition in the Modify Flag Out instruction is CE (counter expired),
the counter is not decremented as in other IF CE instructions.
Flag outputs FL0, FL1 and FL2 are set to 1 at RESET. The Flag Out (F0) is
not affected by RESET.
The ADSP-218x processors have eight additional general-purpose flag
pins, PF7–0. These flags can be programmed as either inputs or outputs;
they default to inputs following reset. The PFx pins are programmed with
the use of two memory-mapped registers. The Programmable Flag register
(shown in Figure 7-4) determines the flag direction: 1=output and
0=input. The Programmable Flag Data register (shown in Figure 7-5) is
used to read and write the values on the pins.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 D M (0x3FE 6)
P FT YP E
1 = o utp ut
0 = in pu t
Program m ab le Flag D a ta
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
D M (0x3F E 5)
P FD AT A
Powerup Issues
The ADSP-218x dual-voltage M and N series processors have special
issues related to powerup. These issues include the powerup sequence and
the dual-voltage power supplies. This section discusses both these issues. it
also gives information about reset generators, which provide a reliable
active reset once the power supplies and internal clock circuits have
stabilized.
Powerup Sequence
The following recommendations should be observed when powering
dual-voltage DSP’s. Ideally the two supplies, VDDEXT and VDDINT, should be
powered up together. If they cannot be powered up together, the internal
(core) supply should be powered up first. Powering up the core supply
first reduces the risk of latchup events.
VDDEXT VDDINT
(2.5-3.3V) (2.5V)
IO PIN INPUT
INTERNAL LOGIC
OUTPUT
If an external master clock is used, it should not be driving the CLKIN pin
when the DSP is unpowered. The clock must be driven immediately after
powerup; otherwise, internal gates stay in an undefined (hot) state and can
draw excess current. After powerup, there should be sufficient time for the
internal PLL to stabilize (2000 clock cycles) before the reset is released.
In addition, time should be allowed for the oscillator to start up and reach
full amplitude. This may take 100 ms, depending upon choice of crystal,
operating frequency, loop gain, and capacitor ratios. Startup time may be
more significant than the 2000 clock cycles needed for the PLL to
stabilize.
Power Supplies
The following lists the power supplies that ADSP-218x processors can use:
• ADSP-218x L series processors use a single 3.3 V power supply
• ADSP-218x M series processors can use either a single 2.5 V power
supply or a 2.5 V internal power supply and a 3.3 V power supply
for I/O
• ADSP-218x N series processors can use either a single 1.8 V power
supply or a 1.8 V internal power supply and either a 2.5 V or a 3.3 V
power supply for I/O
A D P 33 3 0A R T- 3.3
2 1 10 µ F
V IN V IN VOUT +3.3V D D E X T
10 µ F (107m A M A X )
3 5
ERR NR
20K
6 4
SD GND
REGERR
A D P 33 3 0A R T- 2.5
2 1
V IN VOUT +2.5V D D IN T
10 µ F (70m A M A X )
3 5
ERR NR
10 µ F
6 4
SHTDW N SD GND
Figure 7-7. Suggested Dual Power Supply for ADSP-218x M Series DSPs
Reset Generators
It is important that a DSP (or programmable device) have a reliable active
RESET that is released once the power supplies and internal clock circuits
have stabilized. The RESET signal should not only offer a suitable delay,
but it should also have a clean monotonic edge. Analog Devices has a
range of microprocessor supervisory ICs with different features. Features
include one or more of the following:
• Powerup reset
• Optional manual reset input
• Power low monitor
• Back-up battery switching
Part number series for Analog Devices’ supervisory circuits are as follows:
• ADM69x
• ADM70x
• ADM80x
• ADM1232
• ADM181x
• ADM869x
+2.5V
D D INT
+3.3V
D DE X T
1 0µ F
V V V
CC D DE X T D D INT
AD M 80 9- RA RT AD S P-2 18 X-M
R ES E T R ES E T
GND GND
VDDEXT +3.3V
VSENSE 10µF
100nF
VDDEXT
100nF
ADSP-218x-M
RESET
2 7
VCC RST
ADM706TAR IRQ2
4 5
Vt=+1.25V PFI PFO
1 8 IRQL1
MR WDO
6 3 FL0
WDI GND
GND
RESET
Powerdown
The ADSP-218x processors provide a powerdown feature that allows the
processor to enter a very low power dormant state through hardware or
software control. In this CMOS standby state, power consumption is less
than 1 mW (approximate). (Refer to the processor data sheet for exact
power consumption specifications.)
The powerdown feature is useful for applications where power conserva-
tion is necessary, for example in battery-powered operation. Features of
powerdown include:
• Internal clocks are disabled
• Processor registers and memory contents are maintained
• Ability to recover from powerdown in less than 100-400 CLKIN
cycles (the number of cycles depends on the processor used in your
system design; see the appropriate data sheet for information)
• Ability to disable internal oscillator when using crystal
• No need to shut down clock for lowest power when using external
oscillator
• Interrupt support for executing “housekeeping” code before enter-
ing powerdown and after recovering from powerdown
• User selectable powerup context
Even though the processor is put into the powerdown mode, the lowest
level of power consumption still might not be achieved if certain guide-
lines are not followed. Lowest possible power consumption requires no
additional current flow through processor output pins and no switching
activity on active input pins. Therefore, a careful analysis of pin loading in
your circuit is required. The following sections detail the proper power-
down procedure as well as provide guidelines for clock and output pin
connections required for optimum low-power performance.
Powerdown Control
You can control several parameters of powerdown operation through con-
trol bits in the SPORT1 Autobuffer/Powerdown Control Register
This control register is memory-mapped at location 0x3FEF and is shown
in Figure 7-10.
DM(0x3FEF)
XTALDIS
XTAL Pin Drive Disable During Powerdown
1=disabled, 0=enabled
(XTAL pin should be disabled when
no external crystal is connected)
XTALDELAY
Delay Startup From Powerdown 4096 Cycles
1=delay, 0=no delay
(Use delay to allow internal phase locked
loop or external oscillator to stabilize)
PDFORCE
Powerdown Force
1=force processor to vector to
powerdown interrupt
PUCR
Powerup Context Reset
1=soft reset (clear context)*,
0=resume execution
Entering Powerdown
The powerdown sequence is defined as follows.
1. Initiate the powerdown sequence by applying a high-to-low transi-
tion to the PWD pin or by setting the powerdown force control bit
(PDFORCE) in the SPORT1 Autobuffer/Powerdown Control Regis-
ter (followed by a NOP instruction).
2. The processor vectors to the non-maskable powerdown interrupt
vector at address 0x002C. (Note: The powerdown interrupt is
never masked. You must be careful not to cause multiple power-
down interrupts to occur or stack overflow may result. Multiple
powerdown interrupts can occur if the PWD input is pulsed while the
processor is already servicing the powerdown interrupt.)
3. Any number of housekeeping instructions, starting at location
0x002C, can be executed prior to the processor entering the power-
down mode. Typically, this section of code is used to configure the
powerdown state, disable on-chip peripherals and clear pending
interrupts.
4. The processor now enters powerdown mode when it executes an
IDLE instruction (while PWD is asserted). The processor may take
either one or two cycles to power down depending upon internal
clock states during the execution of the IDLE instruction. All regis-
ter and memory contents are maintained while in powerdown.
Also, all active outputs are held in whatever state they are in before
going into powerdown.
If an RTI is executed before the IDLE instruction, then the processor
returns from the powerdown interrupt and the powerdown sequence is
aborted.
Exiting Powerdown
The powerdown mode can be exited with the use of the PWD pin or with
RESET. There are also several user-selectable modes for start-up from pow-
erdown which specify a start-up delay as well as specify the program flow
after start-up. This allows the program to resume from where it left off
before powerdown or for the program context to be cleared.
If the PUCR control bit is cleared to 0, the processor will continue to exe-
cute instructions following the IDLE instruction. For example, a
high-to-low transition is applied to the pin, which causes the processor to
vector to the powerdown interrupt routine. In this routine, a few house-
keeping tasks are performed and the IDLE instruction is executed. The
processor powers down. Some time later a low-to-high transition is
applied to the pin, causing the processor to exit powerdown mode. Since
the PUCR bit is 0, the processor resumes executing instructions in the pow-
erdown interrupt routine, starting at the instruction following the IDLE
instruction. When an RTI instruction is encountered, control then passes
back to the main routine.
If the PUCR bit is set to 1 for a clear context, the processor resumes opera-
tion from powerdown by clearing the PC, STATUS, LOOP and CNTR stacks.
The IMASK and ASTAT registers are set to 0 and the SSTAT goes to 0x55. The
processor will start executing instructions from address 0x0000.
If the external clock is unstable when the processor exits powerdown, then
the XTALDELAY control bit can be used. This allows time for the external
clock to stabilize by inserting an additional 4096-cycle delay before the
processor starts to execute instructions. The start-up delay can only be
used when the processor is taken out of powerdown mode with the PWD
pin.
If the processor is taken out of powerdown by RESET and the clock is stable
and at the same frequency as before powerdown, RESET needs to be held
for only 5 cycles.
If the lowest possible power consumption is required, then you must set
the XTALDELAY and XTALDIS bits to 1 before entering powerdown. This set-
ting does the following:
• Selects the additional 4096 cycle delay to allow the oscillator to start
and the phase locked loop to lock after start-up.
• Disables the drive to the XTAL pin during powerdown.
The following code example shows the powerdown interrupt routine.
\* Sample Powerdown Code */
\* Located at interrupt vector address 0x002C */
pwd_int: ax0 = 0xC000; \* disable crystal, delay */
dm(0x3FEF) = ax0;
idle;
rti;
SPORTs
The circuitry of the serial ports is not directly affected by powerdown. The
SPORTs are indirectly affected if an internally generated SCLK or frame
sync is required. SPORT circuitry continues to operate during
powerdown.
It is possible to clock data into or out of the serial ports during power-
down. You must supply an external serial clock to support operation
during powerdown. No interrupts or autobuffer operations will be ser-
viced during powerdown. Instead, the SPORT interrupts are latched and
can be serviced if the processor exits powerdown without resetting the
processor. Data clocked into the processor will remain in the receive (RX)
registers. Autobuffer transfers will occur after the device exits powerdown
if the processor is not powered up with RESET. Note that any SPORT
activity will increase the power consumption above the 1 mW
specification.
If an external serial clock and an external frame sync signal are supplied,
data can be clocked into the RX register or out of the TX register during
powerdown. Since the TX register can not be updated while the processor
is in powerdown, the same value is repeatedly clocked out the serial port.
Also, data in the RX register is continually overwritten since the RX register
can not be read by the processor during powerdown.
If an external serial clock is used with an internal frame sync, frame sync
signals continue to be generated during powerdown since they are derived
from the serial clock. Data bits continue to be received with the RX register
being overwritten. Since data is only transmitted when the TX register is
written, data bits are only transferred out of the processor if the processor
is put in powerdown during a serial port transfer. While the processor is
being put into powerdown, the serial port transfer in progress is allowed to
complete. Since an internally generated transmit frame sync is used, no
subsequent frame syncs are generated while in powerdown.
If internal serial clock is used, there is no SPORT activity during power-
down; the serial clock stops.
Lowest power dissipation is achieved when active SPORT pins are not
changing during powerdown and are held at CMOS levels.
RESET I Active
PWD I Active
MMAP I Active
DATA<23:0> I Inactive
SCLK0 I Active
SCLK1 I Active
BMODE I Active
IS I Active
IACK O Active
PWDACK Pin
The powerdown acknowledge pin (PWDACK) is an output that indicates
when the processor is powered down. This pin is driven high by the pro-
cessor when it has powered down and is driven low when the processor has
completed its powerup sequence. A low level on the PWDACK pin also indi-
cates that there is a valid CLKOUT signal and that instruction execution has
begun. Figure 7-11 shows an example of timing for the powerdown and
restart sequence.
The processor is executing code when the PWD pin is brought low. The pro-
cessor vectors to the powerdown interrupt vector and an IDLE instruction
is executed causing the processor to go into powerdown. The CLKOUT and
PWDACK signals are driven high by the processor. At this point, the input
clock pin is ignored. If the processor is put into the powerdown mode via
the powerdown force bit in the powerdown control register, the result is
the same as described above.
The input clock is started and the PWD pin is brought high. After the neces-
sary start-up cycles the processor brings the PWDACK output low, begins
driving the CLKOUT pin with a clock signal and begins to fetch the instruc-
tion after the IDLE instruction. The processor then resumes normal
operation.
CLKIN
PWD
PWDACK
CLKOUT
RUN PWRDWN POWERED START CLK RUN
PENDING DOWN
EXECUTE FINISH IDLE
IDLE
NOP WHILE FETCHING INSTRUCTION FOLLOWING IDLE
Bus Request/Grant
This section describes the bus request and grant feature of the ADSP-218x
processors.
An ADSP-218x processors can relinquish control of data and address
buses to an external device. The external device requests the bus by assert-
ing (low) the bus request signal, BR. The BR signal is an asynchronous
input. If the ADSP-218x processor is not performing an external access, it
responds to the active BR input in the following processor cycle by:
1. Tristating the data and address buses and the xMS, RD, WR output
drivers,
2. Asserting the bus grant (BG) signal, and
3. Halting program execution (unless Go mode is enabled).
If Go mode is enabled, the ADSP-218x processor continues to execute
instructions from its internal memory. It will not halt program execution
until it encounters an instruction that requires an external access. (An
external access may be either a memory device access or a memory overlay
access, BDMA access, or I/O space access.)
CLKOUT
BR
BG
PMS
DMS
BMS
BR
BG
PMS
DMS
BMS
! Beprobesureonto
to allow enough room in your system to fit the EZ-ICE
the 14-pin connector.
1 2
GN D BG
3 4
EB G BR
5 6
EB R EINT
7 8
KE Y (NO P IN) X ELIN
9 10
ELO UT EC LK
11 12
EE EM S
13 14
RE SET ER ESE T
TO P V IEW
The 14-pin, 2-row pin strip header is keyed at the Pin 7 location—you
must remove Pin 7 from the header. The pins must be 0.025 inches square
and at least 0.20 inches in length. Pin spacing should be 0.1 x 0.1 inches.
The pin strip header must have at least a 0.15 inch clearance on all sides to
accept the EZ-ICE probe plug.
! Pin strip headers are available from vendors such as 3M, McKenzie
(Framatome Connectors International), and Samtec, Inc.
The ICE-Port interface consists of the following ADSP-218x processor
pins: EBR, EINT, EE, EBG, ECLK, ERESET, ELIN, EMS, and ELOUT. These
ADSP-218x processor pins must be connected only to the EZ-ICE con-
nector in the target system. These pins have no function, other than
during emulation, and do not require pull-up or pull-down resistors. All
of the emulator signals become active once the Emulation Enable (EE) sig-
nal is driven high.
! The traces for these signals between the ADSP-218x processor and
the connector must be kept as short as possible — no longer than 3
inches.
The following pins are also used by the EZ-ICE: BR, BG, RESET, and GND.
The EZ-ICE uses the EE signal to take control of the ADSP-218x proces-
sor in the target system. This causes the processor to use its ERESET, EBR,
and EBG pins instead of the RESET, BR, and BG pins. The BG output is
tri-stated.
One method of ensuring that the values located on the Mode pins are
those desired is to construct a circuit like the one shown in Figure 7-14.
The circuit shown in this figure forces the value located on the Mode A pin
to a logic high, regardless of whether it is latched via the RESET or ERESET
pin. (To configure the Mode pin to a logic low, you could use a two-input
AND gate with the ERESET and RESET signals connected as inputs and the
output of the AND gate connected to the Mode pin. In this example, the
Mode pin would be driven to a logic low when either the RESET or the
ERESET signals go active low.)
ERESET
RESET
A D S P -2 1 8 X
1 k⍀
M O D E A /P F O
P R O G R A M M A B L E I/O
! When not using the emulator, the pin must be pulled high. If it
BR
is not pulled high, either a hold-off condition could occur, which
can halt the DSP from booting either via BDMA or IDMA, or pro-
gram execution could halt indefinitely. Typical behavior for this
problem would be no activity on the BMS signal, or the IACK signal
staying inactive (high) indefinitely.
Decoupling Capacitors
0.1 µF decoupling capacitors should be placed (as close to the DSP as pos-
sible) on all VDD pins connected to the same digital ground.
During clock and data transitions, when all signal pins switch simulta-
neously, decoupling capacitors provide a localized source DC voltage and
current for optimal operation of the DSP. Decoupling capacitors also
ensures that there is a low-impedance power source present in power
planes and circuit traces. They effectively remove high frequencies from
the signal trace while not affecting lower frequencies.
All other digital integrated circuit chips in your system should be decou-
pled to manufacturers recommendations.
Also, a 100 µF bypass capacitor can be placed at the rails of the power
supply coming into the target board to filter unwanted RF noise from the
power supply cable.
RESET Signal
Due to the high operating speeds of RC circuits, using them to delay the
deassertion of the RESET signal at powerup is not recommended for
ADSP-218x processor systems. During powerup, RESET must be held low
for a minimum of 2000 DSP CLKIN cycles to ensure proper phase-lock
loop of the internal processor clock. Achieving proper phase-lock loop
ensures that the CLKOUT signal phase-locks with the CLKIN signal.
A Schmitt Trigger (or some type of hysteresis circuitry) should be used on
the reset line to minimize “ringing” on the RESET signal or to allow for
mechanical debouncing of a push button or switch. A clean RESET signal
that is free from ringing or glitches guarantees proper DSP powerup and
initialization. Without a Schmitt Trigger, the RESET signal may oscillate or
ring before settling to a valid inactive (high) level. Ringing on the RESET
signal may cause the DSP to lock up, since the RESET signal may fall below
the VIH minimum voltage specification. When the signal falls below this
minimum, a faulty reset that does not meet the 2000 CLKIN cycle mini-
mum DSP specification can occur.
PCB Board
Whenever possible, target systems should consist of a multilayered PCB
board with a separate power and ground plane stacked in the middle layers
of the board. Wirewrapped boards are not generally recommended as they
are more susceptible to external noise and parasitic capacitance.
Other Considerations
When designing a target system, keep the following in mind:
• EZ-ICE emulation introduces an up to 15 pF load on the RESET and
BR signals. See the ADSP-218x Family Hardware Installation Guide
for more details.
• EZ-ICE emulation introduces an up to 15 pF load on the BG signal.
In some modes the EZ-ICE drives the BG signal. See the ADSP-218x
Family Hardware Installation Guide for more details.
Recommended Reading
The text High-Speed Digital Design: A Handbook of Black Magic is recom-
mended for further reading. This book is a technical reference that covers
the problems encountered in state-of-the-art, high-frequency digital cir-
cuit design, and is an excellent source of information and practical ideas.
Topics covered in the book include:
• High-Speed Properties of Logic Gates
• Measurement Techniques
• Transmission Lines
• Ground Planes & Layer Stacking
• Terminations
• Vias
• Power Systems
• Connectors
• Ribbon Cables
• Clock Distribution
• Clock Oscillators
Reference: Johnson & Graham, High-Speed Digital Design: A Handbook of
Black Magic, Prentice Hall, Inc., ISBN 0-13-395724-1
Overview
The ADSP-218x family of processors has a modified Harvard architecture
in which data memory stores data and program memory stores both
instructions and data. A program instruction or opcode can be fetched
from internal memory and executed. In the same clock cycle, two data ele-
ments can be accessed from internal memory: one from Data Memory and
the other from Program Memory.
Memory Buses
In each ADSP-218x family processor, memory is connected to the internal
functional units by four on-chip buses: the Data Memory Address (DMA)
bus, Data Memory Data (DMD) bus, Program Memory Address (PMA)
bus and Program Memory Data (PMD) bus. The internal PMA bus and
DMA bus are multiplexed into a single address bus that is extended
off-chip. Likewise, the internal PMD bus and DMD bus are multiplexed
into a single external data bus. The sixteen MSBs of the external data bus
are used as the DMD bus: external bus lines D23-8 are used for DMD15-0.
Memory Modes
The IDMA port is a separate port on the ADSP-2181 and ADSP-2183
processors and a configured port on all other ADSP-218x processors. For
all of the ADSP-218x family processors, except for the ADSP-2181 and
ADSP-2183, the external address and data pins are multiplexed with the
IDMA address/data bus and control signals. The functionality of these
multiplexed pins is determined at reset by external Mode pins. The value
of these Mode pins determine whether the 100-pin ADSP-218x processors
have access to the full 14-bit address bus and 24-bit data bus (Full Mem-
ory Mode) or if the processor has IDMA functionality (Host Memory
Mode) with a single address bit (A0) and a 16-bit data bus (D[23:8]).
The pin multiplexing design enables processors to use a smaller number of
pins, which results in a smaller package size. This reduced size helps save
board “real estate” in board size-critical applications. On the other hand,
this reduced size requires a more complex design in order to use both the
external address and data busses simultaneously with IDMA port
functionality.
Memory Interfaces
In the modified Harvard architecture used by ADSP-218x processors, Pro-
gram Memory stores both instructions and 24-bit or 16-bit data values;
Data Memory stores 16-bit data values only. The amount of on-chip
memory differs for each processor. Table 8-1 identifies the amount of
on-chip memory contained in each processor.
Figures 8-1 through 8-6 show the on-chip Program Memory and Data
Memory configurations and their address mappings for each of the
ADSP-218x family processors.
0x3FFF
32-Memory-Mapped
Control Registers
0x3FE0
PM Overlay 1,2 0x3FDF
(External PM) 4064 Reserved Words
0x3000
Internal PM Reserved
0x2FFF
Internal DM
0x2000
0x3FFF
32-Memory-Mapped
Control Registers
0x3FE0
PM Overlay 1,2
0x3FDF
(External PM)
Internal PM Reserved
Internal DM
0x2000
0x1FFF
DM Overlay 1,2
Internal PM (External DM)
Internal DM Reserved
0x0000
0x3FFF
32-Memory-Mapped
Control Registers
0x3FE0
PM Overlay 0,4,5
0x3FDF
(Internal PM)
PM Overlay 1,2
Internal DM
(External PM)
0x2000
0x1FFF
DM Overlay 0,4,5
Internal PM (Internal DM)
DM Overlay 1,2
(External DM
0x0000
0x3FFF 32-Memory-Mapped
Control Registers
0x3FE0
PM Overlay 0,4,5,6,7
0x3FDF
(Internal PM)
PM Overlay 1,2
(External PM) Internal DM
0x2000
0x1FFF
DM Overlay 0,4,5,6,7,8
Internal PM (Internal DM)
DM Overlay 1,2
(External DM)
0x0000
0x3FFF
32-Memory-Mapped
Control Registers
0x3FE0
PM Overlay 0,4,5
0x3FDF
(Internal PM)
PM Overlay 1,2
Internal DM
(External PM)
0x2000
0x1FFF
DM Overlay 0,4,5,6,7
Internal PM (Internal DM)
DM Overlay 1,2
(External DM)
0x0000
These memory maps show how the internal memory is configured for each
of the ADSP-218x family processors. Since the ADSP-2184 and
ADSP-2186 processors have less than 16 K words of Program Memory
and Data Memory, some of their internal memory locations are reserved
and should not be used in the Linker Description File (LDF) or accessed
at runtime in the executable program. Please note that all external mem-
ory locations map to Program Memory and Data Memory overlay pages 1
and 2.
The PWAIT field of the System Control register sets the number of wait
states for each access to external Program Memory overlays. The value of
the PWAIT bit field of the System Control register defaults to fifteen after
reset for all ADSP-218x M and N series processors. Bit 15 of the System
Control register for these ADSP-218x M and N series processors defaults
to 1, which assigns twice the value of the PWAIT bit field plus one (2N+1)
wait states. The PWAIT bit field defaults to seven after reset for all other
ADSP-218x processors.
For all ADSP-218x processors, Program Memory Overlay regions 1 and 2
correspond to external Program Memory overlay regions, each 8 K in
length. All other overlay regions are internal overlays, except for Overlay
region 3, which is reserved. External Program Memory overlays are
selected by using the Program Memory Overlay register (PMOVLAY). Only
one Program Memory overlay region can be active at a time; this restric-
tion applies to both internal and external Program Memory overlay
regions.
The on-chip Program Memory and internal and external Program Mem-
ory overlay regions can hold both instructions and data intermixed in any
combination. By assigning the memory architecture description in the
Linker Description File, a programmer can specify absolute address place-
ment for any code or data module, including code for the interrupt vector
table and reset vector. The reset vector is located at Program Memory
address 0x0000. In conjunction with the Linker Description File, the
ADSP-218x processor linker determines where to place relocatable code
and data segments.
All of the Program Memory overlay regions map from address location
PM(0x2000) to PM(0x3FFF). The value of the Program Memory Overlay
register (PMOVLAY), determines which overlay region is currently being
accessed and whether an internal or an external PM overlay region is being
accessed by the DSP core.
! from
ADSP-218x processors’ program sequencer operates independently
the register. The program sequencer only operates on
PMOVLAY
the absolute address of the current instruction it is executing. For
Program Memory, the overlay regions map to the address range
0x2000 – 0x3fff. Special care must be taken by the programmer to
ensure that the proper target address and overlay are accessed when
making jumps or calls in the program.
Also, the DAG registers operate independently of the PMOVLAY reg-
ister. Again, special care must be taken to ensure the proper target
Program Memory region is being accessed when performing register
indirect jump or call instructions or when performing serial port
autobuffering to Program Memory overlay regions.
For all ADSP-218x processors, Data Memory Overlay regions 1 and 2 cor-
respond to external Data Memory overlay regions, each 8 K in length. All
other overlay regions are internal overlays, except for Overlay 3, which is
reserved. External Data Memory overlays are selected by using the Data
Memory Overlay register (DMOVLAY). Only one Data Memory overlay
region can be active at a time; this restriction applies to both internal and
external Data Memory overlay regions.
When accessing external Data Memory overlay pages, the DMOVLAY register
controls or determines the value of the address pin A13. When the DMOVLAY
register equals 1, the value of A13 is 0. When the DMOVLAY register equals 2,
the value of address pin A13 is 1. Table 8-3 explains the operational behav-
ior of the DMOVLAY register and address pin A13 when using external Data
Memory overlay pages.
All of the Data Memory overlay regions map from address location
DM(0x0000) to DM(0x1FFF). The value of the Data Memory Overlay regis-
ter (DMOVLAY) determines which overlay region is currently being accessed
and whether an internal or an external DM overlay region is being
accessed by the DSP core.
Listing 8-1 provides example instructions that demonstrate how to use the
DMOVLAY register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 D M (0X3F F E )
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 DM (0x3FFE )
Bit 15 is u nused
and should be
set to 0.
Figure 8-8. Wait State Control Register (All ADSP-218x Processors except
M and N Series)
The Wait State Control register is divided into the following fields:
• IOWAIT0—This 3-bit field sets the number of wait states (0-7) for
accesses to I/O Memory addresses 0x000-0x1ff.
• IOWAIT1—This 3-bit field sets the number of wait states (0-7) for
accesses to I/O Memory addresses 0x200-0x3ff.
• IOWAIT2—This 3-bit field sets the number of wait states (0-7) for
accesses to I/O Memory addresses 0x300-0x4ff.
• IOWAIT3—This 3-bit field sets the number of wait states (0-7) for
accesses to I/O Memory addresses 0x400-0x5ff.
When set, this bit configures the external I/O memory accesses to a
“2N+1” wait state mode. This 2N+1 wait state mode also applies for
external Program Memory and Data Memory accesses via the DWAIT
field of the Wait State Control register and the PWAIT field of the
System Control register.
" Since I/O Memory space is a separate, dedicated memory space, the
address mapping for I/O Memory space is not included as informa-
tion in your Linker Description File. The only method of assigning
(and accessing) I/O Memory in your system is during runtime in
your assembly code. (I/O Memory space is not directly supported
by the C Runtime Environment.)
Because of this restriction, in order to guarantee proper system per-
formance, the programmer and system designer must take special
care to ensure that the correct address mapping is performed both
in hardware and in software.
Based on the value of the CMSSEL bit field (bits 11:8) in the Composite
Select Control register (see Figure 8-9), the ADSP-218x processor asserts
CMS when the corresponding memory select signal(s), PMS, DMS, BMS, and
IOMS, are asserted. The CMS signal can be enabled to become active for any
of these signals individually. By default after reset, the CMSSEL field is ini-
tialized to enable the CMS signal to become active for any PMS, DMS, or IOMS
memory access. (BMS is disabled.)
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 D M (0x3FE 6)
IO M BM DM PM
C M SS E L
1 = E na ble CM S
0 = Dis ab le C M S
Figure 8-10 and Figure 8-11 in the next sections provide two examples for
using the CMS signal in system designs.
A DS P-2 18X
RD OE
OE OE
WR WE
WE WE
CM S CS CS CS
A[0:13] A[0:13]
A[0:13]
D[8:15]
D[0 :7]
A[0:13]
In this example, the CMS signal is configured to trigger for both Program
Memory and Data Memory accesses (when the PMS or DMS signals are
active). The PMS signal is used as the upper order address line (A[14]) to
the SRAMs. When the DSP performs Program Memory accesses, the PMS
signal becomes active (low), causing the A14 address line of the SRAMs to
be driven low. When the DSP performs Data Memory accesses, the PMS
signal becomes inactive, causing the A14 address line of the SRAMs to be
driven high.
The main advantage of this implementation is that only three 32 K x 8-bit
SRAMs are required for this configuration. Normally, five 16 K x 8-bit
SRAMs are required to implement two pairs of 8 K overlay regions for
Program Memory and Data Memory. This implementation helps to save
on board “real estate” where board space is limited.
BMS Disable
For the following ADSP-218x models, there is a disable BMS control bit
(bit 3 of the System Control register) that allows the processor core to
enable or disable the BMS signal during Byte Memory accesses:
• ADSP-2184, ADSP-2184L and ADSP-2184N
• ADSP-2185L, ADSP-2185M, and ADSP-2185N
• ADSP-2186, ADSP-2186L, ADSP-2186M, and ADSP-2186N
• ADSP-2187L and ADSP-2187N
• ADSP-2188M and ADSP-2188N
• ADSP-2189M and ADSP-2189N
When BMS is disabled, it can be used with the CMS signal to allow the map-
ping of multiple memory devices to the Byte Memory space. Figure 8-11
provides an example of this use of the BMS and CMS signals.
A DS P -2 18X
E PR O M FL A SH o r SR A M
OE
RD OE
WR WE
CM S
BM S CS CS
A[0:22] A[0:22]
8
D[8:15] / D[0 :7] D[0 :7]
8
/
D[16 :23 ]
A[0:13]
Figure 8-11. Example Using CMS Signal to Chip Select FLASH or SRAM
Memory
Accessing Peripherals
The external bus in Host Memory Mode still remains available in a lim-
ited form. The processors’ address pins A[13:1] are changed to IAD[12:0]
when the Mode C pin is high. As a result, the chip cannot drive an address
externally. However, internally, the chip behaves as if external accesses are
occurring. The external bus behaves in the same way as an ADSP-2181 or
ADSP-2183 system where address bits A[13:1] and data bits D[7:0] are
ignored. The upper 16 bits of the data bus can still be used for external
data transfers, but only one address bit is available, A0.
Writes to Data Memory or I/O Memory space activate the appropriate
memory select(s), RD or WR, place data on D[23:8], and drive a single
address bit on A0. Program Memory reads and writes behave similarly but
have the added consideration of the PX register.
For Program Memory reads and writes, only the upper 16 bits will be
available externally. When 24-bit data is written to external Program
Memory, the upper 16 bits are driven out on data bus pins [23:16]. The
PX register still latches the lower eight bits of the program memory word,
but these bits are not driven externally. If a 24-bit read of external mem-
ory occurs, no external pins control the value of the PX register, and the PX
register is written with all 1s.
The missing address bits restrict using the external bus with a conven-
tional memory device, which has separated address and data buses. These
external transfers might be usable with shared address/data memory chips,
or they can be used for communication with an ASIC. The memory selects
will still be active, so each memory space is effectively collapsed into two
external addresses, address 0 and 1. Clever use of the CMS pin allows a user
to decode 8 external addresses of 16-bit words using A0, IOMS, DMS, PMS and
CMS. More addresses can also be provided by using the DSP’s Flag Out
pins as a memory select for a peripheral. Table 8-4 provides some possible
16-bit peripheral addresses for a total of 8 devices.
Memory Select A0 (0 or 1)
BDMA and IDMA timing and cycle stealing are the same as on the
ADSP-2181 and ADSP-2183 processors. BDMA with limited address bits
available still provides a flexible interface to the DSP. Without full address
bits, addressing memory will be more difficult. However, host or micro-
controller communication is possible because the order of the byte
sequence is known.
D23:0 24 I/O Data I/O Pins for Program, Data, Byte and I/O
spaces (8 MSBs are also used as Byte Memory
addresses) Note: For 16-bit accesses, use pins
23:8
D23:8 16 I/O Data I/O Pins for Program, Data Byte and I/O
spaces
IS 1 I IDMA Select
1 In Host Memory Mode, external peripheral addresses can be decoded using the A0, CMS, PMS,
DMS, and IOMS signals.
Overview
The ADSP-218x processors include the following DMA interfaces:
• Byte Memory Space and Byte Memory DMA (BDMA) — The
byte memory space can address up to 4M bytes. The BDMA inter-
face supports booting from and runtime access to inexpensive 8-bit
memories. The BDMA feature lets you define the number of mem-
ory locations the BDMA interface transfers to or from internal
memory in the background while the ADSP-218x DSP core contin-
ues processing in the foreground.
• Internal Direct Memory Access (IDMA) Port —This 16-bit wide
parallel port supports booting from and runtime access to host sys-
tems (for example, PC Bus Interface ASICs). The DMA feature of
this port lets you transfer data to/from internal memory in the back-
ground while continuing foreground processing.
These DMA transfers are accomplished internally by “cycle stealing,” in
the same way as serial port autobuffering. This means that the ADSP-218x
processor uses internal bus cycles to transfer the data to and from memory.
The stolen cycles only occur at instruction cycle boundaries — not
between cycles of a multiple-cycle instruction. See “DMA Cycle Stealing,
Hold Offs, and IACK Acknowledge” on page 9-47 for additional details.
BDMA Port
Byte memory provides access to an 8-bit wide memory space through the
BDMA port. The byte memory space provides access to 4 Mbytes of
memory by utilizing 8 data lines as additional address lines. This gives the
BDMA port an effective 22-bit address range. Figure 9-1 shows the
ADSP-218x processor interface to BDMA.
AD S P- 21 8X Byte M em ory
(4 M x8 )
BMS CS
RD OE
WR WE
8
D [16:23]
A [0:21]
A [0:13] 22
14
8
D [8:15] D [0:7]
!regions
To access the internal Program Memory and Data Memory Overlay
for the ADSP-2187L, ADSP-2188M, and ADSP-2189M
processors via BDMA, the BIAD register should be set to
0x2000-0x3fff for Program Memory Overlay regions and
0x0000-0x1fff for Data Memory Overlay regions.The
BDMA Overlay bit field (bits 7:4 of the BDMA Control register)
and the BTYPE field (bits 1:0 of the BDMA Control register) should
also be set for the appropriate overlay regions.
• The BEAD or BIAD registers should not be accessed during BDMA
transfers.
If, for example, you wanted to transfer one hundred 24-bit program mem-
ory words through the BDMA port, assuming five wait states and no hold
offs, the operation would take 1900 cycles. This is shown in the following
equation:
100 3 5 1 1 0
PM Bytes Added Cycle Cycle for Hold
Words per Word Wait States + for + +
Internal Offs
per Byte Transfer RD/WR
Hold offs for DMA transfers are defined in the section, “DMA Cycle
Stealing, Hold Offs, and IACK Acknowledge” on page 9-47.
The BDMA Internal Address register (BIAD) lets you set the 14-bit inter-
nal starting address for the BDMA transfer (see Figure 9-2). To access the
internal Program Memory and Data Memory Overlay regions for all the
ADSP-2187, ADSP-2188, and ADSP-2189 processors via BDMA, the
BIAD register should be set to 0x2000-0x3fff for Program Memory Overlay
regions and 0x0000-0x1fff for Data Memory Overlay regions. The BDMA
Overlay (BMOVLAY) field (bits 7:4 of the BDMA Control register) and the
BTYPE field (bits 1:0 of the BDMA Control register) should also be set for
the appropriate overlay regions.
B D M A In te rn al A d dress
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 D M (0x3F E 1)
B IA D
The BDMA External Address register (BEAD) lets you set the 14-bit exter-
nal memory starting address for a BDMA transfer (see Figure 9-3). This
register value represents the value of the address bits A[13:0], which are
driven on the external address bus to your byte-wide device.
B D M A E xternal A d dress
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 D M (0x3F E 2)
BEAD
! BDMA field
transfers that cross BDMA page boundaries update the
of the BDMA Control register automatically.
BMPAGE
BDMA Overlay bits (bits 7:4 of the BDMA Control register, shown in
Figure 9-4) apply only to the ADSP-2187, ADSP-2188, and ADSP-2189
processors. These bits must be set to zero for all other ADSP-218x proces-
sors (see Figure 9-5).
B D M A C ontrol
(AD S P-2 187 , A DS P -218 8, and A D SP -218 9)
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 D M (0x3F E 3)
B TY PE (S e e tab le)
B M PA G E
B M O VL A Y B DIR
0 = load from B M
1 = sto re to BM
B TY PE 00 01 10 11
B CR
Intern al M em o ry Sp ace PM DM DM DM
0 = run d urin g BD M A
W o rd Size 24 16 8 8 1 = halt d urin g BD M A ,
A lig nm en t F ull F ull M SB LS B C on text Reset w hen do ne
w ord w o rd
B D M A C ontrol
(All A D SP -2 18x P roces sors ex cep t A DS P-218 7, A DS P -21 88, and A DS P-2 189 )
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 D M (0x3F E 3)
B TY PE (S e e tab le)
B M PA G E
B DIR
0 = load from B M
1 = sto re to BM
B TY PE 00 01 10 11
B CR
Intern al M em o ry Sp ace PM DM DM DM
0 = run d urin g BD M A
W o rd Size 24 16 8 8 1 = halt d urin g BD M A ,
A lig nm en t F ull F ull M SB LS B C on text Reset w hen do ne
w ord w o rd
B D M A W o rd C o u n t
M M A P = 0 a n d B M O D E = 0 ( A D S P -2 1 8 1 a n d A D S P -2 1 8 3 o n ly )
M O D E B = 0 (A ll o t h e r A D S P -2 1 8 x p ro c e s s o r s )
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
D M (0 x 3 F E 4 )
0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
BW COUNT
or
M M A P = 1 o r B M O D E = 1 ( A D S P -2 1 8 1 a n d A D S P -2 1 8 3 o n ly )
M O D E B = 1 (A ll o t h e r A D S P -2 1 8 x p ro c e s s o r s )
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 D M (0 x 3 F E 4 )
BW COUNT
N o te : B its 1 4 a n d 1 5 a r e u n u s e d
a n d s h o u ld b e s e t t o 0 .
BMWAIT consists of bits 12, 13, and 14 of the Composite Select Control
register for all ADSP-218x processors except the M and N series (see
Figure 9-7). For the M and N series processors, this field consists of bits
12, 13, 14, and 15 of the Composite Select Control register (see
Figure 9-8). BMWAIT lets you select 0-7 wait states (each equal to a single
instruction cycle) to apply to each byte memory access. BMWAIT is set to 7
after a reboot.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 D M (0x3F E 6)
B M W A IT
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 D M (0x3F E 6)
B M W AIT
BDMA Booting
The ADSP-218x processor offers two methods for automatic booting after
reset: BDMA booting and IDMA booting. This section describes BDMA
booting. For information about IDMA booting, see “Boot Loading
through the IDMA Port” on page 9-46.
When using BDMA booting, the entire on-chip program memory of an
ADSP-218x processor, or any portion of it, can be loaded from an external
source using a byte memory booting sequence. Table 9-3 shows how to
select the post-reset booting method using the MMAP and BMODE pins on the
ADSP-2181 and ADSP-2183 processors. Table 9-4 on page 9-16 shows
how to select the post-reset booting method using the Mode D, Mode C,
Mode B, and Mode A pins on all other processors.
0 0 Boot through BDMA port. Boot sequence loads the first 32 pro-
gram memory words from the byte memory space. After all 32
words are loaded, program execution begins at internal address
PM(0x0000) with a BDMA interrupt pending.
Table 9-4. Booting Methods for All Processors Except the ADSP-2181 and
ADSP-2183 Processors
Table 9-4. Booting Methods for All Processors Except the ADSP-2181 and
ADSP-2183 Processors (Cont’d)
1 Mode D pin is not available on the ADSP-2184, ADSP-2184L, ADSP-2185, ADSP-2185L, AD-
SP-2186, or ADSP-2186L processors.
2 Considered as standard operating settings. Using these configurations allows for easier design and
better memory management.
The ADSP-218x processors use a BDMA boot sequence after reset when
the BMODE and MMAP pins equal 0 (ADSP-2181 and ADSP-2183 processors)
or the Mode B pin equals 0 (all other ADSP-218x processors).
The BDMA port is initialized for booting as follows:
• BWCOUNT is set to 32
• BDIR, BMPAGE, BEAD, BIAD, and BTYPE are set to zero
• BCR is set to 1
• BMWAIT is set to 15 for the ADSP-218x M and N series processors
and 7 for all other ADSP-218x processors
• is set to 0 for the ADSP-2187, ADSP-2188, and
BMOVLAY
ADSP-2189 processors
These initializations configure the BDMA port to load 32 Program Mem-
ory words (96 bytes) (as specified by the BWCOUNT register) from Byte
Memory Page zero (as specified in the BMPAGE field of the BDMA Control
Register) and Byte Memory Address zero (as specified in the BEAD regis-
ter) to internal Program Memory address zero (as specified in the BIAD
register), using 24-bit Program Memory Word Format (as specified in the
BTYPE field of the BDMA Control register).
When set to 1, the BDMA context reset bit (BCR) inhibits program execu-
tion during BDMA transfer and causes execution to begin at address
PM(0x0000) after the transfer is completed. For the ADSP-218x M and N
series processors, the number of wait states (BMWAIT bits [15:12] of the
Composite Select Control register) for BDMA accesses is set to the maxi-
mum of 15. For all other ADSP-218x processors, the number of wait
states (BMWAIT bits [14:12] of the Composite Select Control register) for
BDMA accesses is set to the maximum value of 7. After the boot sequence
is complete (32 words transferred), program execution begins at internal
PM address 0x0000.
The ADSP-218x PROM Splitter utility provides a boot loader option for
ADSP-218x processor-based designs. See “Development Software Features
for BDMA Booting” on page 9-20 for information.
If you are developing your own boot-loading software for ADSP-218x
processors, however, you should note that the BDMA Context Reset bit
(BCR) is set to 1 (inhibiting program execution during BDMA transfer)
and a BDMA interrupt is pending (signalling the first 32 word were sent)
after the boot sequence is complete. Your program will have to process the
interrupt (if you unmask the BDMA interrupt with the IMASK register) or
clear the interrupt (with the IFC register).
In an alternate method, using the BDMA interrupt without context clear,
a loader program could suspend program execution with the IDLE instruc-
tion while BDMA boot loading. If the loader sets the PM boot-load
parameters, the loader enables only the BDMA interrupt in the IMASK reg-
ister, and then executes an IDLE instruction. The IDLE instruction
suspends program execution until the BDMA interrupt occurs. At that
point all of program memory is loaded.
IDMA Port
The IDMA port is a separate port on the ADSP-2181 and ADSP-2183
processors and a configured port on all other ADSP-218x processors when
they are in Host Mode (Mode C pin equals 1). It is a 16-bit parallel slave
I/O port that allows the processor’s internal memory to be read or written
by a host system. Figure 9-9 shows the ADSP-218x interface to the IDMA
port.
IS M E M O RY S EL E C T
IA L I/O F LA G P IN
IRD RD
IW R WR
IAC K A C KN O W L ED G E
16
The IDMA port is a gateway to all internal memory locations on the DSP
(except for the processor’s memory-mapped control registers). The IDMA
port is made up of 16 multiplexed data/address pins and 5 control pins. It
provides transparent, direct access to the DSP’s on-chip program and data
RAM. IDMA port read/write access is completely asynchronous and a
host can access the DSP’s internal memory while the ADSP-218x proces-
sor is operating at full speed.
The IDMA port does not require any ADSP-218x processor intervention
to maintain data flow. The host system can access the ADSP-218x proces-
sor’s internal memory directly, without going through a set of mailbox
registers. Direct access to DSP memory increases throughput for block
data transfers. Through the IDMA port, internal memory accesses can be
performed with an overhead of one DSP processor cycle per word.
The ADSP-218x processor supports boot loading through the IDMA
port, through the BDMA port, or from an external Program Memory
Overlay. The MMAP and BMODE pins (ADSP-2181 and ADSP-2183 proces-
sors) or Mode B pin (all other processors) select the DSP’s boot mode and
memory map. Setting BMODE=1 and MMAP=0 (ADSP-2181 and ADSP-2183
processors) or Mode A=1 and Mode C=1 (all other ADSP-218x processors)
directs the ADSP-218x to boot through the IDMA port. For information
on IDMA booting, see “Boot Loading through the IDMA Port” on
page 9-46.
1 After reset, IACK is asserted (low). It stays low until an IDMA transfer is ini-
tiated. After each IDMA operation is completed, IACK is again low.
Four input signals control the IDMA port. Table 9-6 identifies and
describes these signals.
Table 9-6. IDMA Port Input Signals
IDMA Port Select (IS) This signal acts as a chip select for all IDMA operations.
IDMA Read (IRD) When both the IS and IRD signals are active (low), an IDMA
read cycle begins.
IDMA Write (IWR) When both the IS and IWR signals are active (low), an IDMA
write cycle begins.
IDMA Address Latch (IAL) When the host wishes to initiate an Address Latch Sequence, this
signal is asserted (active high). When the IS and IAL signals are
both active, an IDMA Address Latch Sequence begins. At this
point the host processor should drive the starting address of the
IDMA transfer on the IAD bus.
An IDMA access ends when any one of the input signals goes inactive
(high).
Asserting the IDMA Port Select (IS) and address latch enable (IAL) directs
the ADSP-218x processor to write the address on the IAD0-15 bus into
the IDMA Control register. This register, shown in Figure 9-10, is mem-
ory-mapped at address DM(0x3FE0). Note that the latched address
(IDMAA) cannot be read back by the host.
Because the IDMA Control register is a memory mapped register, the
address information can be written by either the host processor or the
DSP itself. This allows more flexibility in your system design.
ID M A C ontrol
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 U U U U U U U U U U U U U U U D M (0x3F E 0)
IDM A D
D estination m em o ry type:
0=P M IDM A A
1=D M S tarting add ress
Through the IDMAA register, the DSP can also specify the starting address
and data format for DMA operation. Asserting the IDMA port select ( IS)
and address latch enable (IAL) directs the DSP to write the address onto
the IAD0-14 bus into the IDMA Control register. The address value is
written on the bus by the host; then, the address information is written to
or latched into the IDMA Address register ( IDMAA). If bit 15 is set to 0,
IDMA latches the address. If bit 15 is set to 1, IDMA latches into the
OVLAY register.
ID M A O verlay
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 D M (0x3F E 7)
ID P M O V LA Y
ID D M OV LA Y
Asserting the IDMA Port Select (IS) and Read strobe (IRD) inputs directs
the ADSP-218x to output the contents of the memory location pointed to
by the IDMA Control register onto the IDMA data bus.
Asserting the IDMA Port Select ( IS) and Write strobe (IWR) inputs directs
the ADSP-218x to write the input from the IDMA data bus to the address
pointed to by the IDMA register.
When reading or writing to Data Memory, the IDMA data bus pins make
up a 16-bit Data Memory word. When reading or writing to Program
Memory, the upper 16 bits of the 24-bit Program Memory word are sent
first on the IDMA data bus pins. On the next IDMA port read or write,
the lowest 8 bits of the Program Memory word are sent on bits 0-7 of the
IDMA data bus. For reads, the ADSP-218x processor sets data bus lines
8-15 to 0; for writes, the ADSP-218x processor ignores bits 8-15 from the
host.
The IDMA Port Access Acknowledge (IACK) line identifies completion of
data read/write operations. It also acts as a busy signal for the IDMA port.
External devices must wait for this signal to go low before modifying the
IDMA Control register or starting the next read or write operation.
H o s t s ta r ts ID M A tr a n s fe r .
H o s t c h e c k s IA C K c o n tr o l lin e
to s e e if th e D S P is " b u s y " .
H o s t u s e s IS a n d IA L c o n tr o l lin e s to
la tc h th e D M A s ta r tin g a d d r e s s
(ID M A A ) a n d P M /D M s e l e c tio n in to
th e D S P 's I D M A C o n tr o l r e g is te r .
T h e D S P a ls o c a n s e t th e s ta r tin g
a d d r e s s a n d m e m o r y d e s tin a tio n .
H o s t u s e s IS a n d IR D (o r IW R ) to
r e a d (o r w r ite ) D S P in te r n a l m e m o r y
(P M o r D M ).
Yes H o s t c h e c k s IA C K lin e t o s e e if th e
D S P h a s c o m p le te d th e p r e v io u s
C o n tin u e ?
ID M A o p e r a t io n .
No
H o s t e n d s ID M A tr a n s fe r .
In the case shown in Figure 9-12, the host system starts an IDMA transfer
by checking the state of the IACK line to determine port status
(ready/busy). When the IDMA port is ready (when the IACK signal is low),
the host directs the ADSP-218x (with the IS and IAL lines) to latch the
IDMA internal memory address from the IDMA address/data bus to the
IDMA Control register. (Note that the latched address cannot be read
back by the host.)
Next, the host (using the IS and IRD or IS and IWR lines) begins reading
(or writing) the DSP’s internal memory until done. With each IDMA read
or write operation, the ADSP-218x automatically increments the IDMA
internal memory address. Note that the ADSP-218x continues program
execution throughout the IDMA transfer operation, except during the
“stolen” cycle used to do the memory access.
• Using the IDMA short read cycle (which does not wait for the
data-ready assertion of the IACK signal), you could set up a sin-
gle-location data buffer for IDMA read transfers. For information
on how this data buffer would work, see “Short Read Cycle” on
page 9-37.
• For ADSP-218x applications with a host processor or host ASIC
that does not use a data-ready or write-complete acknowledge, use
the IDMA short read/write cycles.
There are some restrictions on IDMA operations. These hardware/soft-
ware design restrictions include the following:
• If your design has both the host and ADSP-218x processors writing
to the IDMA Control register, do not let both write to this register
at the same time; the results of this are indeterminate.
• Host reads of internal Program Memory take two IDMA reads (for
a 24-bit word through a 16-bit port). If an IDMA address latch
cycle or an ADSP-218x processor write to the IDMA Control regis-
ter occurs after the first Program Memory read cycle, the IDMA
port “loses” the second half of the 24-bit Program Memory word.
The next IDMA read or write uses the address selected by the new
contents of the IDMA Control register. Note that writing to the
IDMA Control register after the first half of a Program Memory
IDMA read lets you read just 16-bit data from Program Memory.
• Host writes to internal Program Memory take two IDMA writes
(for a 24-bit word through a 16-bit port). If an IDMA address latch
cycle or a ADSP-218x write to the IDMA Control register occurs
after a first Program Memory write cycle, the IDMA port “loses” the
Program Memory word without changing the contents of memory.
The next IDMA read or write accesses the address selected by the
new contents of the IDMA Control register.
• Host memory accesses through the IDMA port that occur while the
ADSP-218x processor is in powerdown have some restrictions. See
Chapter 7, “System Interface” for information on powerdown
restrictions on IDMA port transfers.
#define NUM_REG 32
.section/dm Data_Memory;
.var temp_array[NUM_REG];
.section/pm Program_Code;
i0 = temp_array; /* i0 points to 1st location of
buffer */
l0 = 0; /* length of zero means
non-circular buffer */
i1 = 0x3fe0; /* i1 points to 1st memory mapped
control register */
l1 = 0; /* length of zero means
non-circular buffer */
m1= 1; /* modify DAG registers by one
after each access */
cntr = NUM_REG; /* counter equals number of
elements in buffer to be
swapped */
To have the host write to the memory-mapped control registers, you must
first load the values to a temporary buffer (through the IDMA port) and
then signal the ADSP-218x processor to transfer the contents of the tem-
porary buffer to the memory-mapped control registers. This transfer is
performed in a manner similar to that shown in Listing 9-1. You should
set up some form of signalling between the host and the ADSP-218x pro-
cessor: interrupts, flag I/O, or a mailbox register. This signalling provides
a mechanism for the host to tell the DSP when to perform an operation
and vice versa.
IDMA Timing
From the host system interface point of view, there are four IDMA port
operations with critical timing parameters. These operations are:
• Latching the IDMA internal memory address
• Latching the IDMA Overlay pages (ADSP-2187, ADSP-2188,
ADSP-2189 processors only)
• Reading from the IDMA port
• Writing to the IDMA port
The following sections cover the timing details for each of these
operations.
! The
ation.
IRD and IWR remain high (inactive) throughout the latch oper-
IAL
IS
IAD 15-0
A DD R E S S
" Both the ADSP-218x processor and the host can specify the starting
address by writing to the IDMA Control register. Do not let the
ADSP-218x processor access the IDMA Control register while it is
being written by the host; this operation will have an indeterminate
result.
! The
ation.
IRD and IWR remain high (inactive) throughout the latch oper-
4. Host detects the IACK line is now low and reads the data (Read
Data) from the IAD15-0 address/data bus. (Alternately, the host
can just wait a fixed worst case delay, which also guarantees the
IACK signal is low again. After reading the data, the host deasserts
IRD and IS.
IS
IRD
PREVIOUS READ
IAD15-0
DATA DATA
IDMA memory accesses “steal” one processor cycle, but they may only
occur on instruction cycle boundaries. The best-case response for a 16-bit
Data Memory read or the first 16 bits of a Program Memory read is 2.5
processor cycles; the worst case response is 3.5 cycles. One cycle is for syn-
chronization, one is for reading the memory internally, and one-half cycle
is for IACK setup time.
A second cycle of synchronization may be required. Thus the best-case
and worst-case response times are determined as follows:
Best Case: 1 cycle (sync) + 1 cycle (internal memory read) +
0.5 cycle (IACK setup) = 2.5 cycles
In the case of a Program Memory operation, the second IDMA port read
cycle for a given internal 24-bit word does not require an internal memory
access, does not wait for an instruction cycle boundary, and takes 1.5 or
2.5 cycles.
The best- and worst-case response times given above assume no system
hold offs. Hold offs for DMA transfers are defined in the section “DMA
Cycle Stealing, Hold Offs, and IACK Acknowledge” on page 9-47.
" IftheanIDMA
IDMA address latch cycle or an ADSP-218x processor write to
Control register occurs after a first Program Memory
read cycle (16 bits), the IDMA port will lose the second half of the
Program Memory word. The ADSP-218x processor treats the next
IDMA access as the first operation for the new IDMA address and
destination.
D a ta is la tc h e d h e re .
IA C K
IS
t IR D H 1 o r t IR D H 2
IR D
P R E V IO U S
IA D 1 5 -0
DATA
If th e IS o r IR D s ig n a ls a re
h e ld a s s e rte d p a s t th is p o in t,
t I IR P
th e d a ta c h a n g e s to th e n e x t
R e a d D a ta .
! latched
The host ignores the falling edge of the signal, since the data is
IACK
by the host on the rising edge of the or ISsignal not on
IRD
the falling edge of the IACK signal.
The host must perform an initial “dummy read,” since the first short read
access reads in the Read Data from the IAD bus. The next short read
access reads in the first correct data word, Previous Data, on the IAD bus.
The advantage of using short read accesses versus long read accesses is that
short reads allow for shorter block transfer times.
! operation.
is low (inactive) and
IAL IWR is high (inactive) throughout the read
The IDMA short read and long read cycles provide different alternatives
for implementing your DMA transfers. Short reads are useful for hosts
that can handle the faster timing of these accesses, while long reads allow
slower hosts more time.
The IDMA short read cycle also serves as a single-location data buffer. If
you are using the ADSP-218x processor in a multiprocessing environ-
ment, using this buffer is one way to avoid tying up the IAD bus (waiting
for the IACK signal).
" IftheanIDMA
IDMA address latch cycle or a ADSP-218x processor write to
Control register occurs after a first Program Memory
read cycle, the IDMA port will lose the second half of the Program
Memory word. The ADSP-218x processor treats the next host data
on the IAD address/data bus as the new contents of the IDMA Con-
trol register.
IAC K
IS
IRD
IAD 15-0 P R EV IO US
D AT A
Figure 9-17. IDMA Short Read Cycle in Short Read Only Mode Timing
The Short Read Only mode can be enabled or disabled by setting or clear-
ing bit 14 in the IDMA Overlay register. The default value for this bit (as
well as the remaining bits in this control register) are shown in
Figure 9-18.
ID M A O verlay
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 D M (0x3F E 7)
R eserve d R eserve d ID D M O V LA Y
S et to 0 S et to 0
The host writes the contents of an internal memory location using the
IDMA long write cycle. The write cycle, shown in Figure 9-19, consists of
the following steps:
1. Host ensures that IACK line is low.
2. Host asserts IWR and IS (low), directing the ADSP-218x processor
to write the data on the IAD15-0 address/data bus to the location
pointed to by the target IDMA address.
3. ADSP-218x processor deasserts the IACK line, indicating it recog-
nizes the IDMA write operation.
4. Host drives the data on the IAD address/data bus.
5. ADSP-218x processor asserts IACK line, indicating it latched the
data on the IAD15-0 address/data bus.
6. Host recognizes the IACK line is now low, stops driving the data on
the IDMA address/data bus and deasserts IWR and IS (ending the
IDMA long write cycle).
Note that IAL is low (inactive) and IRD is high (inactive) throughout the
write operation.
H o st sto p s d rivin g
d ata h ere.
IA C K
IS
IR D
IA D 15-0
DATA
" Host IDMA write accesses to internal Program Memory take two
IDMA port writes (24-bit word through a 16-bit port). If an IDMA
address latch cycle or a ADSP-218x processor write to the IDMA
Control register occurs after a first program memory write cycle, the
IDMA port “loses” the Program Memory word without changing
the contents of ADSP-218x processor internal memory. The next
IDMA read or write uses the address selected by the new contents
of the IDMA Control register.
7. Host stops driving the data on the IAD15-0 address/data bus after
meeting the short write timing requirements. (See the tIRP timing
specification in the subsection entitled “IDMA Read, Short Write
Cycle” in the “Timing Parameters” section of the appropriate data
sheet.)
! operation.
is low (inactive) and
IAL IRD is high (inactive) throughout the write
IACK
IS
IRD
IAD15-0
DATA
IDMA port writes to Program Memory require two IDMA port write
cycles to write a word to ADSP-218x processor internal Program Memory.
The ADSP-218x processor acknowledges the IDMA port write of the first
16 bits (MSBs of PM word) as they are written to a temporary holding
latch.Writes to this holding latch are not done on an instruction cycle
boundary. The ADSP-218x processor does not assert the IACK line (low)
after the second Program Memory write (or all Data Memory writes) until
the internal memory write is complete (performed on an instruction cycle
boundary) and the IDMA port is ready for another transaction.
" IftheanIDMA
IDMA address latch cycle or a ADSP-218x processor write to
Control register occur after a first Program Memory
write cycle, the IDMA port will lose the first half of the Program
Memory word. The next Program Memory write will be considered
the first half of a Program Memory write pair.
There are two features that differentiate the IDMA port long write from
the IDMA short write. The long write supports hosts (processors or
ASICs) that allow a data-written acknowledge. If your host needs the
ADSP-218x processor to signal that it has written the data, use the IDMA
long read cycle.
The short write lets your host hold data on the bus just until it is latched
and then releases the bus. If you are using the ADSP-218x processor in a
multiprocessing environment, using the short write is one way to avoid
tying up the IAD15-0 data bus (waiting for the IACK signal). Short writes
are also useful for hosts that can handle the short write timing but cannot
extend the accesses with the IACK signal (when hold offs occur).
"proper
Make certain to load all of the necessary memory locations with the
data before writing to PM 0x0000. When configured for an
IDMA boot, the DSP core executes an IDLE instruction until PM
0x0000 is written to by the host via the IDMA port. Writing to this
PM location forces the DSP to begin program execution from
PM 0x0000.
Priority Chain
The ADSP-218x processor priority chain for concurrent requests occur-
ring at instruction cycle boundaries is as follows:
1. Completion of an external memory access
2. IDMA internal memory transfers
3. BDMA internal memory transfers
4. SPORT autobuffer operations
5. Emulator interrupt
6. Emulator instruction
7. Powerdown interrupt
8. Unmasked interrupt
9. Normal instruction execution
Using the IACK signal simplifies your system design by allowing you to
ignore hold-off conditions. If you always wait for IACK to assert before
accessing the IDMA port, the DMA transfers will always operate properly.
You can ignore IACK, however, if you are sure that no hold-offs occur in
your system or if your IDMA accesses are longer than any hold-offs. To be
sure of this, you must carefully analyze all possible hold-off conditions of
your system.
Overview
This chapter contains two major sections: Interfacing to DSP Processors and
Interfacing Examples. The Interfacing to DSP Processors section provides
detailed information about interfacing ADSP-218x family processors to
analog-to digital converters (ADCs), digital-to-analog converters (DACs)
and coder/decoders (codecs). The Interfacing Examples section provides
some simple examples of interfacing ADSP-218x family processors to
ADCs, DACs, and codecs.
M EMO R Y S A M P LIN G
A 0-A 11 C O N V E R T S TA R T
ADDRES S BUS C LO C K
4 5
IN P U T /O U T P U T
ADDRE SS
M E M O R Y S E LE C T IO M S C H IP S E LE C T
DECODE
PROCESSO R 2
IN TE R R U P T
IR Q C O N V E R S IO N
REQUES T
C O M P LE TE
8
6
M EMO RY READ RD O U TP U T E N A B LE
7
M E M O R Y D A TA
BUS D 8-D 23 O U TP U T D A T A
Figure 10-2 shows the timing diagram for the ADSP-218x read-cycle.
DSP
CLKO UT
A0-A11
IO M S
RD
t AS R t RDA
t CRD tRP t RW R
D8-D23
t AA t RDH
t RDD
The following list provides the key requirements for a parallel peripheral
device read interface. Values are given for the ADSP-2189M DSP operat-
ing at 75 MHz.
• Peripheral device data outputs must be three-state compatible
• Address decode delay plus peripheral chip select setup time must be
less than address and memory select setup time tASR (0.325 ns min-
imum for an ADSP-2189M DSP)
• For zero wait-state access, the time from a negative-going edge of
read signal (RD) to output data valid must be less than tRDD (1.65 ns
maximum for an ADSP-2189M DSP operating at 75 MHz). Oth-
erwise, software wait states must be added or processor clock fre-
quency reduced.
• Output data from the peripheral must remain valid for tRDH from
the rising edge of read signal (RD) (0 ns for the ADSP-2189M)
• The peripheral device must accept minimum output enable pulse
width of tRP (3.65 ns for ADSP-2189M operating at 75 MHz).
Otherwise, software wait states must be added or processor clock
frequency reduced.
The DSP tRDD specification determines the peripheral device data access
time requirement. In the case of the ADSP-2189M, tRDD = 1.65 ns mini-
mum at 75 MHz. If the access time of the peripheral is greater than this,
wait states must be added or the processor speed reduced. This is a rela-
tively common situation when interfacing external memory or ADCs to
fast DSPs.
• tRDD = Read Low to Data Valid = 0.5 tCK – 5 ns + # wait states x tCK
maximum
• tRDH = Data Hold from Read High = 0 ns minimum
• tRP= Read Pulse Width = 0.5 tCK – 3ns + # wait states x tCK minimum
A VD D A G ND
A IN (+)
ADC D VD D
T/H
AD 7 854 /A D 785 4L
A IN (–)
2.5 V
R EF ER E NC E D G ND
COMP
R EF IN /
R EF O U T B UF
C HA R G E C LK IN
R ED IST R IB U TIO N
D AC S AR + A DC C O NV S T
C R EF 1
C O NT R OL
B US Y
C AL IBR A TIO N
M E M OR Y
C R EF 2
A ND C ON T RO LL E R
P AR A LL EL INT ER F AC E /C O N TR O L R EG IST E R
D B11-D B0 CS RD WR H BE N
The key interface timing specifications for the AD7854/AD7854L and the
ADSP-2189M are compared in Table 10-1. Specifications for the
ADSP-2189M are given for a clock frequency of 75 MHz.
tASR (Data Address Memory Select Setup Time t5 (CS to RD Setup Time) = 0 ns minimum
before RD Low) = 0.325 ns minimum (Must add Address Decode Time to this value)
tRDD (RD Low to Data Valid) = 1.65 ns + # t8 (Data Access Time after RD) = 50 ns maxi-
wait states x 13.3 ns minimum = 68.15 ns mum
minimum
1 Adding 5 wait states to the ADSP-2189M DSP increases tRP to 70.15 ns, which is greater than
t7 (70 ns) and meets the t8 (50 ns) requirement.
2 t9 maximum (40 ns) may cause bus contention if a write cycle immediately follows the read cycle.
A simplified interface diagram for the two devices is shown in Figure 10-4.
The conversion complete signal from the AD7854/AD7854L corresponds
to the BUSY output pin. Notice that the configuration allows the DSP to
write data to the AD7854/AD7854L parallel interface control register.
This is needed in order to set various options in the AD7854/AD7854L
and perform the calibration routines. In normal operation, however, data
is read from the AD7854/AD7854L as described above. Writing to exter-
nal parallel memory-mapped peripherals is discussed in the next section,
“Writing Data to Memory-Mapped DACs”,
S A M P L IN G
CONVST
C LO C K
DSP ADC
A D S P -2 1 8 9 M A D 7 8 5 4 /A D 7 8 5 4 L
75 M Hz DMS CS
(L O W = R E A D D B 1 1 -D B 0 )
A0 HBEN
IR Q BUSY
WR WR
RD RD
DATA
D 2 3 -D 8 D B 1 1 -D B 0
N o te s :
5 s o ftw a re w a it s ta te s
H B E N a n d W R re q u ire d fo r w ritin g to A D C
S a m p lin g c lo c k m a y c o m e fro m D S P
A DS P -218X D AC
2 1
MEMORY S AM P LIN G
A 0-A 11 D AC LA T CH
A DD R E S S B U S C LO C K
S TR O BE
3 5
INP U T/O U T P UT
A DD R E S S
M E M O RY SE LE C T IO M S C HIP S E LE CT
D EC O D E
P RO C E S S OR 1
INT ER R U P T
IRQ
R EQ U E S T
4 7
M E M O RY RE A D RD INP U T LA T C H
S TR O BE
6
M E M O RY D AT A
B US D 8-D 23 P AR A LL EL D AT A
INP U T
Figure 10-6 shows the memory-write cycle timing diagram for the
ADSP-21xx-family.
DSP
CLKOUT
A 0-A 11
IO M S
tW P
WR
tW R A
tA W tW W R
tA S W
tD H tD D R
tC W R
D 8-D 23
tW D E tD W
The write process is thus initiated by the peripheral device asserting the
DSP interrupt request line. This indicates that the peripheral device is
ready to accept a new parallel data word (step 1). The DSP then places the
address of the peripheral device on the address bus (step 2) and asserts a
memory select line (DMS is shown here) (step 3). This causes the output of
the address decoder to assert the chip select input to the peripheral
(step 5). The write (WR) output of the DSP is asserted tASW ns after the
negative-going edge of the DMS signal (step 4). The width of the WR pulse is
tWP ns. Data is placed on the data bus (D) and is valid tDW ns before the
WR line goes high (step 6). The positive-going transition of the WR line is
used to clock the data on the data bus (D) into the external parallel mem-
ory (step 7). The data on the data bus remains valid for tDH ns after the
positive-going edge of the WR signal.
The following is a list of key requirements for a parallel peripheral device
write interface. The key specification is tWP, the write pulse width.
• Address decode delay plus peripheral chip select setup time must be
less than the address and memory select setup time tASW (0.325 ns
for the ADSP-2189M processor operating at 75 MHz).
• For zero wait-state access, input data setup time must be less than
tDW (2.65 ns for the ADSP-2189M processor operating at 75 MHz).
Otherwise, software wait states must be added or processor clock
frequency reduced.
• Input data hold time must be less than tDH (2.325 ns for the
ADSP-2189M processor operating at 75 MHz).
• The peripheral device must accept input write clock pulse width tWP
(3.65 ns minimum for the ADSP-2189M processor operating at
75 MHz). Otherwise, software wait states must be added or proces-
sor clock frequency reduced.
! Allduebutto their
the fastest peripheral devices require wait states to be added
longer data access times.
The following equations show the key timing specifications for the
ADSP-2189M. Note that they are all related to the processor clock
frequency.
• tCK = Processor Clock Period (13.3 ns)
• tWP= WR Pulse Width = 0.5 tCK – 3ns + # wait states x tCK minimum
Another parallel device is the AD5340. It is a 12-bit 100 KSPS DAC with
a parallel data interface. It operates on a single +2.5 V to +5.5 V supply
and dissipates only 345 µW (+ 3V supply). A powerdown mode further
reduces the power to 0.24 µW.
The AD5340 incorporates an on-chip output buffer that can drive the
output to both supply rails. The AD5340 allows the choice of a buffered
or unbuffered reference input. The device has a poweron reset circuit that
ensures that the DAC output powers on at 0 V and remains there until
valid data is written to the device. Figure 10-7 shows a block diagram of
the AD5340.The input is double buffered.
V R EF
P O W ER O N
R ES E T
D B 11
BUF
12-BIT
BUF VO U T
G A IN DAC
CS
WR R ES E T
C LR
P O W ER D O W N
LO G IC
LD A C
PD GND
Table 10-2 compares the key interface timing specifications for the
ADSP-2189M DSP and the AD5340 DAC. Specifications for the
ADSP-2189M are given for a clock frequency of 75 MHz.
tASW (Address and Data Memory Select Setup t1 (CS to RD Setup Time) = 0 ns minimum
Time before WR Low) = 0.325 ns minimum
tWP (WR Pulse Width) = 3.65 ns + # wait states t3 (WR Pulse Width) = 20 ns minimum
x 13.3 ns minimum =30.25 ns minimum
tDW (Data Setup before WR High) = 2.65 ns + t4 (DataValid to WR Setup Time) = 5 ns maxi-
# wait states x 13.3 ns minimum = 29.25 ns mum
minimum
tDH (Data Hold after WR High) = 2.325 ns t5 (DataValid to WR Hold Time) = 4.5 ns
minimum minimum
Note: Adding 2 wait states to the ADSP-2189M DSP increases tWP to 30.25 ns and tDW to 29.25 ns,
which is greater than t3 (20 ns) and t4 (5 ns), respectively.
Examining the timing specifications shown in Table 10-2 reveals that for
the timing between the devices to be compatible, two software wait states
must be programmed into the ADSP-2189M processor. This increases the
width of WR to 30.25 ns, which is greater than the minimum required by
the AD5340 write pulse width (20 ns). The data setup time of 5 ns for the
AD5340 is also met by adding two wait states. A simplified interface dia-
gram for the two devices is shown in Figure 10-8.
S AM P LIN G
LD A C
C LO C K
DSP DAC
AD S P-2 18 9M AD 5 340
75 M H Z DMS CS
IRQ
WR
WR
D 8-D19 D B 0 -D B 11
N otes:
2 softw are w a it states
S am p lin g c lock m ay co m e from th e D SP
In order to understand serial data transfer better, we will first examine the
serial port operation of the ADSP-218x series. A block diagram of one of
the two serial ports (SPORTs) of the ADSP-218x is shown in Figure 10-9.
The transmit (TX) and receive (RX) registers are not memory mapped, but
they are identified by name in the ADSP-218x assembly language. For
SPORT0, the transmit and receive registers are named TX0 and RX0,
respectively. For SPORT1, these registers are named TX1 and RX1,
respectively.
DMD BUS
16
16 16
TX n C O M P A ND IN G RXn
TR A N SM IT D AT A H AR D W A R E R EC E IV E D AT A
R EG IST E R (µ-LA W O R A-L AW ) R EG IST E R
16 16
TR A N SM IT S HIFT S ER IA L R EC E IV E S HIF T
R EG IST E R C O NT RO L R EG IST E R
INT ER N AL
S ER IA L P olarity o f TF S and R FS
C LO C K is so ftw are p rog ram m ab le
G EN E RA TO R
DT TF S S CL K R FS DR
In the receiving portion of the serial port, the receive frame sync (RFS) sig-
nal initiates reception. The serial receive data (DR) from the external device
(ADC) is transferred into the receive shift register one bit at a time. The
negative-going edge of the serial clock (SCLK) is used to clock the serial
data from the external device into the receive shift register. When a com-
plete word has been received, it is written to the receive data register (RX),
and the receive interrupt for that serial port is generated. The receive data
register is then read by the processor.
Writing to the transmit data register (TX) readies the serial port for trans-
mission. The transmit frame sync (TFS) signal initiates transmission. The
value in the TX register is then written to the internal transmit shift regis-
ter. The data in the transmit shift register is sent to the peripheral device
(DAC) one bit at a time, and the positive-going edge of the serial clock
(SCLK) is used to clock the serial transmit data (DT) into the external
device. When the first bit has been transferred, the serial port generates
the transmit interrupt. The transmit data register can then be written with
new data, even though the transmission of the previous data is not
complete.
In the normal framing mode, the frame sync signal (RFS or TFS) is checked
at the falling edge of SCLK. If the framing signal is asserted, data is avail-
able (transmit mode) or latched (receive mode) on the next falling edge of
SCLK. The framing signal is not checked again until the word has been
transmitted or received.
In the alternate framing mode, the framing signal is asserted in the same
SCLK cycle as the first bit of a word. The data bits are latched on the falling
edge of SCLK, but the framing signal is checked only on the first bit. Inter-
nally-generated framing signals remain asserted for the length of the serial
word.
The serial ports of the ADSP-218x family are extremely versatile. The TFS,
RFS, or SCLK signals can be generated from the ADSP-218x clock (master
mode) or generated externally (slave mode). The polarity of these signals
can be reversed with software, thereby allowing more interface flexibility.
The port also contains µ-law and A-law companding hardware for voice-
band telecommunications applications.
A DC
S CL K
R FS IN
tS C S
tS C H tS C S
> 4 ns > 7 ns
MSB B IT n LS B
D R IN
The key timing specifications of concern are the serial data setup (tSCS)
and hold times (tSCH) with respect to the negative-going edge of the SCLK.
In the case of the ADSP-2189M, these values are 4 ns and 7 ns, respec-
tively. The latest generation ADCs with high speed serial clocks will have
no trouble meeting these specifications, even at the maximum serial data
transfer rate.
The AD7853/AD7853L is a 12 bit, 200/100 KSPS ADC which operates
on a single +3 V to +5.5 V supply and dissipates only 4.5 mW (+3 V sup-
ply, AD7853L). After each conversion, the device automatically powers
down to 25 µW. The AD7853/AD7853L is based on a successive approxi-
mation architecture and uses a charge redistribution (switched capacitor)
DAC. A calibration feature removes gain and offset errors.
Figure 10-11 shows a block diagram of the AD7853/AD7853L.
AV DD AGND AGND
AIN(+)
T/H DV DD
AD7853L
AIN(–)
2.5 V
REFERENCE DGND
COMP
REF IN /
BUF
REF OUT
CHARGE CLKIN
C REF1 REDISTRIBUTION
DAC CONVST
C REF2 SAR + ADC
CONTROL BUSY
CALIBRATION
CAL SLEEP
MEMORY
AND CONTROLLER
S YN C (O /P )
S CL K 1 16
5 6
(O /P )
330 ns M IN
TH R E E-S TA T E TH R E E-S TA T E
D B15 D B11 D B0
D O UT (O /P )
556 ns
226 ns
The AD7853/AD7853L ADCs have external mode pins, SM1 and SM2,
which configure the SYNC and SCLK signals as inputs or outputs. In the
examples shown in Figure 10-11 and Figure 10-12, the SYNC and SCLK sig-
nals are generated internally by the AD7853L.
The AD7853L serial clock operates at a maximum frequency of 1.8 MHz
(556 ns period). The data bits are valid 330 ns after the positive-going
edges of SCLK. This allows a setup time of approximately 330 ns minimum
before the negative-going edges of SCLK, which easily meets the
ADSP-2189M 4 ns tSCS requirement.
C LO C K
INP U T C LK IN
DSP 4 M H z/1.8 M H z M A X ADC
AD S P-2 18 9M AD 7 853 /A D 785 3L
75 M Hz S AM P LIN G
C LO C K C O NV ST
(O PT IO N A L)
S CL K S CL K
R FS S YN C
DR D O UT
S ER IAL
P OR T
V DD V RE F A
P O W E RO N
RE S E T AD 5 322
IN PU T DA C S T RIN G
V O UT A
RE G IS TE R A RE G IS TE R A DA C A
S Y NC
IN TE R FA C E LO G IC
RE S IS T O R
NE T W O RK
P O W E R-DO W N
S CL K
L O G IC
DIN
IN PU T DA C S T RIN G
V O UT B
RE G IS TE R B RE G IS TE R B DA C B
RE S IS T O R
NE T W O RK
L DA C G ND V RE F B
The references for the two DACs are derived from two reference pins (one
per DAC). The reference inputs may be configured as buffered or unbuf-
fered inputs. The outputs of both DACs may be updated simultaneously
using the asynchronous LDAC input. The device contains a poweron reset
circuit that ensures that the DAC outputs power up to 0 V and remain
there until a valid write to the device takes place.
Data is normally input to the AD5322 via the SCLK, DIN, and SYNC pins
from the serial port of the DSP. When the SYNC signal goes low, the input
shift register is enabled. Data is transferred into the AD5322 on the falling
edges of the following 16 clocks. Figure 10-15 shows a typical interface
between the ADSP-2189M and the AD5322.
DSP DAC
AD S P-2 18 9M AD 5 322
75 M Hz
S CL K S CL K
TF S S YN C
DT D IN
S ER IAL
P OR T
Notice that the clocks to the AD5322 are generated from the
ADSP-2189M clock. It is also possible to generate the SCLK and SYNC sig-
nals externally to the AD5322 and use them to drive the ADSP-2189M.
The serial interface of the AD5322 is not fast enough to handle the
ADSP-2189M maximum master clock frequency. However, the serial
interface clocks are programmable and can be set to generate the proper
timing for fast or slow DACs.
The input shift register in the AD5322 is 16 bits wide. This 16-bit word
consists of four control bits followed by 12 bits of DAC data. The first bit
loaded determines whether the data is for DAC A or DAC B. The second
bit determines if the reference input will be buffered or unbuffered. The
next two bits control the operating modes of the DAC (normal, power-
down with 1 kΩ to ground, powerdown with 100 kΩ to ground, or
powerdown with a high impedance output).
A VD D 1 A VD D 2 D VD D
V FB P 1
V IN P 1 S DI
Σ ∆ ADC
V IN N 1 C H AN N EL 1
V FB N 1 S DIF S
V O UT P1 S CL K
Σ ∆ DAC
C H AN N EL 1
V O UT N 1
SE
R EF O U T S ER IAL
R EF E R E NC E R ES E T
R EF C AP P O RT
V FB P 2
V IN P 2 Σ ∆ ADC M C LK
V IN N 2 C H AN N EL 2
V FB N 2
S DO F S
V O UT P2 Σ ∆ DAC
C H AN N EL 2
V O UT N 2 S DO
A G ND 1 A G ND 2 D G ND
TF S S DIFS C LO C K
16.384 M H z
DT S DI
DSP S CL K S CL K CO D E C
AD S P-2 18 x DR S DO AD 73 322
R FS S DO F S
FL 0 R ES ET
FL 1 SE
SE
S CL K
S DO F S
S DO A DC S AM P LE W O R D , D EV IC E 2 A DC S AM P LE W O R D , D EV IC E 1
S DIFS
S DI D AC D AT A W O R D , D E VICE 2 D AC D AT A W O R D, D E VICE 1
The SE pin (SPORT enable) may be controlled from a parallel output pin
or a flag pin, such as FL1; or, where SPORT powerdown is not required, it
can be permanently strapped high using a suitable pull-up resistor. The
RESET pin may be connected to the system hardware reset, or it may be
controlled with another flag bit.
In the program mode, data is transferred from the DSP to the AD73322
control registers to set up the device for desired operation. Once the
device has been configured by programming the correct settings to the
various control registers, the device may exit the program mode and enter
the data mode. The dual ADC data is transmitted to the DSP in two
blocks of 16-bit words. Similarly, the dual DAC data is transmitted from
the DSP to the AD73322 in two blocks of 16-bit words. Simplified inter-
face timing is also shown in Figure 10-17.
The AD73422 is the first product in the dspConverter™ family of prod-
ucts that integrate a dual analog front end (AD73322) and a DSP
(52 MIPS ADSP-2185L/ADSP-2186L). The entire functionality of the
dual-channel codec and the DSP fits into a small, 119-ball 14 mm by 22
mm plastic ball grid array (PBGA) package. The obvious advantage of this
size package is the saving of circuit board real estate. ADC and DAC sig-
nal-to-noise ratios are approximately 77 dB over voiceband frequencies.
The AD74222-80 integrates 80 K bytes of on-chip memory configured as
16 K words (24-bit) of program RAM, and 16 K words (16-bit) of data
RAM. The AD73422-40 integrates 40 K bytes of on-chip memory config-
ured as 8 K words (24-bit) of program RAM, and 8 K words (16-bit) of
data RAM. Powerdown circuitry is also provided to meet the low power
needs of battery operated portable equipment. The AD73422 operates on
a +3 V supply and dissipates approximately 120 mW with all functions
operational.
The following summarizes the features of the ADSP73422
dspConverter™:
• Complete dual codec (AD73322) and DSP
(ADSP-2185L/ADSP-2186L)
• 14 mm by 22 mm BGA package
• +3 V single-supply operations, 73 mW power dissipation
• Powerdown mode
• Codec
• Dual 16-bit sigma-delta ADCs and DACs
• Data rates: 8, 16, 32, 64 KSPS
• 77 dB SNR
• DSP
• 52 MIPS
• ADSP-218x code compatible
• 80 K byte and 40 K byte on-chip memory options
High-Speed Interfacing
With the advent of ever faster DSP clock rates and newer architectures it
has become possible to acquire and process high speed signals. The pro-
grammability of DSPs makes it possible to run different algorithms on the
same hardware while providing different system functionality.
An example of high-speed ADC is the AD9201. It is a dual-channel,
10-bit, 20 MSPS ADC that operates on a single +2.7 V to +5.5 V supply
and dissipates only 215 mW (+3 V supply). The AD9201 offers closely
matched ADCs needed for many applications, such as I/Q communica-
tions. Input buffers, an internal voltage reference and multiplexed, digital,
output buffers make interfacing to the AD9201 very simple.
The companion part to the AD9201 ADC is the AD9761 DAC. The
AD9761 is a dual, 10-bit, 20 MSPS per channel DAC operating on a sin-
gle +2.7 V to +5.5 V supply and dissipating only 200 mW (+3 V supply).
A voltage reference, digital latches and 2x interpolation make the AD9761
useful for I/Q transmitter applications.
DSP
AD S P-21 8X
A0
D 8-D 17
RD
WR
S C LK
D U AL 10-BIT
20 M S P S A D C s
ADC
DAC
AD 9 201
AD 9 761
D 0-D 9 D 0-D 9
D U AL 10-B IT
C LO C K C LO C K 20 M S P S D A C s
S EL EC T S EL EC T
C H IP -SE LE C T W R ITE
Due to the simple interface between the DSP processor and the AD9201
and AD9761, shown in Figure 10-18, a memory select signal is not
required. When performing reads from the ADC, only the RD signal is
required to assert the chip select of the AD9201. Writes require only the
use of the WR signal to the AD9761. If additional peripherals are to be
interfaced to the DSP's external bus, some external decoding logic would
be required.
ADS P-2 18 9M
14 14
CLKIN ADDR 22
1/2 X CL OCK
OR CRYST AL 8 ADDR
BYTE
XTAL
24 8 M EM OR Y
DATA DATA
4
INTERRU PTS IRQ x
BM S CS
PROGRAM M ABLE 7
PFx/ WR 11
IO PINS
M ODE x ADDR I/O SPA CE
RD 16 (PERIPH ERALS)
DATA
2048 LOCA TIONS
5 IO M S
SERIAL SPORT1 CS
DEVIC E
14
ADDR OVERLA Y
24 M EM OR Y
DATA
5 SPORT0 PM S
SERIAL
DM S TW O 8 K PM SEG M ENTS
DEVIC E
CM S TW O 8 K DM SEGM ENTS
BR
BUS/REQ UEST/
BG
GRANT/HUNG
BGH
PW D POW ER DOW N INPUT
Interfacing Examples
This section provides some hardware examples of circuits that can be
interfaced to the ADSP-218x DSP serial ports or DMA ports. As with any
hardware design, it is important that timing information be carefully ana-
lyzed. Therefore, the appropriate ADSP-218x processor data sheet should
be used in addition to the information presented in this chapter.
For a single AD73311 codec, the D-latches are not required. Therefore,
the codec RESET input could be connected to the system RESET signal, and
the serial port enable could be connected directly to an output flag pin
(FLn) on the DSP.
Please refer to the AD73311 data sheet for further application details.
3.3V 2.5V
3.3V V DD E X T V DD IN T
CO DE C #1
V DD
AD 73 311 V IN S DIF S TFS
S P O R T0
S DI DT
V O UT
S CL K S CL K
SE
SE S DO DR
RE S E T
RE S E T S DO F S RFS
FL0
DSP
F L1
V IN
CO DE C #2 S DIF S AD S P-2 18 9M
S DI
AD 73 311 V O UT
S CL K NC
SE
S DO
RE S E T
S DO F S 3.3V
D V CC Q
HC 7 4
Q RE S E T
D Q SE
V IN
CO DE C #8 S DIF S
S DI
M CL K Q
AD 73 311 V O UT
S CL K NC
SE
S DO
RE S E T
S DO F S
M CL K
3.3V 2.5V
5V
V DD E X T V DD IN T
V DD V DR IV E
DSP
ADC AD S P- 21 8M
AD 74 75/95
S CL K S CL K
V IN A S DA T A DR
S P O R T0
DT
M AX 1M S /s
CS RF S
V RE F
TFS
G ND G ND
Figure 10-22 shows the serial timing for the ADSP-218x DSP interface to
the AD7475/95 ADC.
S CL K
1 2 3 4 5 16 17 18 1
CS (RF S )
S DA T A 0 0 0 0 MSB LSB 0
O NE CO M P L ET E S E RIA L F RA M E – M AX S AM P L E RA T E 1M S/s
– S CL K=18M Hz
Note that the DSP RFS frame sync output is used to initiate conversion
and set the sample rate. For some applications, it may be desirable to use a
more stable frequency source, such as an independent clock. In this case,
the external clock would be an input to both the CS pin on the ADC and
the DSP RFS frame sync pin.
3.3V 2.5V
3.3V ADC
AD 7 888
V DD E X T V DD IN T
8Ch , 12-Bit, 125K S /s
V DD DSP
AD S P-2 18 9M
A IN 1
S CL K S CL K
DO U T DR
S P O R T0
DIN DT
A IN 8
CS RF S
TFS
V RE F
AG N D AG N D G ND
Figure 10-24 shows the serial interface timing for the ADSP-218x DSP to
AD7888 ADC Interface.
S CL K
1 2 3 4 5 6 16 1
CS (RF S )
DO N TC ZE RO AD D R 2 AD D R 1 AD D R 0 RE F PM 1 PM 0 DO N TC
DIN
DO UT 0 0 0 0 MSB LS B
0
Note that the DSP RFS frame sync output is used to initiate conversion
and set the sample rate. For some applications, a more accurate clock may
be needed to set the sample rate and minimize jitter. In this case, the
external clock would be an input to both the CS pin on the ADC and the
DSP RFS frame sync pin.
3.3V 2.5V
V DD E X T V DD IN T
5V
A0
S E L E CT 3
AD DR E S S AD DR E S S B US
W A IT S T AT E S
DE C O DE R A10
V DD V D RV E
IO M S
ADC CS
AD 7 899 RD RD AD S P-2 18 9M
BS Y /E O C IR Q 2
V IN A 400KS /s M AX
CO N V ST FL0
D8
V IN B
E X T CL O CK D9
D0 D10
14-BIT DA T A BU S
V RE F D13 D23
G ND OPGND G ND
Where MR0 is the ADSP-218x MR0 register and ADC is the AD7899 IO
address.
2.5V 3.3V
3.3V
V DDINT V DDE X T
DSP V DD
AD5 320
DT DIN
S P O RT 0
TFS S Y NC V O UT
M AX S CLK 20M Hz
S CLK S CLK
RFS
DR
G ND G ND
By adding the minimum inactive time for the SYNC pulse of 33 ns, a sam-
ple rate over 1 MS/s can be supported.
S Y NC (T F S )
S CL K
1 2 3 4 5 16 17 N 1
DIN (DT ) 0 0 0 0 DB 1 1 DB 0 0
O NE CO M PL E T E S E RIA L F RA M E – M AX S AM P L E RA T E 1M S/s
– S CL K M AX =20M H z
This data programs the SCLK to 18.75 MHz, assuming that the
ADSP-218x DSP is operating with a CLKOUT frequency of 75 MHz. The
data also sets the TFS to alternate inverted mode (active low TFS signal)
and the word length to 16-bits. The sample rate is set by the frequency at
which data is written to the transmit buffer, but in no case should the rate
exceed –1.1 MHz.
IDMA Operation
External devices can gain access to the internal memory of any of the
ADSP-218x family members through the DSP’s IDMA port. Host proces-
sors accessing the ADSP-218x through IDMA can treat the DSP as a
memory-mapped slave peripheral. They have access to all of the DSP’s
internal Data Memory (DM) and Program Memory (PM) except for the
32 memory-mapped control registers, which reside at addresses
DM(0x3FE0) through DM(0x3FFF).
No
The DSP memory address and destination memory type bit field is loaded
into the IDMA Control register, shown in Figure 10-29.
ID M A O verlay
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 D M (0x3F E 7)
R eserve d
ID P M O V LA Y
S et to 0
ID D M O V LA Y
ID M A C ontrol
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 U U U U U U U U U U U U U U U D M (0x3F E 0)
IDM A D
D estinatio n m em o ry typ e:
0=P M IDM A A
1=D M S tartin g a dd ress
This register contains the 14-bit internal memory address, along with a bit
to specify the type of transfer: 24-bit Program Memory opcodes or 16-bit
Data Memory data. The IDMAA starting address can be initialized by
either the DSP or by a host processor.
Schematic Explanation
Figure 10-30 provides a schematic showing the glue logic between a
Motorola MC68332 processor and the ADSP-2189M processor using
address decoding. Figure 10-31 provides a schematic showing the glue
logic between a Motorola MC68332 processor and the ADSP-2189M
processor using a chip select.
M C 68332 A D SP -2189M
Q S 3384
LO BE A
LO BE B
DS A CK 0
BU S B [0] IA CK
DS A CK 1 BU S B [0]
PF1
1 2 1 BU S B [1] IS
DS 3 BU S B [1]
2
AD D R[1 3] 1
3
AD D R[1 2] 1 2 2
BU S B [1] IRD
R/W 1 2 BU S B [1]
1 BU S B [1] IW R
3 BU S B [1]
2
BU S B [1] IA L
AD D R[0 ] BU S B [1]
Figure 10-30. Glue Logic between the MC68332 and the ADSP-2189M
Using Address Decoding
M C 68332 A D SP -2189M
Q S 3384
LO BE A
DS
LO BE B
DS A CK 0
BU S B [0] IA CK
DS A CK 1 BU S B [0]
PF1
U9 A
AD D R[1 ]
1 BU S B [1] IS
3 BU S B [1]
CS 7 2
74L S 32
U7 A
BU S B [1] IRD
R/W 1 2 BU S B [1]
U4 A 74L S 04
1 BU S B [1] IW R
3 BU S B [1]
2
74L S 32
BU S B [1] IA L
BU S B [1]
Figure 10-31. Glue Logic Between the MC68332 and the ADSP-2189M
Using a Chip Select
When all initialization is complete, the host should then initialize the
DSP’s restart vector. Then, the DSP program execution commences. This
booting process is shown in Figure 10-32.
L atch A d dr ess
(P M (0x00 01)
D ow n load First
P M Segm en t
D ow n load A dd itio n al
P M Segm en ts*
D ow n load DM
S eg m en ts**
L atch A d dr ess
(P M (0x00 00)
D ow n load
R estart V ector
ID M A W o rd C ou n t
.
.
.
IDM A d ata w o rd n
The first element read from the image file is the number of 16-bit words
(IDMA Word Count) to be transferred to the DSP (remember that each
24- bit PM opcode counts as two 16-bit words). This value is placed in a
data register and can be used as a loop counter to control the download
function.
The next value in the IDMA image file is the DSP starting address (IDMA
Starting Address), which is the 15-bit value that represents the starting
address of the code or data segment that will be transferred during the
IDMA access. This starting address value should be written from the host
processor into the DSP's IDMA Control register. The DSP's starting
address is then followed by the IDMA Overlay Control word, which is
used to assign the proper internal DSP overlay memory region that will be
accessed during the IDMA transfer.
! Please keep in mind that the IDMA Overlay register applies only for
the ADSP-2187, ADSP-2188, and ADSP-2189 processors.
The next values are the data or instruction values (IDMA data word 1…n)
that need to be transferred. When the microcontroller has transferred the
proper number of items (as determined by the count), it gets the next
count value from the buffer, the next DSP address, and so on.
The download process stops when the microcontroller encounters a count
value of 0xffff. This download process is shown in Figure 10-34.
MC68332 assembly code to implement this download process is presented
in Listing 10-1 on page 10-55.
Count No
Expired?
Yes
No
Count=FFFF
?
Yes
Done
; download.asm
;
; This code runs on an MC6833x processor and is used to
; download code and data segments to an ADSP-2189 IDMA port
; interface.
; Note: The ADSP-2189 is a 3.3V device in order to avoid damage
; use 5V to 3.3V logic level Voltage translator (e.g. QS 3384)
;
SCDR EQU $fffc0e ;SCI Data Register
SCCR0 EQU $fffc08 ;SCI Control Register 0
SCCR1 EQU $fffc0a ;SCI Control Register 1
QMCR EQU $fffc00 ;QSM Configuration Register
SCSR EQU $fffc0c ;SCI Status Register
SRAMBAH EQU $fffb44 ;SRAM Base Address Register High Word
SRAMMCR EQU $fffb40 ;SRAM Module Configuration Register
FYPCR EQU $fffa21 ;SCIM System Protection Control Register
SIMMCR EQU $fffa00 ;SCIM Configuration Register
CSPAR0 EQU$fffa44 ;Chip Select Pin Assignment Register 0
CSPAR1 EQU $fffa46 ;Chip Select Pin Assignment Register 1
CSBAR0 EQU $fffa4c ;Chip Select Base Register 0
CSOR0 EQU $fffa4e ;Chip Select Option Register 0
PORTF0 EQU $fffa18 ;Port F Data Register
org $010000
org $000400
; ***********************************************************
; Init: Beginning of the CODE segment
; ***********************************************************
Init:
move.b #$0,(FYPCR).L ; Turn off watchdog timer
move.l #$101FE,a7 ; Stack at location $101FE
move.w #$0001,(SRAMBAH).L ; Move SRAM to $10000
move.w #$0000,(SRAMMCR).L ; Turn on SRAM (Variables/Stack)
move.w #$0040,(SIMMCR).L ; Enable User Mode
move.w #$3FFF,(CSPAR0).L ; Enable Chip Selects 0-5
move.w #$03FF,(CSPAR1).L ; Enable Chip Selects 6-10
move.w #$0000,(CSBAR0).L ; Use Chip Select 0
move.w #$3822,(CSOR0).L ; Assert Chip Select 0
top:
move.w (PORTF0).l,d1 ; Check PF1 to see if IACK low
and.w #$0002,d1 ; before proceeding
bne top
move.l #$002002,a4 ; initialize a4 with Address
; Latch address
move.l #$002000,a3 ; initialize a3 with data port
; address
move.l #$010000,a2 ; initialize a2 to start of DSP
; code/data
move.w (a2)+,d2 ; load count value into d2
tx_rx_loop:
tx_dat a:
wait_data:
move.w (PORTF0).l,d1 ; check PF1 to see if /IACK low
and.w #$0002,d1
bne wait_data
dbf d2,tx_data ; decrement count to see if at end
; of module
move (a2),d4 ; get next count value
sub.w #$ffff,d4 ; check if end of all modules
beq done_data ; if at end, send Restart vector
; if booting, done otherwise
move (a2)+,d2 ; get next module count
bra tx_rx_loop ; go back to transferring DSP
; information
done_data:
bra done_data ; data file is completed.
Advanced Topics
This section discusses some issues that the system designer may find help-
ful when using the Motorola MC68332 for more complex systems.
Multiple Processors
In this hardware example, we focused on connecting a single
ADSP-2189M DSP to a Motorola MC68332 microprocessor. This
scheme can easily be expanded to support multiple DSP processors, with-
out additional glue logic. In a multiple DSP system, multiple IS lines are
needed to select each individual DSP processor. The multiple IACK signals
from each DSP can be bussed together in a “wired-OR” configuration to
create a single IACK signal to the host processor. The 100-pin ADSP-218x
processors (all ADSP-218x processors except for the ADSP-2181 and
ADSP-2183) support this “wired-OR” IACK logic configuration when
their Mode C and Mode D pins are set to a logic high. In this configuration,
an external pulldown resistor is needed, since the IACK signal is driven
from an open-drain PMOS transistor.
For our system design, each DSP processor requires two of the Motorola
6833x’s memory locations: one memory location is used to perform an
IDMA address latch sequence; the other is used for transmitting or receiv-
ing IDMA data. Both memory location addresses are used to assert the
appropriate IS signal of the specific DSP processor in the system that the
host processor wishes to access. In this manner, each DSP processor can be
accessed individually.
Hardware Signaling
In many instances, it may be desirable for the host and DSP processors to
have additional avenues of communication. The host can use one of its
programmable flags as an output attached to a hardware interrupt on the
DSP. With this method, the host can alert the DSP before a transfer
occurs or inform the DSP that a transfer has been completed. This
method can be especially useful since there is no interrupt associated with
IDMA operation on the ADSP-2189. The DSP can likewise use a pro-
grammable flag as an output to signal the host if there is new data for the
host to use or if new code is required for download.
References
The following is a list of references for materials used in developing this
chapter and for materials that provide additional information. Please note
that many of these materials can be found on Analog Devices’ Web pages
at www.analog.com.
• Steven W. Smith, The Scientist and Engineer’s Guide to Digital Signal
Processing, Second Edition, 1999, California Technical Publishing,
P.O. Box 50240, San Diego, CA 92150.
• C. Britton Rorabaugh, DSP Primer, McGraw-Hill, 1999.
• Richard J. Higgins, Digital Signal Processing in VLSI, Pren-
tice-Hall,1990.
• DSP Designer’s Reference (DSP Solutions) CDROM, Analog
Devices,1999.
• DSP Navigators: Interactive Tutorials about Analog Devices’ DSP
Architectures (ADSP-218x family):
• DSP Training and Workshops:
Overview
ADSP-218x family processors support 16-bit fixed-point data in hard-
ware. Special features in the computation units allow you to support other
formats in software. This appendix describes various aspects of the 16-bit
data format. It also describes how to implement a block floating-point for-
mat in software.
Bit 15 14 13 2 1 0
15 14 13 2 1 0
W eight –(2 ) 2 2 • • • 2 2 2
Sign
Bit
Signed Integer Radix
Point
Bit 15 14 13 2 1 0
15 14 13 2 1 0
W eight 2 2 2 • • • 2 2 2
In a fractional format, the assumed radix point lies within the number, so
that some or all of the magnitude bits have a weight of less than 1. In the
format shown in Figure A-2, the assumed radix point lies to the left of the
3 LSBs, and the bits have the weights indicated.
Bit 15 14 13 4 3 2 1 0
12 11 10 1 0 –1 –2 –3
Weight –(2 ) 2 2 • • • 2 2 2 2 2
Sign
Bit
Signed Fractional (13.3)
Radix
Point
Bit 15 14 13 4 3 2 1 0
12 11 10 1 0 –1 –2 –3
Weight 2 2 2 • • • 2 2 2 2 2
Table A-1 shows the ranges of numbers that can be represented in the
fractional formats that are possible with 16 bits.
Binary Multiplication
In addition and subtraction, both operands must be in the same format
(signed or unsigned, radix point in the same location) and the result for-
mat is the same as the input format. Addition and subtraction are
performed the same way whether the inputs are signed or unsigned.
In multiplication, however, the inputs can have different formats, and the
result depends on their formats. The ADSP-218x family assembly lan-
guage allows you to specify whether the inputs are both signed, both
unsigned, or one of each (mixed-mode). The location of the radix point in
the result can be derived from its location in each of the inputs. This is
shown in Figure A-3. The product of two 16-bit numbers is a 32-bit num-
ber. If the inputs’ formats are M.N and P.Q, the product has the format
(M+P).(N+Q). For example, the product of two 13.3 numbers is a 26.6
number. The product of two 1.15 numbers is a 2.30 number.
2 Guard Bits
Sign Bit
Sign Bit
2 Guard Bits
Sign Bit
Overview
This appendix shows bit definitions for ADSP-218x memory-mapped
control registers and non-memory-mapped control and status registers.
The memory-mapped registers are listed in descending address order.
Default bit values at reset are shown. If no value is shown, the bit is unde-
fined at reset. Reserved bits are shown on a grey field. These reserved bits
must be set to zero.
P RO CE S S O R CO RE
D ATA A DD RE S S GE NE RA TOR S
D AG1 D AG2
(DM A DD RE S S ING ON LY ) (DM A ND P M A DD RE S S ING)
BIT-R E V E RS E C AP A BILITY IN DIRE C T B RA NC H C AP A BILITY TIM E R M E MO RY IN TE RFA CE
P R OGR AM S E Q UE N CE R
RX0 TX 0
18 5 14
MU LTICH A NN E L E N AB LE S
LOOP IC N TL PC
S TA CK 0X 3FFA R X 31 -1 6
S TA CK 16
4 X 18 16 X 1 4 0X 3FF9 R X 15 -0
IFC *
14 8 0X 3FF8 TX 3 1-16
OW RC NTR S S TA T TX 1 5-0
0X 3FF7
C NTR 10 7 8
IM A S K* M S TAT* A S TAT S P OR T0 CON TROL
C OUN T ID M A P ORT
S TA CK 0X 3FF6 CON TROL
S TA TU S S TA CK * B DM A P OR T
4 X 14 0X 3FF5 S C LKD IV P R OGR AM M AB LE FLA GS
* S TA T U S S TA C K D E P TH=12 M E M O R Y LO C A TIO NS, WID TH=25 B ITS 0X 3FF4 R FS DIV
ID M A RE GIS TE RS B DM A RE GIS TE RS
0X 3FF3 AU TOBU FFE R
A LU M AC ID M A C ON TROL 0X 3FE 4 B W C OUN T
0X 3FE 0
RE GIS TE R
0X 3FE 3 B DM A CON TROL
AX0 AX1 AY0 AY1 MX0 MX1 MY0 MY1
PR OGR AM M AB LE
S P OR T 1 0X 3FE 2 B E AD
8 16 16 FLA G R E GIS TE RS
P FTYP E 0X 3FE 1 B IA D
AR AF M R2 M R1 M R0 MF RX1 TX 1 0X 3FE 6
0X 3FE 5 P FD ATA
S P OR T1 C ON TROL
SR1 SR0
Memory-Mapped Registers
System C ontrol
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 DM (0x3FFF)
SPORT0 E nable
1 = enabled, 0 = d isabled PW AIT
PR OG RA M M EM O RY
SPORT1 E nable
1 = enabled, 0 = d isabled
Defa ult bit va lue s a t re set are sh own . If n o va lue is sho wn, th e bit is un define d at re set.
Rese rved bits are sh own on a grey field . T h ese reserve d bits m ust be set to zero.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 D M (0x3F FE )
D W A IT IO W A IT 3 IO W A IT 2 IO W A IT 1 IO W A IT 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 D M (0x3F FE )
Figure B-4. Wait State Control Register (All ADSP-218x Processors except
the M and N Series)
Defa ult bit va lue s a t re set are sh own . If n o va lue is sho wn, th e bit is un define d at re set.
Rese rved bits are sh own on a grey field . T h ese reserve d bits m ust be set to zero.
Tim er
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SPO R T0 C ontrol
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 D M (0x3 FF6)
M CE
M ultichannel E nable S LE N (S erial W ord Length – 1)
IS C LK
D TY P E Data Form at
Intern al S erial Clock G eneration
00=right justify, z ero-fill unused M S Bs
R FS R 01=right justify, sign-extend into unused M S Bs
R eceive Fram e S ync R equired 10=com pan d using µ -law
11=com pan d using A -law
R FS W
R eceive Fram e S ync W idth INV RFS
M FD Invert R eceive Fram e S ync
M ultichannel Fram e D elay INV TFS
(only If M ultichannel M o de E nab led) Invert Transm it Fram e S ync
(or IN V TD V Invert Transm it D ata V alid)
TFS R
(only If M ultichannel M ode E nabled )
Transm it Fram e S ync R equired
IRFS
TFS W Intern al R eceive Fram e S ync E nable
Transm it Fram e S ync W idth
ITFS
Intern al Tran sm it Fram e S ync E nable
(or M CL M ultichan nel Length:
1=32 w ords, 0=24 words)
(only If M ultichannel M o de E nab led)
Defa ult bit va lue s a t re set are sh own . If n o va lue is sho wn, th e bit is un define d at re set.
Rese rved bits are sh own on a grey field . T h ese reserve d bits m ust be set to zero.
S P O R T 0 M u ltic h a n n e l W o rd E n a b le
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
D M (0 x 3 F F A )
R e c e iv e
W o rd
E n a b le s 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
D M (0 x 3 F F 9 )
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
D M (0 x 3 F F 8 )
T ra n s m it
W o rd
E n a b le s 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
D M (0 x 3 F F 7 )
1 = c h a n n e l e n a b le d
0 = c h a n n e l ig n o re d
Defa ult bit va lue s a t re set are sh own . If n o va lue is sho wn, th e bit is un define d at re set.
Rese rved bits are sh own on a grey field . T h ese reserve d bits m ust be set to zero.
S PO R T0 A utobuffer C ontrol
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 D M (0x3F F3)
TIR EG TM R E G R IR E G R M RE G
R BU F
R eceive Au to bu fferin g E nable
B IA S R N D TB U F
M A C B iased Ro un din g Co ntrol B it Transm it A utob uffering En ab le
C LK O D IS
C LK O U T Disable C on tro l B it
S PO R T0 S C LK D IV
S erial C lock D ivide M odulus
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
D M (0x3F F5)
S PO R T0 R FS D IV
R eceive Fram e S ync D ivide M odulus
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
D M (0x3F F4)
Defa ult bit va lue s a t re set are sh own . If n o va lue is sho wn, th e bit is un define d at re set.
Rese rved bits are sh own on a grey field . T h ese reserve d bits m ust be set to zero.
S PO R T1 C on trol
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 D M (0x3F F2)
IT F S IR FS
In tern al T ran sm it F ram e S yn c E nab le In tern al R eceive F ram e Syn c E n able
Defa ult bit va lue s a t re set are sh own . If n o va lue is sho wn, th e bit is un define d at re set.
Rese rved bits are sh own on a grey field . T h ese reserve d bits m ust be set to zero.
S P O R T 1 S C L K D IV
S e ria l C lo c k D iv id e M o d u lu s
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
D M (0 x 3 F F 1 )
S P O R T 1 R F S D IV
R e c e iv e F ra m e S y n c D iv id e M o d u lu s
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
D M (0 x3 F F 0 )
C L K O U T freq u e n c y S C L K freq u e n c y
S C L K D IV = – 1 R F S D IV = – 1
2 * (S C L K freq u e n c y) R F S freq u e n c y
Defa ult bit va lue s a t re set are sh own . If n o va lue is sho wn, th e bit is un define d at re set.
Rese rved bits are sh own on a grey field . T h ese reserve d bits m ust be set to zero.
0 0 0 0 0 0 DM(0x3FEF)
XTALDIS RBU F
XTAL pin disable during powerdown Receive Autobuffer Enable
1=disabled, 0=enabled
(XTAL pin should be disabled when TBUF
Transm it Autobuffer Enable
no external crystal is connected)
XTALDELAY RMREG
1=delay, 0=no delay Receive M Register
(Use delay to allow internal phase
RIREG
locked loop or external
Receive I Register
oscillator to stabilize)
PDFORCE TMREG
Powerdown Force Transm it M Register
1=force proce ssor to vector to TIREG
powerdown interrupt Transm it I Register
PUCR
Powerup Con text Reset
1=soft reset (clear context)
0=resum e execution
Defa ult bit va lue s a t re set are sh own . If n o va lue is sho wn, th e bit is un define d at re set.
Rese rved bits are sh own on a grey field . T h ese reserve d bits m ust be set to zero.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 1 1 1 0 1 1 0 0 0 0 0 0 0 0 DM(0x3FE6)
IOM BM DM PM
BMWAIT
PFTYPE
CMSSEL
1 = output
1 = enable CMS 0 = input
0 = disable CMS
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 1 0 1 1 0 0 0 0 0 0 0 0 DM(0x3FE6)
IOM BM DM PM
BMWAIT
PFTYPE
CMSSEL
1 = output
1 = enable CMS
0 = input
0 = disable CMS
Defa ult bit va lue s a t re set are sh own . If n o va lue is sho wn, th e bit is un define d at re set.
Rese rved bits are sh own on a grey field . T h ese reserve d bits m ust be set to zero.
P rogram m ab le Flag D a ta
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 D M (0x3F E 5)
P FD AT A
B D M A C ontrol
(AD S P-2 187 , A DS P -218 8, and A D SP -218 9)
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
D M (0x3F E 3)
B TY PE (S e e tab le)
B M PA G E
B M O VL A Y B DIR
0 = load from B M
1 = sto re to BM
B TY PE 00 01 10 11
B CR
Intern al M em o ry Sp ace PM DM DM DM
0 = run d urin g BD M A
W o rd Size 24 16 8 8 1 = halt d urin g BD M A ,
A lig nm en t F ull F ull M SB LS B C on text Reset w hen do ne
w ord w o rd
Defa ult bit va lue s a t re set are sh own . If n o va lue is sho wn, th e bit is un define d at re set.
Rese rved bits are sh own on a grey field . T h ese reserve d bits m ust be set to zero.
B D M A C ontrol
(All A D SP -2 18x P roces sors ex cep t A DS P-218 7, A DS P -21 88, and A DS P-2 189 )
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
D M (0x3F E 3)
B TY PE (S e e tab le)
B M PA G E
B DIR
0 = load from B M
1 = sto re to BM
B TY PE 00 01 10 11
B CR
Intern al M em o ry Sp ace PM DM DM DM
0 = run d urin g BD M A
W o rd Size 24 16 8 8 1 = halt d urin g BD M A ,
A lig nm en t F ull F ull M SB LS B C on text Reset w hen do ne
w ord w o rd
Defa ult bit va lue s a t re set are sh own . If n o va lue is sho wn, th e bit is un define d at re set.
Rese rved bits are sh own on a grey field . T h ese reserve d bits m ust be set to zero.
B D M A W o rd C o u n t
M M A P = 0 a n d B M O D E = 0 ( A D S P -2 1 8 1 a n d A D S P -2 1 8 3 o n ly )
M O D E B = 0 (A ll o t h e r A D S P -2 1 8 x p ro c e s s o r s )
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 D M (0 x 3 F E 4 )
BW COUNT
or
M M A P = 1 o r B M O D E = 1 ( A D S P -2 1 8 1 a n d A D S P -2 1 8 3 o n ly )
M O D E B = 1 (A ll o t h e r A D S P -2 1 8 x p ro c e s s o r s )
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 D M (0 x 3 F E 4 )
BW COUNT
N o te : B its 1 4 a n d 1 5 a r e u n u s e d
a n d s h o u ld b e s e t t o 0 .
Defa ult bit va lue s a t re set are sh own . If n o va lue is sho wn, th e bit is un define d at re set.
Rese rved bits are sh own on a grey field . T h ese reserve d bits m ust be set to zero.
B D M A E x te rn a l A d d re s s
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 D M (0 x 3 F E 2 )
BEAD
N o te : B its 1 4 a n d 1 5 a re u n u s e d
a n d s h o u ld b e s e t to 0 .
B D M A In te rn a l A d d re s s
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 D M (0x 3 F E 1 )
B IA D
N o te : B its 1 4 a n d 1 5 a r e u n u s e d
a n d s h o u ld b e s e t t o 0 .
Defa ult bit va lue s a t re set are sh own . If n o va lue is sho wn, th e bit is un define d at re set.
Rese rved bits are sh own on a grey field . T h ese reserve d bits m ust be set to zero.
ID M A C o n tro l
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 D M (0 x 3 F E 0 )
ID M A D
D e s tin a tio n m e m o r y ty p e :
0=P M ID M A A
1=D M S ta r tin g a d d r e s s
N o te : B it 1 5 is a re s e rv e d b it a n d
s h o u ld b e s e t to 0 in a ll A D S P - 2 1 8 x
p r o c e s s o r s e x c e p t th e A D S P -2 1 8 7 ,
A D S P -2 1 8 8 , a n d A D S P -2 1 8 9 .
ID M A O v e r la y
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 D M (0 x 3 F E 7 )
R e s e rv e d R e s e rv e d
ID P M O V L A Y
S e t to 0 S e t to 0
ID D M O V L A Y
S h o r t R e a d O n ly
0 = D is a b le , 1 = E n a b le
N o t e 1 : T h e ID D M O V L A Y a n d ID P M O V L A Y b it f ie ld s a p p ly o n ly t o t h e A D S P - 2 1 8 7 , A D S P -
2 1 8 8 , a n d A D S P - 2 1 8 9 p r o c e s s o r s . F o r a ll o t h e r A D S P - 2 1 8 x p r o c e s s o r s , t h e s e b it s a r e
u n u s e d a n d m u s t b e s e t to 0 .
N o t e 2 : T h e s h o r t r e a d o n ly b it ( b it 1 4 ) a p p lie s t o M a n d N s e r ie s o n ly .
F o r a ll o t h e r A D S P - 2 1 8 x p r o c e s s o r s , t h is b it i s u n u s e d a n d m u s t b e s e t t o z e r o .
Defa ult bit va lue s a t re set are sh own . If n o va lue is sho wn, th e bit is un define d at re set.
Rese rved bits are sh own on a grey field . T h ese reserve d bits m ust be set to zero.
A S TA T S S TA T (read -o nly)
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1
SS M V A Q AS AC A V AN AZ
A LU R es u lt Z er o P C S ta ck E m p ty
A LU O v erflo w C ou n t S ta ck E m p ty
A LU X In p u t S ig n S tatu s S ta ck E m p ty
A LU Q u o tien t S ta tu s S ta ck O verflo w
M A C O verflo w L o o p S ta ck E m p ty
M S TA T IC N TL
6 5 4 3 2 1 0 4 3 2 1 0
0 0 0 0 0 0 0
R egist er B an k S e le ct
0= prim a ry, 1= s ec on d ar y
B it-R ev ers e A d dress in g E n able (D A G 1 )
Defa ult bit va lue s a t re set are sh own . If n o va lue is sho wn, th e bit is un define d at re set.
Rese rved bits are sh own on a grey field . T h ese reserve d bits m ust be set to zero.
IM A SK
9 8 7 6 5 4 3 2 1 0
IN T ER R U P T EN A B L ES
0 0 0 0 0 0 0 0 0 0 1 = e na ble
0 = disa b le (m a sk )
IR Q 2 Tim e r
IR Q L1 SP O R T 1 R e ce iv e o r IR Q 0
IR Q L0 SP O R T 1 T ra ns m it o r IR Q 1
SP O R T 0 Tr an sm it B D M A Int er ru p t
SP O R T0 R ec eiv e IR Q E
IFC
(w rite-on ly)
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
IR Q 2 Tim e r
SP O R T 0 Tran sm it SP O R T 1 R e ceiv e o r IR Q 0
SP O R T0 R ec eiv e SP O R T 1 T ra ns m it o r IR Q 1
IR Q E B D M A Interru p t
B D M A Int er ru p t IR Q E
SP O R T 1 T ra ns m it o r IR Q 1 SP O R T0 R ec eive
SP O R T 1 R ece iv e o r IR Q 0 SP O R T 0 Tran sm it
Tim e r IR Q 2
Defa ult bit va lue s a t re set are sh own . If n o va lue is sho wn, th e bit is un define d at re set.
Rese rved bits are sh own on a grey field . T h ese reserve d bits m ust be set to zero.
Overview
This appendix provides a summary of advanced features that are included
in the ADSP-218x family processors. Table C-1 lists each processor and
identifies the features each contains. (For basic features, see Table 1-1 in
Chapter 1, “Introduction.”)
ADSP-2181 No No No No No N/A
ADSP-2183 No No No No No N/A
ADSP-2185 Yes No No No No No
1 L indicates that the processor operates at 3.3 V. These processors are not tolerant to 5 V inputs.
2 M indicates that the processor core operates at 2.5 V and that the external I/O can op-
erate at 2.5 V or 3.3 V. The external I/O is tolerant to up to 3.6 V inputs with a supply
voltage of 2.5 V or 3.3 V. However, it is not tolerant to 5 V inputs.
3 N indicates that the processor core operates at 1.8 V and that the external I/O can operate
at 1.8 V or 3.3 V. The external I/O is tolerant to up to 3.6 V inputs with a supply voltage
of 1.8 V or 3.3 V. However, it is not tolerant to 5 V inputs.
Symbols Addressing
µ-law 5-28 direct 1-16
indirect 1-16, 4-4
Numerics linear indirect addressing 4-4
1.15 format 2-2 modulo (circular buffers) 4-5
ADSP-2181 and ADSP-2183
pins, descriptions 7-4–7-7
A
A-law 5-28
Accessing Peripherals 8-24 ALU
ADCs arithmetic 2-3
interface block diagram 2-8
parallel 10-2, 10-9, 10-10, 10-38– carry (AC) 2-38
10-39 divide primitives 2-14–2-20
serial 10-34–10-37 division 2-14–2-20
memory-mapped, reading data from input/output registers 2-12
10-2–10-10 multiprecision operations 2-13
Address generators 1-15 overflow latch mode 2-14
Address latch cycle 9-33–9-34 overflows 2-13
Addresses registers
base, calculating 4-6 ASTAT 2-9
BDMA, external 9-7 AX 2-9
next, select logic for 3-3 MSTAT 1-15, 2-10
vector saturation mode 2-13
ADSP-218x interrupt 3-16 standard functions 2-11
status 2-20
structure 2-8
Modes Numbers
fractional A-6 binary 2-1
Go 3-32 fractional format: 1.15 2-2
integer A-6 signed 2-2, A-1
memory 8-4 unsigned A-1
Full Memory 1-9, 8-23 unsigned binary 2-2
Host Memory 1-9, 8-24–8-26
interface 8-23–8-27 O
Modulo addressing (circular On-chip peripherals 1-17–1-18
buffers) 4-5 Overflow latch mode, ALU 2-14
Monitors Overflows, ALU 2-13
power supply 7-42 Overlay latch cycle 9-34
MR register Overlays
operation 2-28 Data Memory 8-12–8-15
MSTAT register 1-15, 2-10, 2-13, memory, external 8-3
2-14, 3-30, B-17 Program Memory 8-9, 8-10
secondary set 3-31 internal and external 8-11
Multichannel function using autobuffering with 5-35
SPORTs 5-38–5-43 using DAGs with 4-14, 5-35
setup 5-39 Overshoot and ringing
Multiple processors 10-58 SPORTs 5-57
Multiplication
binary A-5–A-8
P
Multiplier/Accumulator, see MAC
Multiprecision operation, ALU Packages
100-LQFP 7-7–7-14
2-13
common-mode pins 7-9–7-12
memory mode pins 7-12–7-14
N 128-LQFP 7-3–7-7
Next address select logic 3-3 processor configurations 7-1
Non-Memory Mapped registers Parallel
B-17–B-18 interface 10-2, 10-9, 10-10
Normalize 2-45 interfacing to DSPs 10-2–10-16
port, ADC interface 10-38–10-39
PC stack Mode
popping top value 3-34 EZ-ICE circuit for 7-65
pushing top value 3-34 with RESET and ERESET sig-
PCB board nals 7-64
target systems 7-67 Mode A 9-15
Performance, DSP 1-11 Mode B 9-15
Peripherals, on-chip 1-17–1-18 Mode C 9-15
Pins Mode D 9-15
100-LQFP packages powerdown and acknowledge
common-mode 7-9–7-12 (PWDACK) 7-57
memory mode 7-12–7-14 states during powerdown 7-54–
active or passive mode 7-57
configuration 7-13 unused
BMODE 9-15 recommendations 7-18
Bus Grant Hung (BGH) 7-61 terminating 7-14
CLKIN 7-19 XTAL 7-19
CLKOUT 7-19 PMA bus 1-16, 8-2, 8-9
common-mode 7-9–7-12 PMD bus 1-16, 2-9, 2-22, 8-2
descriptions 7-1–7-19 PMD-DMD bus exchange 1-16,
100-LQFP packages 7-7–7-14 2-9, 2-22, 4-11
128-LQFP packages 7-3–7-7 block diagram 4-12
ADSP-2181 and ADSP-2183 structure 4-11–4-13
7-4–7-7 Ports
flag 7-33–7-35 BDMA 1-9, 9-2–9-20, 9-21
general purpose 7-34 IDMA 8-4, 9-21–9-50
Full Memory Mode 7-12, 8-26 functional description 9-28–
Host Memory Mode 7-13, 8-26 9-31
IDMA port 9-22 parallel
memory interface 8-26 ADC interface 10-38–10-39
memory mode 7-12–7-13 serial 1-17
MMAP 9-15 ADC interface 10-34–10-37
codec interface 10-32
DAC interface 10-40
U W
Underflows, ALU 2-13 Wait State Control register 8-16–
Unsigned binary numbers 2-2, A-1 8-17, B-4
Word
V framing, SPORTs 5-14
Variables and arrays 4-9 length, SPORTs 5-13