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

Because registers are scarce, it is important to be cautious and reuse them as temporary storage. Generally, it is the job of an optimizing compiler to minimize register footprint. However, when we work with larger amounts of data, we have to “spill” out of the registers and over to memory.

RISC-V defines instructions for accessing memory. Recall our basic computer layout (Figure 1). The processor communicates with memory by issuing addresses to read or write data:

2RISC-V is Load-Store

RISC-V is known as a load-store architecture[2]—referring to how it defines memory access and operations on data (Figure 1).

"TODO"

Figure 1:Load and store between register and memory.

RISC-V only permits operations on data in registers. Any operations on data from memory must involve multiple instructions:

  1. Load in the data from memory into registers

  2. Execute the operation on registers in the processor.

  3. (if needed) Store the data back to memory.

RISC-V defines a set of load and store instructions for moving data between memory and registers. Let’s check these instructions out!

Footnotes
  1. This lecture video starts with an amusing egg test. I personally believe it will help you grasp the concepts of the P&H textbook, but I haven’t tried it out yet.

  2. Other models exist, often in CISC land. The x86 ISA permits arithmetic operations where one operand is in memory and the other is in a register.