Sign in

username:

password:



Not a member?

Search c6x



Search tips

Subscribe to c6x



c6x by Keywords

AD535 | BIOS | Booting | Bootloader | C621 | C6211 | C6415 | C671 | C6711 | C6711DSK | C6713 | CCS | Chassaing | COFF | DAT | DM64 | DM642 | DMA | DSK671 | DSK6711 | EDM | EDMA | EMIF | Emulator | EVM | EVM620 | FFT | FIR | GPIO | Halting | HPI | HWI | IDK | JTAG | LDB | LDH | LDW | Linker | LMS | LOG_printf | Matlab | McBSP | MEM_alloc | MIPS | PCI | PCM3003 | Pipeline | Profiling | QDM | Reset | ROM | RTDX | Sampling | SDRAM | Stack | TEB | THS1206 | TMS320C621 | TMS320C6416 | TMS320C6711 | TMS320C6713 | UART | Vector Table | XBUS | XDS560

Discussion Groups

Discussion Groups | TMS320C6x | problem: LOAD commands

Technical discussions about the TI C6000 DSPs (including the c62x, c64x and c67x DSPs).

  

Post a new Thread

problem: LOAD commands - asha grover - Mar 2 2:53:00 2003



Hi

I am very new to this field. I have problem understanding the LOAD command
(LDB/LDH/LDW).

Can you tell me what is baseR and offsetR. How are thay used and what do they
specify?

Asha





(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )

Re: problem: LOAD commands - Andrew Nesterov - Mar 3 20:31:00 2003


Hello,

> From: asha grover <>
>
> Hi
>
> I am very new to this field. I have problem understanding the LOAD
> command (LDB/LDH/LDW).

These instructions load a byte, a halfword (2 bytes) or a word (4 bytes)
respectively into a specified register. There is also LDDW instruction
which loads a doubleword (8 bytes).

To determine which location in memory is to be loaded the instuction must
be supplyed with an address of this location. Note that C6000 is a
byte addressable machine, thus any address points to a specific byte
location.

> Can you tell me what is baseR and offsetR. How are thay used and what
> do they specify?

These two registers are used to specify the address and the
offset/increment to this address. BaseR (or base address register)
contans the adress of an entity to load and offsetR (or offset
register) contains the displacement or modification value to this
address.

Sintactically, the offset register can be enclosed either in square
brackets or parenthesis to denote relative (scaled) or absolute
(nonscaled) address modification commensurately.

Relative means here that the offset is modified as follows: for LDB it is
not modified at all, for LDH it is shfted left by 1 (effectively multiplied
by 2), for LDW it is shifted left by 2 and for LDDW it is shifted left by
3, thus scaled into the respective absolute offset (in byte units).

An absolute offset is assumed to be already written in byte units, thus
it is never shifted.

The offset register is optional and can be omitted in the instruction.

For example (for simplicity, all the pipeline/execute units relative stuff
is omitted)

MVK 100, A1 ; BaseR
MVK 2, A2 ; OffsetR

LDB *+A1[A2], A3 ; load byte at address 100+2=102
LDB *A1++[A2], A3 ; load byte at address 100
; postmodify A1 = 100+2 = 102
LDB *-A1[A2], A3 ; load byte at address 102-2=100
LDB *--A1[A2], A3 ; load byte at address 100, due to
; premodification of A1=102-2

LDW *-A1[A2],A3 ; load word at address 100-4=96
LDW *++A1[A2],A3 ; load word at address 104, due to
; premodification of A1=100+4=104

MVK 8, A2 ; new OffsetR
LDW *+A1(A2), A3 ; load word at 104+8=112

It is seen that ++ or -- modify the BaseR register for the next
instruction, while + or - only change the address in the current
instruction.

&. This simple :)

P.S. There are few more things left, address pre/post modification syntax,
5/15 bit immediate constant offsets, address alignment, D1/D2 units and
T1/T2 data paths, unaligned memory accesses, pipeline issues, memory
access wait states, but they are no more complicated than base and offset
address registers.

Best regards,

Andrew

--
Andrew V. Nesterov ()
Optimized TMS320C6000 DSP Software
Generic Digital Design, Inc. > Asha





(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )