CS552 Course Wiki: Spring 2021 | Main »
WISC-SP13 Instruction Set Architecture |
|
WISC-SP13 Instruction Set Architecture Specification On this page... (hide) 1. Instructions Summary
2. FormatsWISC-SP13 supports instructions in four different formats: J-format, 2 I-formats, and the R-format. These are described below. 2.1 J-formatThe J-format is used for jump instructions that need a large displacement. J-Format
Jump InstructionsThe Jump instruction loads the PC with the value found by adding the PC of the next instruction (PC+2, not PC+4 as in MIPS) to the sign-extended displacement. The Jump-And-Link instruction loads the PC with the same value and also saves the address of the next sequential instruction (i.e., PC+2) in the link register R7. The syntax of the jump instructions is:
2.2 I-formatI-format instructions use either a destination register, a source register, and a 5-bit immediate value; or a destination register and an 8-bit immediate value. The two types of I-format instructions are described below. I-format 1 InstructionsI-format 1
The I-format 1 instructions include XOR-Immediate, ANDN-Immediate, Add-Immediate, Subtract-Immediate, Rotate-Left-Immediate, Shift-Left-Logical-Immediate, Rotate-Right-Immediate, Shift-Right-Logical-Immediate, Load, Store, and Store with Update. The ANDNI instruction loads register Rd with the value of the register Rs AND-ed with the one's complement of the zero-extended immediate value. (It may be thought of as a bit-clear instruction.) ADDI loads register Rd with the sum of the value of the register Rs plus the sign-extended immediate value. SUBI loads register Rd with the result of subtracting register Rs from the sign-extended immediate value. (That is, immed - Rs, not Rs - immed.) Similar instructions have similar semantics, i.e. the logical instructions have zero-extended values and the arithmetic instructions have sign-extended values. For Load and Store instructions, the effective address of the operand to be read or written is calculated by adding the value in register Rs with the sign-extended immediate value. The value is loaded to or stored from register Rd. The STU instruction, Store with Update, acts like Store but also writes Rs with the effective address. The syntax of the I-format 1 instructions is:
I-format 2 InstructionsI-format 2
The Load Byte Immediate instruction loads Rs with a sign-extended 8 bit immediate value. The Shift-and-Load-Byte-Immediate instruction shifts Rs 8 bits to the left, and replaces the lower 8 bits with the immediate value. The format of these instructions is:
The Jump-Register instruction loads the PC with the value of register Rs + signed immediate. The Jump-And-Link-Register instruction does the same and also saves the return address (i.e., the address of the JALR instruction plus one) in the link register R7. The format of these instructions is
The branch instructions test a general purpose register for some condition. The available conditions are: equal to zero, not equal to zero, less than zero, and greater than or equal to zero. If the condition holds, the signed immediate is added to the address of the next sequential instruction and loaded into the PC. The format of the branch instructions is
2.3 R-formatR-format instructions use only registers for operands. R-format
ALU and Shift InstructionsThe ALU and shift R-format instrucions are similiar to I-format 1 instructions, but do not require an immediate value. In each case, the value of Rt is used in place of the immediate. No extension of its value is required. In the case of shift instructions, all but the 4 least-significant bits of Rt are ignored. The ADD instruction performs signed addition. The SUB instruction subtracts Rs from Rt. (Not Rs - Rt.) The set instructions SEQ, SLT, SLE instructions compare the values in Rs and Rt and set the destination register Rd to 0x1 if the comparison is true, and 0x0 if the comparison is false. SLT checks for Rs less than Rt, and SLE checks for Rs less than or equal to Rt. (Rs and Rt are two's complement numbers.) The set instruction SCO will set Rd to 0x1 if Rs plus Rt would generate a carry-out from the most significant bit; otherwise it sets Rd to 0x0. The Bit-Reverse instruction, BTR, takes a single operand Rs and copies it to Rd, but with a left-right reversal of each bit; i.e. bit 0 goes to bit 15, bit 1 goes to bit 14, etc. The syntax of the R-format ALU and shift instructions is:
3. Special InstructionsSpecial instructions use the R-format. The HALT instruction halts the processor. The HALT instruction and all older instructions execute normally, but the instruction after the halt will never execute. The PC is left pointing to the instruction directly after the halt. The No-operation instruction occupies a position in the pipeline, but does nothing. The syntax of these instructions is:
The SIIC and RTI instructions are extra credit and can be deferred for later. They will be not tested until the final demo. The SIIC instruction is an illegal instruction and should trigger the exception handler. EPC should be set to PC + 2, and control should be transferred to the exception handler which is at PC 0x02. The syntax of this instruction is:
The source regsiter name must be ignored. The syntax is specified this way with a dummy source register, to reuse some components from our existing assembler. The RTI instruction should remain equivalent to NOP until the rest of the design has been completed and thoroughly tested. RTI returns from an exception by loading the PC from the value in the EPC register. The syntax of this instruction is:
See the Optimizations page for more information. |
Page last modified on October 03, 2020, visited times |