MIPS Exceptions

Introduction In the MIPS architecture, an exception is a general label for interrupts and errors that require the processor to temporarily abandon sequential execution. An interrupt is an asynchronous request from an external device (e.g., timer, network), while a trap is a synchronous request from software (e.g., a system call). Errors detected inside the CPU (e.g., illegal instructions, misaligned accesses) are also treated as exceptions. When an exception occurs, the CPU saves the current program counter (PC) and status in dedicated registers, enters kernel mode, and jumps to an exception handler. ...

2025-10-17 · 5 min · 1033 words · ssdxx

MIPS Assembly and Simulator

The Complete Assembly Code Structure The first thing I’ve noticed about the assembly code file is the structure. Based on the comments, there are two parts of code segment and data segment. Code segment: .text .align # align number (not necessary) .globl [func name] (not necessary) [func name]: # something Data segment: .data [declaration of the data schema] name: type value Pseudoinstructions about Load Data Besides the lw instruction that we’ve learned in class, the simple assembly code uses li and la. After searching, I learned that these are some pseudoinstructions for loading. ...

2025-10-17 · 3 min · 524 words · ssdxx