- What is static and dynamic memory in the MIPS architecture.
- What is the static data segment of memory.
- How to allocate data memory in MIPS.
- How to view the values stored in data memory using MARS.
- Loading memory using memory addresses.
- Various methods of loading data from memory into registers, including:
- Loading data values using labels
- Loading data values using register offsets
- Loading data values by modifying addresses through addition
- Loading data using 32 bit immediate values
From a MIPS assembly language programmer's point of view, there are 3 main types of memory: static, stack dynamic and heap dynamic16. Static memory is the simplest as it is defined when the program is assembled and allocated when the program begins execution. Dynamic memory is allocated while the program is running, and accessed by address offsets. This makes dynamic memory more difficult to access in a program, but much more useful.
This chapter will only cover static memory. In MIPS this will also be called data memory because it will be stored in the
.data segment of the program. Stack memory will be covered in Chapter 8 when describing general purpose subprograms, and heap memory will be covered in Chapter 9 when describing arrays. From this point forward in the text, registers will be referred to as registers, and not memory. The term memory will always refer to data which is stored outside of the CPU.
16 Note that static and dynamic memory is again an overloaded term in computer science. At a hardware level, dynamic memory is memory implemented using a capacitor and a transistor, and is normally used when a large amount of inexpensive memory is needed. Static memory is implemented using a circuit, and is more expensive. Static memory would be used in registers and possibly cache on a chip. There is absolutely no relationship between hardware level static and dynamic memory, and the way the terms are used in this chapter.