DDCA Ch6 - Part 4: RISC-V Memory Instructions
Operands Stored in Memory
In this section, the video discusses how operands are stored in memory, highlighting the difference between word addressable and byte addressable memory.
Word Addressable Memory
- Word addressable memory stores each 32-bit word of data at a unique address.
- Each word has a specific location, like word address zero containing data such as "a b c d e f 7 8."
- Regular instructions like add and subtract operate on registers, not directly on memory.
- To work with memory data, a load instruction is used to read data from memory into a register.
Byte Addressable Memory
- Most computers use byte addressable memory where each byte has its unique address.
- Load instructions can access bytes as well as words in byte-addressable systems.
- Words in processors are typically four bytes long, with each word's address being a multiple of four bytes.
- Byte addresses within words are accessed by multiplying the word's address by four.
Example: Reading Data from Memory
This section provides an example scenario of reading data from memory using load instructions in a byte-addressable system.
- To read the second word from memory (address 8), the correct code on RISC-V would be:
load word s3 gets eight parentheses zero.