The LXRE Processor

For this class, you'll be designing a processor that implements the LXRE (pronounced Luxury) instruction set. This instruction set is based on the DLX Processor, which in turn is based on MIPS. The instruction set was chosen to be on the simpler end of processors, while still being very similar to actual instruction sets.

Overview

The LXRE processor uses a RISC architecture very similar to the MIPS processor that you have discussed in E85. As with MIPS, all instructions are 32 bits long, and to load a 32 bit immediate requires two instructions. The LXRE processor also has 32 32-bit registers, as in MIPS register 0 is always 0, and register 31 is the fixed destination for jump and link instructions. In addition to the register file, the LXRE processor also has a 32 bit program counter.

Instruction Set

Instruction Formats

In the LXRE machine code there are three different instruction types, R-type, I-type, and J-type. All formats specify a type followed by an opcode, but the information in the remainder of the format varies by format. R-type (register) instructions specify three registers in the instruction - the destination register followed by two source registers. I-type (immediate) instructions specify one destination register, on source register, and a 16-bit immediate value. J-type (jump) instructions specify a single 26 bit signed value.

FormatBits
Type 31-26 25-21 20-16 15-11 10- 0
R-type 0x0 RD RS RT ROP
I-type opcode RD RS immediate
J-type opcode value

Instructions

The following table lists the instructions that your implementation of LXRE must support. The operations for each opcode are specfied using C syntax and operators. The prefix (unsigned) before immediate values indicates that the immediate 0-padded, otherwise it is sign extended.

NameTypeOpcodeOperation (In C)
ADD R0x20RD = RS + RT
ADDII0x08RD = RS + IMM
AND R0x24RD = RS & RT
ANDII0x0CRD = RS & (unsigned)RT
BEQZI0x04PC += (RS == 0 ? IMM : 0)
BNEZI0x05PC += (RS != 0 ? IMM : 0)
J J0x02PC += IMM
JAL J0x03R31 = PC + 4; PC += IMM
JALRI0x13R31 = PC + 4; PC = RS
JR I0x12PC = RS
LHI I0x0FRD = IMM << 16
LW I0x23RD = MEM[RS + IMM]
MUL R0x30RD = RS * RT
OR R0x25RD = RS | RT
ORI I0x0DRD = RS | (unsigned)IMM
SEQ R0x28RD = RS == RT
SEQII0x18RD = RS == IMM
SLE R0x2CRD = RS <= RT
SLEII0x1CRD = RS <= IMM
SLL R0x04RD = RS << (RT % 8)
SLLII0x14RD = RS << (IMM % 8)
SLT R0x2ARD = RS < RT
SLTII0x1ARD = RS < IMM
SNE R0x29RD = RS != RT
SNEII0x19RD = RS != IMM
SRA R0x07RD = RS >>> (RT % 8)
SRAII0x17RD = RS >>> (IMM % 8)
SRL R0x06RD = RS >> (RT % 8)
SRLII0x16RD = RS >> (IMM % 8)
SUB R0x22RD = RS - RT
SUBII0x0ARD = RS - IMM
SW I0x2BMEM[RS + IMM] = RD
XOR R0x26RD = RS ^ RT
XORII0x0ERD = RS ^ (unsigned)IMM
Note that the SW instruction uses RD as a source register, not a destination register. JR and JALR discard RD and IMM.

External Memory

The LXRE Processor uses a simple memory interface and uses memory mapped IO for input and output. The memory system has two read ports and one write port. For each port there is an address bus, data bus, valid cpu and valid mem signals.

Writing

Reading

Segmentation and Memory Mapped IO

The memory is segmented in the C-simulator for debugging purposes, additionally some memory locations are reserved for memory IO.