Section 1. Programmer's Model

Section 1. Programmer's Model

1 M Programmer’s Model Section 1. Programmer’s Model HIGHLIGHTS This section of the manual contains overview information about the dsPIC30F. It contains the fol- lowing major topics: 1.1 dsPIC30F Overview....................................................................................................... 1-2 1.2 Programmer’s Model...................................................................................................... 1-3 1.2.1 Working Register Array.................................................................................................. 1-3 1.2.2 Default Working Register Selection ............................................................................... 1-3 1.2.3 Software Stack Frame Pointer ....................................................................................... 1-3 1.2.4 Software Stack Pointer................................................................................................... 1-5 1.2.5 Accumulator A, Accumulator B ...................................................................................... 1-6 1.2.6 Program Counter ........................................................................................................... 1-6 1.2.7 STATUS Register........................................................................................................... 1-7 1.2.8 Core Configuration Register .......................................................................................... 1-9 1.2.9 Shadow Registers........................................................................................................ 1-11 Note: For detailed information about the dsPIC30F architecture and core, refer to the dsPIC30F Data Sheet. 2001 Microchip Technology Inc. Advanced Information DS70030A-page 1-1 dsPIC30F Programmer’s Reference Manual 1.1 dsPIC30F Overview The dsPIC30F core is a 16-bit (data) modified Harvard architecture with an enhanced instruc- tion set including significant support for DSP. The core has a 24-bit instruction word, with a vari- able length opcode field. The program counter (PC) is 24-bits wide and addresses up to 4M x 24 bits of user program memory space. A single-cycle instruction prefetch mechanism is used to help maintain throughput and provides predictable execution. The majority of instructions execute in a single cycle and overhead free program loop constructs are supported using the DO and REPEAT instructions, both of which are interruptible at any point. The dsPIC30F has sixteen 16-bit working registers. Each of the working registers can act as a data, address or offset register. The 16th working register (W15) operates as a software stack pointer for interrupts and calls. The dsPIC30F instruction set has two classes of instructions; the MCU class of instructions and the DSP class of instructions. These two instruction classes are seamlessly integrated into the architecture and execute from a single execution unit. The instruction set includes many addressing modes and was designed for optimum C-compiler efficiency. The data space can be addressed as 32 Kwords or 64 Kbytes and is split into two blocks referred to as X and Y data memory. Each memory block has its own independent Address Generation Unit (AGU). The MCU class of instructions operate solely through the X memory AGU, which accesses the entire memory map as one linear data space. The DSP class of instructions operates through the X and Y AGUs, which splits the data address space into two parts. The X and Y data space boundary is arbitrary and device-specific. The upper 32K bytes of the data space memory map can optionally be mapped into program space at any 16K program word boundary defined by the 8-bit Data Space Program PAGe (DSPPAG) register. The program to data space mapping feature lets any instruction access pro- gram space as if it were data space. Furthermore, RAM may be connected to the program memory bus and used to extend the internal data RAM. Overhead free circular buffers (modulo addressing) are supported in both X and Y address spaces. The modulo addressing removes the software boundary checking overhead for DSP algorithms. Furthermore, the X AGU circular addressing can be used with any of the MCU class of instructions. The X AGU also supports bit reverse addressing to greatly simplify input or out- put data reordering for radix-2 FFT algorithms. The core supports inherent (no operand), relative, literal, memory direct, register direct, and register indirect addressing modes. Each instruction is associated with a predefined addressing mode group depending upon its functional requirements. As many as 6 addressing modes are supported for each instruction. For most instructions, the dsPIC30F is capable of executing a data (or program data) memory read, a working register (data) read, a data memory write and a program (instruction) memory read per instruction cycle. As a result, 3 operand instructions can be supported, allowing A+B=C operations to be executed in a single cycle. The DSP engine features a high speed 16-bit by 16-bit multiplier, a 40-bit ALU, two 40-bit satu- rating accumulators and a 40-bit bidirectional barrel shifter. The barrel shifter is capable of shift- ing a 40-bit value up to 15 bits right or up to 16-bits left in a single cycle. The DSP instructions operate seamlessly with all other instructions and have been designed for optimal real-time per- formance. The MAC instruction and other associated instructions can concurrently fetch two data operands from memory while multiplying two W registers. This requires that the data space be split for these instructions and linear for all others. This is achieved in a transparent and flex- ible manner through dedicating certain working registers to each address space. The dsPIC30F has a vectored exception scheme with 15 individually prioritized vectors. The exceptions consist of reset, 7 traps and 8 interrupts. DS70030A-page 1-2 Advanced Information 2001 Microchip Technology Inc. Section 1. Programmer’s Model 1.2 Programmer’s Model 1 The programmer’s model for the dsPIC30F is shown in Figure 1-1. Programmer All registers in the programmer’s model are memory mapped and can be manipulated directly by instructions. A description of each register is provided in Table 1-1. Model TABLE 1-1: PROGRAMMER’S MODEL REGISTER DESCRIPTIONS Register Description W0 through W15 Working register array ’ ACCA, ACCB 40-bit DSP accumulators s PC 24-bit program counter SPLIM Stack pointer limit value register TABPAG Table memory page address register DSPPAG Data space program memory page address register RCOUNT REPEAT loop count register DCOUNT DO loop count register CORCON Contains DSP engine control bits STATUS ALU and DSP engine status register 1.2.1 Working Register Array The 16 working (W) registers can function as data, address or offset registers. The function of a W register is determined by the instruction that accesses it. Byte instructions which target the working register array only effect the least significant byte of the target register. Since the working registers are memory mapped, the least and most signifi- cant bytes can be manipulated through byte wide data memory space accesses. 1.2.2 Default Working Register Selection The dsPIC30F instruction set can be divided into two instruction types: working register instruc- tions and file register instructions. The working register instructions use the working register array as data values or as addresses that point to a memory location. In contrast, file register instruc- tions operate on a specific memory address contained in the instruction opcode. File register instructions do not encode the W that is to be used for the instruction in the opcode. The default working register (WREG) for all file register instructions is defined by the WD field, CORCON<11:8>. This field is reset to 0x0, corresponding to register W0. 1.2.3 Software Stack Frame Pointer W14 has been assigned for use as a stack frame pointer with the link (LNK) and unlink (ULNK) instructions. However, W14 can be used by any instruction in the same manner as all other W registers. 2001 Microchip Technology Inc. Advanced Information DS70030A-page 1-3 dsPIC30F Programmer’s Reference Manual FIGURE 1-1: PROGRAMMER’S MODEL D15 D0 Legend W0 PUSH.S Shadow DSP Operand W1 Registers DO Shadow W2 W3 REPEAT Shadow W4 W5 DSP Address Registers W6 W7 Working Registers W8 W9 W10 W11 W12 W13 Frame Pointer/W14 Stack Pointer/W15* 0 * W15[0] & SPLIM[0] always = 0 W15 & SPLIM not shadowed SPLIM* 0 Stack Pointer Limit Register AD39AD31 AD15 AD0 DSP AccA Accumulators AccB PC23 PC0 0 0 Program Counter 7 0 TABPAG Data Table Page Address 7 0 DSPPAG Data Space Prog Page Address 15 0 RCOUNT REPEAT Loop Counter 15 0 DCOUNT DO Loop Counter 21 0 DOSTART DO Loop Start Address 21 0 DOEND DO Loop End Address 15 0 CORCON Core Configuration Register OA OB SA SB OAB SAB DA RA SZ NOVZDC C STATUS Register SRL DS70030A-page 1-4 Advanced Information 2001 Microchip Technology Inc. Section 1. Programmer’s Model 1.2.4 Software Stack Pointer 1 W15 serves as a dedicated software stack pointer, and will be automatically modified by excep- Programmer tion processing, subroutine calls and returns. However, W15 can be referenced by any instruc- tion in the same manner as all other W registers. This simplifies reading, writing and manipulating the stack pointer (e.g. creating stack frames). Model Note: In order to protect against misaligned stack accesses, W15[0] is always clear. ’ s W15 is initialized to 0x0200 during a reset. This address

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    12 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us