Access high memory address (+13bits address) in ARC

91 views Asked by At

I'm told I have to load information that is stored in the memory position 0xA033C000. That position in binary is written with more than 13 bits (10100000001100111100000000000000). Yet the instruction format for load in ARC states that if I were to use a constant to reach that address, that constant must be 13 bits long (or lower, completed with 0s).

How can I get there, then?

1

There are 1 answers

1
phuclv On BEST ANSWER

I don't know SPARC assembly but it must have load indirect from address in register. Just load the constant to register and then load memory from that constant address


Update demo:

void set_register(int x)
{
    volatile int* const reg = (volatile int*)0xA033C000;
    *reg = x;
}

Assembly output

set_register:
        save %sp, -96, %sp
        sethi 2624752, %i1
        st %i0, [%i1]
        ret
        restore