Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

1Learning Outcomes

No video. We recommend pulling up the memory section of the RISC-V Green Card.

2Example 1

Consider the assembly code:

li x11 0x93F5 
sw x11 0(x5)
lb x12 1(x5)

Suppose that the memory layout starts as in Figure 1. After executing these instructions, what is in x12?

"TODO"

Figure 1:Starting memory layout for Example 1.

Hint: See the section on pseudoinstructions like li.

2.1Example 2

Suppose that x and y are int * pointers whose values are in registers x3 and x5.

How do we translate the statement *x = *y; into assembly?

Consider the following instructions:

  1. add x3 x5 zero

  2. add x5 x3 zero

  3. lw x3 0(x5)

  4. lw x5 0(x3)

  5. lw x8 0(x5)

  6. sw x8 0(x3)

  7. lw x5 0(x8)

  8. sw x3 0(x8)

And consider the following choices: