dsp56800e Freescale Semiconductor, Inc, dsp56800e Datasheet - Page 67

no-image

dsp56800e

Manufacturer Part Number
dsp56800e
Description
16-bit Digital Signal Controller Core
Manufacturer
Freescale Semiconductor, Inc
Datasheet
BYTVAR1
BYTVAR2
Arrays of bytes and structures containing bytes correctly allocate a byte as 8 bits rather than 16 bits. An
array of bytes can begin at any byte address. In Example 3-7, a string containing the characters “my world”
is allocated in data memory, where each character is stored in a byte. The string uses 8 bytes of data
memory (four 16-bit words).
STRING1
Data is organized in the memory map with the least significant byte occupying the lowest address in
memory—so-called little-endian byte ordering. This organization accounts for why the pairs of characters
are reversed in Example 3-7.
3.4.5.3
Word (16-bit) variables are naturally aligned correctly using word addressing—each address is treated as
referring to a 16-bit data value (see Section 3.5.2, “Accessing Word Values Using Word Pointers,” for
information on word addressing). Data accesses to program memory are always treated as word accesses
and behave the same as word accesses to data memory.
3.4.5.4
The DSP56800E architecture requires that long-word variables be allocated on even word addresses, as
illustrated in Figure 3-10 on page 3-19. In general, a long word is accessed using the (lower) even word
address. Long-word accesses using the stack pointer work somewhat differently. See Section 3.5.3,
“Accessing Long-Word Values Using Word Pointers,” for more information.
3.5
The DSP56800 core was designed to operate as a word-addressable machine, in which each address
represents one 16-bit word value. The DSP56800E instruction set has been enhanced to access byte, word,
and long-word memory accesses while maintaining compatibility with the DSP56800 architecture. This
section introduces the concept of word and byte pointers and shows how they are used to access byte,
word, and long values in memory.
3.5.1
As described in Section 3.4.5.1, “Byte and Word Addresses,” the DSP56800E architecture supports both
byte and word addresses. Byte pointers are used to access byte values in memory, while word pointers are
used to access byte, word, or long-word data types in memory.
Freescale Semiconductor
Memory Access and Pointers
Word and Byte Pointers
org
ds
ds
org
dcb
dcb
dcb
dcb
Word Variable Alignment
Long-Word Alignment
X:$100
1
1
X:$200
‘ym’
‘w ’
‘ro’
‘dl’
Example 3-7. Allocation of a Character String
Example 3-6. Allocation of 2 Bytes Globally
Data Types and Addressing Modes
; Allocate 2 bytes at word address = $100
; DS directive allocates 1 word at $100
; DS directive allocates a second word at $102
; Allocate 8 bytes at word address = $200
; ‘m’ in lower byte, ‘y’ in upper byte
; ‘ ’ in lower byte, ‘w’ in upper byte
; ‘o’ in lower byte, ‘r’ in upper byte
; ‘l’ in lower byte, ‘d’ in upper byte
Memory Access and Pointers
3-17

Related parts for dsp56800e