Y86 is a simplified version of the IA32 architecture.

Architecture Overview

    Registers and Memory

    The Y86 CPU has 8, 32-bit registers, which will follow the same usage conventions as the register of the same name in IA32 (%eax is not callee preserved and is used for return values, etc.):
    IndexName
    0 %eax
    1 %ecx
    2 %edx
    3 %ebx
    4 %esp
    5 %ebp
    6 %esi
    7 %edi

    Memory addresses are 32-bit values. Each address in memory stores a full 32-bit word of data. Y86 has a small memory (256 32-bit words). As in IA32, the memory is typically used with segments for a run-time stack and data.

    Unlike the IA32 architecture covered in class, the Y86 uses a Harvard Architecture. In Harvard Architectures separate memories are used for instructions and data. The instruction memory also uses 32-bit addresses, but each word in the memory contains 6-bytes/48-bits (because each instruction is 48-bits long).

Instruction Formats

    Unlike Intel processors, all instructions are padded out to take 48-bits of space. This design causes some instructions to waste memory, but it makes the overal design and implementation much easier.

    There are four major formats for instructions:

    Format Byte 5 (MSB) Byte 4Byte 3Byte 2Byte 1Byte 0 (LSB)Comment
    No-Oper icode/fcode Unused Simple instructions without operands.
    R-data icode/fcode rA rB Unused Instructions that use one or two registers for operands.
    I-data icode/fcode rA rB Immediate Value Instructions that use one or two registers and a piece of immediate data for operands.
    J-data icode/fcode Immediate Value Unused Instructions that use only a piece of immediate data.

    rA and rB designate a 4-bit register index.

Instructions

    Instruction icode/fcode format Comment
    halt 00 No-Oper Stop Processor
    nop 10 No-Oper No-Operation
    rrmovl 20 R-data Reg[rB] = Reg[rA]
    cmovle 21 R-data If "less or equal", Reg[rB] = Reg[rA]
    cmovl 22 R-data If "less", Reg[rB] = Reg[rA]
    cmove 23 R-data If "equal", Reg[rB] = Reg[rA]
    cmovne 24 R-data If "not equal", Reg[rB] = Reg[rA]
    cmovge 25 R-data If "greater or equal", Reg[rB] = Reg[rA]
    cmovg 26 R-data If "greater", Reg[rB] = Reg[rA]
    irmovl 30 I-data Reg[rB]=Value
    rmmovl 40 I-data Mem[Reg[rB]+Value] = Reg[rA]
    mrmovl 50 I-data Reg[rA] = Mem[Reg[rB]+Value]
    addl 60 R-data Reg[rB] = Reg[rB]+Reg[rA]
    subl 61 R-data Reg[rB] = Reg[rB]-Reg[rA]
    andl 62 R-data Reg[rB] = Reg[rB] & Reg[rA]
    xorl 63 R-data Reg[rB] = Reg[rB] ^ Reg[rA]
    jmp 70 J-data PC = Value
    jle 71 J-data If "less or equal", PC = Value
    jl 72 J-data If "less", PC = Value
    je 73 J-data If "equal", PC = Value
    jne 74 J-data If "not equal", PC = Value
    jge 75 J-data If "greater or equal", PC = Value
    jg 76 J-data If "greater", PC = Value

In order to make decoding instructions easier, some IA32 general purporse instructions have been broken into a family of slightly different instructions. For example, in IA32 the mov instructions handle many different things. In Y86 slightly different instructions are used for each different kind of move:

  • rrmovl moves from one register to another (like a movl %eax, %ebx.
  • rmmovl moves from a register to memory (like a movl %eax, -4(%rbp).
  • mrmovl moves from memory to a register (like a movl -4(%rbp), %eax).