proj-plbook-plMipsDlxIsa

Table of Contents for Programming Languages: a survey

The MIPS and DLX, etc, ISAs

MIPS

" Goals of the 64bit MIPS architecture:

    Use general-purpose registers with a load-store architecture
    Support these addressing modes: displacement (with an address offset size of 12–16 bits), immediate (size 8–16 bits), and register indirect
    Support these data sizes and types: 8-, 16-, 32-, and 64-bit integers and 64-bit IEEE 754 floating-point numbers
    Support these simple instructions, since they will dominate the number of instructions executed: load, store, add, subtract, move register-register, and shift
    Compare equal, compare not equal, compare less, branch (with a PC-relative address at least 8 bits long), jump, call, and return
    Use fixed instruction encoding if interested in performance, and use variable instruction encoding if interested in code size
    Provide at least 16 general-purpose registers, be sure all addressing modes apply to all data transfer instructions
    Aim for a minimalist instruction set

MIPS addressing modes

    The data types are 8-bit bytes, 16-bit half words, 32-bit words, and 64-bit double words for integer data and 32-bit single precision and 64-bit double precision for floating point
    The only data addressing modes are immediate and displacement, both with 16-bit fields
    Register indirect is accomplished simply by placing 0 in the 16-bit displacement field
    Absolute addressing with a 16-bit field is accomplished by using register 0 as the base register
    MIPS memory is byte addressable with a 64-bit address
    Mode bit that allows software to select either Big Endian or Little Endian

" Goals of the 64bit MIPS architecture:

    Use general-purpose registers with a load-store architecture
    Support these addressing modes: displacement (with an address offset size of 12–16 bits), immediate (size 8–16 bits), and register indirect
    Support these data sizes and types: 8-, 16-, 32-, and 64-bit integers and 64-bit IEEE 754 floating-point numbers
    Support these simple instructions, since they will dominate the number of instructions executed: load, store, add, subtract, move register-register, and shift
    Compare equal, compare not equal, compare less, branch (with a PC-relative address at least 8 bits long), jump, call, and return
    Use fixed instruction encoding if interested in performance, and use variable instruction encoding if interested in code size
    Provide at least 16 general-purpose registers, be sure all addressing modes apply to all data transfer instructions
    Aim for a minimalist instruction set

Registers in MIPS

    32 64-bit general-purpose registers (GPRs), sometimes called integer registers, named R0, R1, ... , R31.
    32 floating-point registers (FPRs), named F0, F1, ... , F31, which can hold 32 single-precision (32-bit) values or 32 double-precision (64-bit) values
    When holding one single-precision number, the other half an FPR is unused
    R0 is always 0

MIPS addressing modes

    The data types are 8-bit bytes, 16-bit half words, 32-bit words, and 64-bit double words for integer data and 32-bit single precision and 64-bit double precision for floating point
    The only data addressing modes are immediate and displacement, both with 16-bit fields
    Register indirect is accomplished simply by placing 0 in the 16-bit displacement field
    Absolute addressing with a 16-bit field is accomplished by using register 0 as the base register
    MIPS memory is byte addressable with a 64-bit address
    Mode bit that allows software to select either Big Endian or Little Endian

MIPS instruction format

    2 addressing modes that are to be encoded in the opcode
    32 bit instructions (6 bit primary opcode)

MIPS operations

    4 classes of operations (loads and stores, ALU operations, branches and jumps, and floating-point operations)
    Any of the general-purpose or floating-point registers may be loaded or stored
    Loading R0 has no effect
    Single-precision floating-point numbers occupy half a floating-point register
    Conversions between single and double precision must be done explicitly
    All ALU instructions are register-register instructions (add, subtract, AND, OR, XOR, and shifts) with immediate forms provided using a 16-bit sign-extended immediate
    Flow Control:
        Compare instructions: compare two registers to see if the first is less than the second. If true, a 1 is placed in the destination register (to represent true); otherwise a 0 is placed. Also called "set" operations because they set a register
        Jump instructions are differentiated by the two ways to specify the destination address and by whether or not a link is made
        Two types of jumps: plain jump and jump and link which places the return address in
        All branches are conditional specified by instruction which may test the register source for zero or nonzero, whether it contains a data value or the result of a compare, whether it's negative or equal to another register
    Floating point:
        Instructions indicate whether there is single or double precision (.S or .D)
        MIPS64 can perform two 32-bit operations on a single 64-bit register with paired single operations (.PS)

"

in MIPS they have beq and bne but they replace ble etc with stuff like 'set if less than (a, b, r0); beq (r0, zero, LABEL)': http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Mips/pseudojump.html

with variants for addressing mode and type and special registers omitted:

add and beq bne div j jal (jump and link) load mult nor xor or store slt (set to 1 if less than) sll (lsl) srl (lsr) sra (asr) sub

DLX

DLX is MIPS for education

with variants for addressing mode and type and special registers omitted:

load, store lhi (load high immediate) mov add sub mult div and or sll (lsl) srl (lsr) sra (asr) slt (set if less than) sgt, sle, sge, sne beqz, bneq bfpg, bfpf (branch on comparison bit in the FP status register) j jal (jump and link) trap rfe (return to user code from exception) cvt (convert) LTF, GTF, LEF, GEF, EQF, NEF (compare and set comparison bit in the FP status register)

Links:

RISC-V

open source

clearest concise summary of major opcodes is in tables at the end of http://www.eecs.berkeley.edu/Pubs/TechRpts/2014/EECS-2014-146.pdf

younger than (2010) and claims to have learned from SPARC V8 (1994) and OpenRISC? (2000).

http://riscv.org/

http://riscv.org/download.html#tab_isaspec (base opcode listing in Chapter 8)

I'm not sure what addressing modes are supported, but i'm guessing it's non-uniform, with different opcodes for different modes, and mostly register, except for the 'immediate' opcodes which have an 'immediate' component, and loads and stores which have a base+offset mode, with base address in register rs1. Unconditional jumps have PC-relative addressing.

interesting comparison of RISC-V with Epiphany (the one used in Parallella) http://www.adapteva.com/andreas-blog/analyzing-the-risc-v-instruction-set-architecture/

note: RISC-V instructions that the Epiphany guy thought maybe could have been left out:

AUIPC (but in the comments a RISC-V guy says AUIPC was important for relocatable code), SLT/SLTI/STLU/SLTIU (compare: set-less-than, with unsigned and immediate and unsigned immediate variants), XORI/ORI/ANDI (boolean logic with immediate values), FENCE (mb; sync threads), MULH/MULHSU/MULHU (multiply variants with the 'upper half' variant), FSGNJ/FSGNJN/FSGNJX (Sign Inject: Sign source), FCLASS (Categorization: Classify Type). Then there was a bunch for which he said "Not needed for epiphany", which i dunno if he means 'this is good but since Epiphany had a restricted use case target (DSP) we didn't include it'. These are: FLW/FSW (load/store 'W'; i didn't note this below), FMV.X/FMV.S (move from/to integer), FRSCSR (typo? read status regs? i didn't note this below), FSRM/FSRMI (swap rounding mode; i didn't note this below), FSFLAGS (swap flags; i didn't note this below). Then there are some for which he said and 'Needed?', these are: FNMSUB (Negative Multiply-SUBtract), FMIN/FMAX (min/max), FCMP (i can't find this in the table in http://www.eecs.berkeley.edu/Pubs/TechRpts/2014/EECS-2014-146.pdf , so i didn't note this below).

Epiphany instructions that the Epiphany said RISC-V left out that are good: LDRD (load/store double), LDR and STR with the POSTMOD addressing mode (postincrement).

Base opcodes

from http://www.eecs.berkeley.edu/Pubs/TechRpts/2014/EECS-2014-146.pdf :

Loads:

Stores:

Arithmetic:

Logical (note: the Epiphany guy thought the immediate versions of these could have been left out):

Shifts:

Compare (note: the Epiphany guy thought these could have been left out):

Branch:

Jump & Link:

Synch:

System:

Counters:

Multiply-divide extension opcodes

from http://www.eecs.berkeley.edu/Pubs/TechRpts/2014/EECS-2014-146.pdf :

(note: the Epiphany guy thought the 'upper half' multiply variants could have been left out)

More extension opcodes

from http://www.eecs.berkeley.edu/Pubs/TechRpts/2014/EECS-2014-146.pdf :

Load and store:

Arithmetic

Mul-Add:

Move (note: the Epiphany guy thought these could have been left out):

Sign Inject (note: the Epiphany guy thought these could have been left out):

Min/Max (note: the Epiphany guy thought these could have been left out):

Compare:

Convert:

Categorization (note: the Epiphany guy thought these could have been left out):

Configuration:

Atomicity extension opcodes

from http://www.eecs.berkeley.edu/Pubs/TechRpts/2014/EECS-2014-146.pdf :

OpenRISC

open source (created in year 2000)

SPARC v8

open source (created in year 1994)

Links