Programmer's View

Introduction

Before we begin programming in MIPS, we need to get a view of what the CPU and memory looks like to the MIPS programmer. This view is simplified compared to the actual CPU. That is, there are details of the CPU that are hidden from the ISA programmer.

Is it good that these details are hidden? Most would say yes. You want to expose enough of the hardware, so efficient programs can be written, but not so much that it might inhibit future enhancement of the CPU.

This is what abstraction is all about. Providing the user with the interface they need, and hiding away implementation details. By hiding such details, once can try to improve the speed of a CPU. Thus, such details as the cache and pipeline are not something the MIPS programmer is aware about.

Registers

MIPS has 32 integer registers. Each register can store 32 bits. The registers are labeled $r0 through $r31. Some of the registers are special:

There are 32 floating point registers, but for the most part we won't talk that much about them. You can read about them at your own leisure. These registers are used to perform floating point operations.

There are two other integer registers called HI and LO, which are used to store the upper and lower 32 bits of an integer multiply instruction. Multiplying two 32 bit ints can create a 64 bit result.

Memory

MIPS programs can access 32 bit addresses in memory. Recall that memory is slow to access, while registers are fast to access.

Web Accessibility