Class ISA

java.lang.Object
  extended by ISA

public class ISA
extends java.lang.Object

Class containing the Larc ISA.


Field Summary
static int ADD
          The opcode of an add defined by the ISA.
static int AND
          The opcode of the extended bitwise AND defined by the assembly interface.
static int B
          The opcode of the extended unconditional branch defined by the assembly interface.
static int BEQ
          The opcode of the extended branch equal to defined by the assembly interface.
static int BEQZ
          The opcode of the branch equal to defined by the ISA.
static int BGE
          The opcode of the extended branch greater than or equal to defined by the assembly interface.
static int BGEZ
          The opcode of the extended branch greater than or equal to zero defined by the assembly interface.
static int BGT
          The opcode of the extended branch greater than defined by the assembly interface.
static int BGTZ
          The opcode of the extended branch greater than zero defined by the assembly interface.
static int BLE
          The opcode of the extended branch less than or equal to defined by the assembly interface.
static int BLEZ
          The opcode of the extended branch less than or equal to zero defined by the assembly interface.
static int BLT
          The opcode of the extended branch less than defined by the assembly interface.
static int BLTZ
          The opcode of the extended branch not equal to defined by the ISA.
static int BNE
          The opcode of the extended branch not equal to defined by the assembly interface.
static int BNEZ
          The opcode of the branch not equal to zero defined by the ISA.
static int DIV
          The opcode of the divide defined by the ISA.
static int JAL
          The opcode of the extended jump and link defined by the assembly interface.
static int JALR
          The opcode of the jump and link register defined by the ISA.
static int JR
          The opcode of the extended jump defined by the assembly interface.
static int LA
          The opcode of the extended load address defined by the assembly interface.
static int LI
          The opcode of the load immediate defined by the ISA.
static int LUI
          The opcode of the load upper immediate defined by the ISA.
static int LW
          The opcode of the memory load defined by the ISA.
static int MEM_SIZE
          Size of memory, which is 2^width
static int MOVE
          The opcode of the extended branch not equal to zero defined by the assembly interface.
static int MUL
          The opcode of the multiply defined by the ISA.
static int NEG
          The opcode of the extended negation defined by the assembly interface.
static int NOR
          The opcode of the bitwise NOR defined by the ISA.
static int NOT
          The opcode of the extended bitwise NOT defined by the assembly interface.
static int NUM_REGS
          Number of total registers
static int OR
          The opcode of the extended bitwise OR defined by the assembly interface.
static java.lang.String REG_A0
          Argument register 0 (not preserved across subroutine calls)
static java.lang.String REG_A1
          Argument register 1 (not preserved across subroutine calls)
static java.lang.String REG_AT0
          Assembler temporary 0 register
static java.lang.String REG_AT1
          Assembler temporary 1 register
static java.lang.String REG_K0
          Kernel register 0
static java.lang.String REG_K1
          Kernel register 1
static int REG_MAX_UNSIGNED_VALUE
          Maximum unsigned value that can be stored in a register
static int REG_MAX_VALUE
          Maximum value (signed) that can be stored in a register
static int REG_MIN_VALUE
          Minimum value (signed) that can be stored in a register
static java.lang.String REG_RA
          Return address register
static java.lang.String REG_S0
          Caller-saved register 0 (preserved across subroutine calls)
static java.lang.String REG_S1
          Caller-saved register 1 (preserved across subroutine calls)
static java.lang.String REG_S2
          Caller-saved register 2 (preserved across subroutine calls)
static java.lang.String REG_SP
          Stack pointer register
static java.lang.String REG_T0
          Callee-saved register 0 (not preserved across subroutine calls)
static java.lang.String REG_T1
          Callee-saved register 1 (not preserved across subroutine calls)
static java.lang.String REG_T2
          Callee-saved register 2 (not preserved across subroutine calls)
static java.lang.String REG_V0
          Result register
static java.lang.String REG_ZERO
          Zero register
static int REM
          The opcode of the extended remainder defined by the assembly interface.
static int SEQ
          The opcode of the extended xor defined by the assembly interface.
static int SGE
          The opcode of the extended xor defined by the assembly interface.
static int SGT
          The opcode of the extended xor defined by the assembly interface.
static int SLE
          The opcode of the extended xor defined by the assembly interface.
static int SLL
          The opcode of the shift left logical defined by the ISA.
static int SLT
          The opcode of the set on less than defined by the ISA.
static int SNE
          The opcode of the extended xor defined by the assembly interface.
static int SRL
          The opcode of the shift right logical defined by the ISA.
static int SUB
          The opcode of a subtract defined by the ISA.
static int SW
          The opcode of the memory store defined by the ISA.
static int SYSCALL
          The opcode of the system call defined by the ISA.
static int SYSRETN
          The opcode the system return instruction (only used by OS).
static int WIDTH
          Processor width (number of bits stored in a single register/memory word, also addressability)
static int XOR
          The opcode of the extended xor defined by the assembly interface.
 
Constructor Summary
ISA()
           
 
Method Summary
static int getReg(java.lang.String reg)
          Converts a string representation of a register into an integer representation.
static java.lang.String getRegName(int reg)
          Converts a register number into the register name.
static boolean isKernelReg(java.lang.String reg)
          Is a kernel register (k0 or k1)?
static boolean isReservedReg(java.lang.String reg)
          Is a reserved assembler register (at0 or at1)?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WIDTH

public static final int WIDTH
Processor width (number of bits stored in a single register/memory word, also addressability)

See Also:
Constant Field Values

NUM_REGS

public static final int NUM_REGS
Number of total registers

See Also:
Constant Field Values

REG_MIN_VALUE

public static final int REG_MIN_VALUE
Minimum value (signed) that can be stored in a register

See Also:
Constant Field Values

REG_MAX_VALUE

public static final int REG_MAX_VALUE
Maximum value (signed) that can be stored in a register

See Also:
Constant Field Values

REG_MAX_UNSIGNED_VALUE

public static final int REG_MAX_UNSIGNED_VALUE
Maximum unsigned value that can be stored in a register

See Also:
Constant Field Values

MEM_SIZE

public static final int MEM_SIZE
Size of memory, which is 2^width

See Also:
Constant Field Values

ADD

public static final int ADD
The opcode of an add defined by the ISA.

See Also:
Constant Field Values

SUB

public static final int SUB
The opcode of a subtract defined by the ISA.

See Also:
Constant Field Values

MUL

public static final int MUL
The opcode of the multiply defined by the ISA.

See Also:
Constant Field Values

DIV

public static final int DIV
The opcode of the divide defined by the ISA.

See Also:
Constant Field Values

SLL

public static final int SLL
The opcode of the shift left logical defined by the ISA.

See Also:
Constant Field Values

SRL

public static final int SRL
The opcode of the shift right logical defined by the ISA.

See Also:
Constant Field Values

NOR

public static final int NOR
The opcode of the bitwise NOR defined by the ISA.

See Also:
Constant Field Values

SLT

public static final int SLT
The opcode of the set on less than defined by the ISA.

See Also:
Constant Field Values

LI

public static final int LI
The opcode of the load immediate defined by the ISA.

See Also:
Constant Field Values

LUI

public static final int LUI
The opcode of the load upper immediate defined by the ISA.

See Also:
Constant Field Values

BEQZ

public static final int BEQZ
The opcode of the branch equal to defined by the ISA.

See Also:
Constant Field Values

BNEZ

public static final int BNEZ
The opcode of the branch not equal to zero defined by the ISA.

See Also:
Constant Field Values

LW

public static final int LW
The opcode of the memory load defined by the ISA.

See Also:
Constant Field Values

SW

public static final int SW
The opcode of the memory store defined by the ISA.

See Also:
Constant Field Values

JALR

public static final int JALR
The opcode of the jump and link register defined by the ISA.

See Also:
Constant Field Values

SYSCALL

public static final int SYSCALL
The opcode of the system call defined by the ISA.

See Also:
Constant Field Values

SYSRETN

public static final int SYSRETN
The opcode the system return instruction (only used by OS).

See Also:
Constant Field Values

LA

public static final int LA
The opcode of the extended load address defined by the assembly interface.

See Also:
Constant Field Values

MOVE

public static final int MOVE
The opcode of the extended branch not equal to zero defined by the assembly interface.

See Also:
Constant Field Values

NEG

public static final int NEG
The opcode of the extended negation defined by the assembly interface.

See Also:
Constant Field Values

REM

public static final int REM
The opcode of the extended remainder defined by the assembly interface.

See Also:
Constant Field Values

NOT

public static final int NOT
The opcode of the extended bitwise NOT defined by the assembly interface.

See Also:
Constant Field Values

OR

public static final int OR
The opcode of the extended bitwise OR defined by the assembly interface.

See Also:
Constant Field Values

AND

public static final int AND
The opcode of the extended bitwise AND defined by the assembly interface.

See Also:
Constant Field Values

XOR

public static final int XOR
The opcode of the extended xor defined by the assembly interface.

See Also:
Constant Field Values

SLE

public static final int SLE
The opcode of the extended xor defined by the assembly interface.

See Also:
Constant Field Values

SGT

public static final int SGT
The opcode of the extended xor defined by the assembly interface.

See Also:
Constant Field Values

SGE

public static final int SGE
The opcode of the extended xor defined by the assembly interface.

See Also:
Constant Field Values

SEQ

public static final int SEQ
The opcode of the extended xor defined by the assembly interface.

See Also:
Constant Field Values

SNE

public static final int SNE
The opcode of the extended xor defined by the assembly interface.

See Also:
Constant Field Values

B

public static final int B
The opcode of the extended unconditional branch defined by the assembly interface.

See Also:
Constant Field Values

BLTZ

public static final int BLTZ
The opcode of the extended branch not equal to defined by the ISA.

See Also:
Constant Field Values

BLEZ

public static final int BLEZ
The opcode of the extended branch less than or equal to zero defined by the assembly interface.

See Also:
Constant Field Values

BGTZ

public static final int BGTZ
The opcode of the extended branch greater than zero defined by the assembly interface.

See Also:
Constant Field Values

BGEZ

public static final int BGEZ
The opcode of the extended branch greater than or equal to zero defined by the assembly interface.

See Also:
Constant Field Values

BEQ

public static final int BEQ
The opcode of the extended branch equal to defined by the assembly interface.

See Also:
Constant Field Values

BNE

public static final int BNE
The opcode of the extended branch not equal to defined by the assembly interface.

See Also:
Constant Field Values

BLT

public static final int BLT
The opcode of the extended branch less than defined by the assembly interface.

See Also:
Constant Field Values

BLE

public static final int BLE
The opcode of the extended branch less than or equal to defined by the assembly interface.

See Also:
Constant Field Values

BGT

public static final int BGT
The opcode of the extended branch greater than defined by the assembly interface.

See Also:
Constant Field Values

BGE

public static final int BGE
The opcode of the extended branch greater than or equal to defined by the assembly interface.

See Also:
Constant Field Values

JR

public static final int JR
The opcode of the extended jump defined by the assembly interface.

See Also:
Constant Field Values

JAL

public static final int JAL
The opcode of the extended jump and link defined by the assembly interface.

See Also:
Constant Field Values

REG_ZERO

public static final java.lang.String REG_ZERO
Zero register

See Also:
Constant Field Values

REG_V0

public static final java.lang.String REG_V0
Result register

See Also:
Constant Field Values

REG_A0

public static final java.lang.String REG_A0
Argument register 0 (not preserved across subroutine calls)

See Also:
Constant Field Values

REG_A1

public static final java.lang.String REG_A1
Argument register 1 (not preserved across subroutine calls)

See Also:
Constant Field Values

REG_T0

public static final java.lang.String REG_T0
Callee-saved register 0 (not preserved across subroutine calls)

See Also:
Constant Field Values

REG_T1

public static final java.lang.String REG_T1
Callee-saved register 1 (not preserved across subroutine calls)

See Also:
Constant Field Values

REG_T2

public static final java.lang.String REG_T2
Callee-saved register 2 (not preserved across subroutine calls)

See Also:
Constant Field Values

REG_S0

public static final java.lang.String REG_S0
Caller-saved register 0 (preserved across subroutine calls)

See Also:
Constant Field Values

REG_S1

public static final java.lang.String REG_S1
Caller-saved register 1 (preserved across subroutine calls)

See Also:
Constant Field Values

REG_S2

public static final java.lang.String REG_S2
Caller-saved register 2 (preserved across subroutine calls)

See Also:
Constant Field Values

REG_SP

public static final java.lang.String REG_SP
Stack pointer register

See Also:
Constant Field Values

REG_RA

public static final java.lang.String REG_RA
Return address register

See Also:
Constant Field Values

REG_AT0

public static final java.lang.String REG_AT0
Assembler temporary 0 register

See Also:
Constant Field Values

REG_AT1

public static final java.lang.String REG_AT1
Assembler temporary 1 register

See Also:
Constant Field Values

REG_K0

public static final java.lang.String REG_K0
Kernel register 0

See Also:
Constant Field Values

REG_K1

public static final java.lang.String REG_K1
Kernel register 1

See Also:
Constant Field Values
Constructor Detail

ISA

public ISA()
Method Detail

getReg

public static int getReg(java.lang.String reg)
Converts a string representation of a register into an integer representation. Examples: $4 => 4, $zero => 0, $sp => 10

Parameters:
reg - the register name
Returns:
register as an int

getRegName

public static java.lang.String getRegName(int reg)
Converts a register number into the register name. Examples: $v0 => 1, $0 => 0, $sp => 10

Parameters:
reg - the register identifier
Returns:
register name

isReservedReg

public static boolean isReservedReg(java.lang.String reg)
Is a reserved assembler register (at0 or at1)?

Parameters:
reg - the register name
Returns:
boolean indicating whether it is reserved

isKernelReg

public static boolean isKernelReg(java.lang.String reg)
Is a kernel register (k0 or k1)?

Parameters:
reg - the register name
Returns:
boolean indicating whether it is a kernel register