Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- TMS320C2x DSP - the structure of the tms320c2x memory map is programmable and http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
      The structure of the TMS320C2x memory map is programmable and
      can vary for each application.  Instructions are provided for
      moving blocks of data or program memory, configuring a block
      of data on chip data RAM as program memory, and defining part
      of external data memory as global. Explanations and examples
      of moving, configuring and manipulating memory are provided.

BLOCK MOVES
      Since the TMS320C2x directly addresses a large amount of memory,
      blocks of data or program can be stored off-chip in slow memories
      and then loade on-chip for faster execution. Data can also be moved
      from on-chip to off-chip for storage or multi-processor data
      transfers.

      The BLKD and BLKP instructions facilitate memory-to-memory block
      moves on the TMS320C2x. The BLKD instruction moves a block within
      data memory:

*  THIS ROUTINE USES THE BLKD INSTRUCTION TO MOVE A BLOCK OF
*  EXTERNAL DATA MEMORY (DATA PAGES 8 AND 9) TO INTERNAL BLOCK
*  B1 (DATA PAGES 6 AND 7).
*
MOVED       LARP  AR2
            LRLK  AR2,>300    ; DESTINATION IS BLOCK B1 IN RAM.
            RPTK  255         ; REPEAT NEXT INSTRUCTION 256 TIMES.
            BLKD  >400,*+     ; MOVE EXTERNAL BLOCK TO B1.
            RET               ; RETURN TO THE MAIN PROGRAM.

      For systems that have external program memory but no external data
      memory, BLKP can be used to move program memory blocks into data
      memory:

*  THIS ROUTINE USES THE BLKP INSTRUCTION TO MOVE DATA VALUES
*  FROM PROGRAM MEMORY INTO DATA MEMORY. SPECIFICALLY, THE
*  VALUES IN LOCATIONS 2, 3, 4, AND 5 IN PROGRAM MEMORY ARE
*  MOVED TO LOCATIONS 512, 513, 514, AND 515 IN DATA MEMORY.
*
MOVEP       LARP  AR2         ; SET REFERENCE FOR INDIRECT ADDRESSING.
            LRLK  AR2,512     ; LOAD BEGINNING OF BLOCK B0 IN AR2.
            RPTK  3           ; SET UP LOOP.
            BLKP  >2,*+       ; PUT DATA INTO DATA RAM.
            RET               ; RETURN TO MAIN PROGRAM.

      Another method for transferring data from program memory into data
      memory makes use of the TBLR instruction. By using the TBLR
      instruction, a calculated, rather than a predetermined, location of
      a block of data in program memory may be specified for transfer:

*
* THIS ROUTINE USES THE TBLR INSTRUCTION TO MOVE DATA VALUES
* FROM PROGRAM MEMORY INTO DATA MEMORY.  BY USING THIS
* ROUTINE THE CALLER CAN SPECIFY THE PROGRAM MEMORY LOCATION
* IN THE ACCUMULATOR FROM WHICH DATA IS TO BE MOVED TO A
* SPECIFIC DATA MEMORY LOCATION.
*
* ASSUME THE ACCUMULATOR CONTAINS THE ADDRESS IN PROGRAM
* MEMORY FROM WHICH TO TRANSFER DATA.
*
TABLER      LARP  AR3
            LRLK  AR3,0380h   ; DESTINATION ADDRESS PAGE 7.
            RPTK  127         ; TRANSFER 128 VALUES.
            TBLR  *+          ; MOVE DATA INTO DATA RAM.
            RET               ; RETURN TO CALLING PROGRAM.

      In cases where systems require that temporary storage be allocated
      in the program memory, TBLW can be used to transfer data from
      internal data memory to external program memory:

*
* THIS ROUTINE USES THE TBLW INSTRUCTION TO MOVE DATA FROM
* INTERNAL DATA MEMORY TO EXTERNAL PROGRAM MEMORY.  THE
* CALLING ROUTINE MUST SPECIFY THE DESTINATION PROGRAM
* MEMORY ADDRESS IN THE ACCUMULATOR.
*
* ASSUME THE ACCUMULATOR CONTAINS THE ADDRESS IN PROGRAM
* MEMORY INTO WHICH THE DATA IS TRANSFERED.
*
TABLEW      LARP  AR4
            LRLK  AR4,0380h   ; SOURCE ADDRESS PAGE 7.
            RPTK  127         ; TRANSFER 128 VALUES.
            TBLW  *+          ; MOVE DATA TO EXTERNAL PROGRAM RAM.
            RET               ; RETURN TO CALLING PROGRAM.


      The IN and OUT instructions are used to transfer data between the
      data memory and the I/O space:


*
* THIS ROUTINE USES THE IN INSTRUCTION TO MOVE DATA VALUES
* FROM THE I/O SPACE INTO DATA MEMORY.    DATA ACCESSED FROM
* I/O PORT 15 IS TRANSFERED TO SUCCESSIVE MEMORY LOCATIONS
* ON DATA PAGE 5.
*
INPUT       LARP  AR2
            LRLK  AR2,02c0h   ; DESTINATION ADDRESS - PAGE 5.
            RPTK  63          ; TRANSFER 64 VALUES.
            IN    *+,PA15     ; MOVE DATA INTO DATA RAM.
            RET               ; RETURN TO CALLING PROGRAM.


*
* THIS ROUTINE USES THE OUT INSTRUCTION TO MOVE DATA VALUES
* FROM THE DATA MEMORY TO THE I/O SPACE.  DATA IS TRANSFERED
* TO I/O PORT 8 FROM SUCCESSIVE MEMORY LOCATIONS ON DATA
* PAGE 4.
*
OUTPUT      LARP  AR4
            LRLK  AR4,0200h   ; SOURCE ADDRESS - PAGE 4.
            RPTK  63          ; TRANSFER 64 VALUES.
            OUT   *+,PA8      ; MOVE DATA INTO DATA RAM.
            RET               ; RETURN TO CALLING PROGRAM.

See Also: on-chip RAM

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson