Topic 2: Basic Pipelining · Defining an instruction set: 1. Data types 2. Addressing Modes 3. Operations 4. Definition of register set · DLX: Generic Load/Store Architecture 1. Data types: Integer: 8-bit bytes, 16-bit half-words, 32-bit words Floating point: 32-bit single precision, 64-bit double precision Fixed-length instructions: 32 bits 2. Addressing Modes Memory is byte-addressible Big-endian (bytes number 0, 1, 2, ... in memory; left-most bit represents high-order bits in big-endian machines) Big-endian machines: SPARC, 680x0 Little-endian: DEC, Intel 32-bit memory addresses All memory references through loads and stores between memory and either GPRs (general purpose registers) or FPRs (floating point registers Can also move between GPRs and FPRs Only three data addressing modes: register, immediate and displacement Mode Example Means Used for Register Add R4, R2, R3 R4 <- R2 + R3 Values in register Immediate or literal Add R4, R2, #3 R4 <- R4 + 3 for constants; 50% of ALU operations, 85% of compares; most values small Displacement or based LW R4, 100(R1) R4 <- M[100 + R1] used for accessing local variables; choosing length of displacement field affects instruction length Register deferred: use displacement mode with displacement = 0 (i.e., register holds a pointer) Absolute: use displacement mode with base register R0 (tied to 0) (i.e., directly address memory) · Branch addressing modes: PC relative and register indirect · PC-relative branching Specify an offset relative to the PC, use this to compute target address Why does this work? Target is often near current instruction (examples: loops, switch statements) Use fewer bits to specify Position independence: permits code to run independently of where it is loaded Useful when target of branch is known at compile time (if not, can't use PC-rel) · Register indirect jumps and branches Jump to a 32-bit address stored in a register · DLX uses fixed instruction lengths · This makes for simpler decoding of instructions · DLX also uses relatively few addressing modes and relatively few combinations · Can include the addressing mode information as part of the opcode Example: may have ADD and ADDI instructions; first case, expects to see two register operands, second case, expects second operand to be an immediate value, will decode accordingly 3. Operations: 4 classes (a) Loads and stores Only one addressing mode: base register plus 16-bit signed offset Example: LW R1, 30(R2) <<== R1 <- M[30 + R2] (loads 32-bit word) LW R1, 1000(R0) <<== R1 <- M[1000 + R0] (gives absolute address) Note: to load an immediate value into a register, use an ADDI rather than a LD operation: use operand R0 and immediate value (b) ALU operations (ADD, SUB, MUL, AND, OR, Shift, Compares) Usually have two source register operands and one register destination operand Example: ADD R2, R1, R3 <<== R2<-R1 + R3 Also, allow immediate operands Example: ADD R1, R2, #3 <<== R1<-R2+3 Compares (<, >, <=, >=, ==, !=) on two registers; if true, puts 1 in destination register; if false, puts 0 in destination register Example: SLT R1, R2, R3 <<== if (R2