Skip to main content

IAR Embedded Workbench for RH850 3.20.x

The huge memory access method

In this section:

It is not possible to access an arbitrary location using only one instruction. In the RH850microcontroller, this is solved by using the MOVHI instruction to move part of the memory location to access to a temporary register.

For example, to store a variable x in huge memory, the following assembler code is used:

        movhi   hi1(x), r0, r6
        st.w    R1, lw1(x)[r6]
Examples

Address of:

        mov       MyVar,r1

Accessing a global variable:

        movhi       hi1(MyVar),r0,r6
        ld.b        lw1(MyVar)[r6],r6

Accessing a global array using an unknown index:

        movhi       hi1(MyArr),r1,r7
        ld.b        lw1(MyArr)[r7],r7

Accessing a structure using a pointer:

        ld.b        (4)[r6],r1