EasyManua.ls Logo

Microchip Technology dsPIC30F - Program Space Visibility from Data Space

Microchip Technology dsPIC30F
738 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
dsPIC30F Family Reference Manual
DS70051C-page 4-8 © 2004 Microchip Technology Inc.
4.4 Program Space Visibility from Data Space
The upper 32 Kbytes of the dsPIC30F data memory address space may optionally be mapped
into any 16K word program space page. This mode of operation is called Program Space
Visibility (PSV) and provides transparent access of stored constant data from X data space
without the need to use special instructions (i.e., TBLRD, TBLWT instructions).
4.4.1 PSV Configuration
Program Space Visibility is enabled by setting the PSV bit (CORCON<2>). A description of the
CORCON register can be found in Section 2. “CPU”.
When PSV is enabled, each data space address in the upper half of the data memory map will
map directly into a program address (see Figure 4-7). The PSV window allows access to the
lower 16 bits of the 24-bit program word. The upper 8 bits of the program memory data should
be programmed to force an illegal instruction, or a NOP, to maintain machine robustness. Note
that table instructions provide the only method of reading the upper 8 bits of each program
memory word.
Figure 4-8 shows how the PSV address is generated. The 15 LSbs of the PSV address are
provided by the W register that contains the effective address. The MSb of the W register is not
used to form the address. Instead, the MSb specifies whether to perform a PSV access from
program space or a normal access from data memory space. If a W register effective address of
0x8000 or greater is used, the data access will occur from program memory space when PSV
is enabled. All accesses will occur from data memory when the W register effective address is
less than 0x8000.
The remaining address bits are provided by the PSVPAG register (PSVPAG<7:0>), as shown in
Figure 4-8. The PSVPAG bits are concatenated with the 15 LSbs of the W register, holding the
effective address to form a 23-bit program memory address. PSV can only be used to access
values in program memory space. Table instructions must be used to access values in the user
configuration space.
The LSb of the W register value is used as a byte select bit, which allows instructions using PSV
to operate in Byte or Word mode.
4.4.2 PSV Mapping with X and Y Data Spaces
The Y data space is located outside of the upper half of data space for most dsPIC30F variants,
such that the PSV area will map into X data space. The X and Y mapping will have an effect on
how PSV is used in algorithms.
As an example, the PSV mapping can be used to store coefficient data for Finite Impulse
Response (FIR) filter algorithms. The FIR filter multiplies each value of a data buffer containing
historical filter input data with elements of a data buffer that contains constant filter coefficients.
The FIR algorithm is executed using the MAC instruction within a REPEAT loop. Each iteration of
the MAC instruction pre-fetches one historical input value and one coefficient value to be
multiplied in the next iteration. One of the pre-fetched values must be located in X data memory
space and the other must be located in Y data memory space.
To satisfy the PSV mapping requirements for the FIR filter algorithm, the user must locate the
historical input data in the Y memory space and the filter coefficients in X memory space.

Table of Contents

Other manuals for Microchip Technology dsPIC30F