# RISC-V: How do you store specific values in large addresses in Venus (RISC-V sim)?

I'm new to RISC-V and I'm having trouble understanding how one would store specific values in large addresses. For example, if I wanted to store the value 5 in 0x12312312, how would you go about that?

• using store statement in RISC-V ISA of course. Nov 29 '21 at 10:39
• Can you be more specific? The largest value you can make a register via the addi instruction is 2047. Addresses in RISC-V are 32 bits. Nov 29 '21 at 10:43

It requires two steps. "Load upper immediate":

Images source: "The RISC-V Instruction Set Manual Volume I: Unprivileged ISA"

Example to build any constant/address: a5 = 0x12345678

lui a5,0x12345000(305418240)


For values with all 12 LSbits = 0, only lui is required. For small values, addi to register 0 is enough.

   lw   a5,0(a3)  -> load the base address, stored in (a3) to a5