mars.simulator
Class Exceptions

java.lang.Object
  |
  +--mars.simulator.Exceptions

public class Exceptions
extends java.lang.Object

Represents an error/interrupt that occurs during execution (simulation).


Field Summary
static int ADDRESS_EXCEPTION_LOAD
           
static int ADDRESS_EXCEPTION_STORE
           
static int ARITHMETIC_OVERFLOW_EXCEPTION
           
static int BREAKPOINT_EXCEPTION
           
static int DIVIDE_BY_ZERO_EXCEPTION
           
static int EXTERNAL_INTERRUPT
          The exception number is stored in coprocessor 0 cause register ($13)
static int FLOATING_POINT_OVERFLOW
           
static int FLOATING_POINT_UNDERFLOW
           
static int RESERVED_INSTRUCTION_EXCEPTION
           
static int SYSCALL_EXCEPTION
           
static int TRAP_EXCEPTION
           
 
Constructor Summary
Exceptions()
           
 
Method Summary
static void setRegisters(int cause)
          Given MIPS exception cause code, will place that code into coprocessor 0 CAUSE register ($13), set the EPC register to "current" program counter, and set Exception Level bit in STATUS register.
static void setRegisters(int cause, int addr)
          Given MIPS exception cause code and bad address, place the bad address into VADDR register ($8) then call overloaded setRegisters with the cause code to do the rest.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXTERNAL_INTERRUPT

public static final int EXTERNAL_INTERRUPT
The exception number is stored in coprocessor 0 cause register ($13)

See Also:
Constant Field Values

ADDRESS_EXCEPTION_LOAD

public static final int ADDRESS_EXCEPTION_LOAD
See Also:
Constant Field Values

ADDRESS_EXCEPTION_STORE

public static final int ADDRESS_EXCEPTION_STORE
See Also:
Constant Field Values

SYSCALL_EXCEPTION

public static final int SYSCALL_EXCEPTION
See Also:
Constant Field Values

BREAKPOINT_EXCEPTION

public static final int BREAKPOINT_EXCEPTION
See Also:
Constant Field Values

RESERVED_INSTRUCTION_EXCEPTION

public static final int RESERVED_INSTRUCTION_EXCEPTION
See Also:
Constant Field Values

ARITHMETIC_OVERFLOW_EXCEPTION

public static final int ARITHMETIC_OVERFLOW_EXCEPTION
See Also:
Constant Field Values

TRAP_EXCEPTION

public static final int TRAP_EXCEPTION
See Also:
Constant Field Values

DIVIDE_BY_ZERO_EXCEPTION

public static final int DIVIDE_BY_ZERO_EXCEPTION
See Also:
Constant Field Values

FLOATING_POINT_OVERFLOW

public static final int FLOATING_POINT_OVERFLOW
See Also:
Constant Field Values

FLOATING_POINT_UNDERFLOW

public static final int FLOATING_POINT_UNDERFLOW
See Also:
Constant Field Values
Constructor Detail

Exceptions

public Exceptions()
Method Detail

setRegisters

public static void setRegisters(int cause)
Given MIPS exception cause code, will place that code into coprocessor 0 CAUSE register ($13), set the EPC register to "current" program counter, and set Exception Level bit in STATUS register.

Parameters:
cause - The cause code (see Exceptions for a list)

setRegisters

public static void setRegisters(int cause,
                                int addr)
Given MIPS exception cause code and bad address, place the bad address into VADDR register ($8) then call overloaded setRegisters with the cause code to do the rest.

Parameters:
cause - The cause code (see Exceptions for a list). Should be address exception.
addr - The address that caused the exception.