Instruction Set Architecture

References

Instruction Set Architecture (ISA)

Y86-64 ISA

Y86-64 Processor State

Y86-64 Instruction set

Byte 0 1 2 3 4 5 6 7 8 9
halt 0:0
nop 1:0
cmovXX rA, rB 2:n rA:rB
irmovq V, rB 3:0 F:rB V V V V V V V V
rmmovq rA, D(rB) 4:0 rA:rB D D D D D D D D
mrmovq D(rB), rA 5:0 rA:rB D D D D D D D D
OPq rA, rB 6:n rA:rB
jXX L 7:n L L L L L L L L
call L 8:0 L L L L L L L L
ret 9:0
pushq rA A:0 A:F
popq rA B:0 A:F

Y86-64 Instructions

cmovXX Instructions

Byte 0 1 2 3 4 5 6 7 8 9
rrmovq rA, rB 2:0 rA:rB
cmovle rA, rB 2:1 rA:rB
cmovl rA, rB 2:2 rA:rB
cmove rA, rB 2:3 rA:rB
cmovne rA, rB 2:4 rA:rB
cmovge rA, rB 2:5 rA:rB
cmovg rA, rB 2:6 rA:rB

OPq Instructions

Byte 0 1 2 3 4 5 6 7 8 9
addq rA, rB 6:0 rA:rB
subq rA, rB 6:1 rA:rB
andq rA, rB 6:2 rA:rB
xorq rA, rB 6:3 rA:rB

jXX Instructions

Byte 0 1 2 3 4 5 6 7 8 9
jmp L 7 0 L L L L L L L
jle L 7 1 L L L L L L L
jl L 7 2 L L L L L L L
je L 7 3 L L L L L L L
jne L 7 4 L L L L L L L
jge L 7 5 L L L L L L L
jg L 7 6 L L L L L L L

Encoding Registers

Instruction Example

Arithmetic and Logical Operations

Move Operations

Instruction Source Destination
rrmovq rA, rB Register Register
irmovq V, rB Immediate Register
rmmovq rA, D(rB) Register Memory
mrmovq D(rA), rB Memory Register

Move Instruction Examples

x86-64 Y86-64 Encoding
movq $0xabcd, %rdx irmovq $0xabcd, %rdx 30 82 cd ab 00 00 00 00 00 00
movq %rsp, %rbx% rrmovq %rsp, %rbx 20 43
movq -12(%rbp), %rcx mrmovq -12(%rbp), %rcx 50 15 f4 ff ff ff ff ff ff ff
movq %rsi, 0x41c(%rsp) rmmovq %rsi, 0x41c(%rsp) 40 64 1c 04 00 00 00 00 00 00

Conditional Move Instructions

Jump Instructions

Y86-64 Program Stack

Stack Operations

Subroutine Call and Return

Miscellaneous Instructions

Status Conditions

Mnemonic Code Comment
AOK 1 Normal operation
HLT 2 Halt instruction encountered
ADR 3 Bad address (either instruction or data) encountered
INS 4 Invalid instruction encountered

Y86-64 Sample Program Structure

init:           # Initialization
    ...
    call Main
    halt

    .align 8    # Program data
array:
    ...

Main:           # Main function
    ...
    call len

len:
   ....

   .pos 0x100   # Placement of stack
Stack:

Y86-64 Sample Program Structure

Y86-64 Sample Program Structure

init:
    # Set up stack pointer
    irmovq Stack, %rsp
    # Execute main program
    call Main
    # Terminate
    halt

# Array of 4 elements + terminating 0
    .align 8
Array:
    .quad 0x000d000d000d000d
    .quad 0x00c000c000c000c0
    .quad 0x0b000b000b000b00
    .quad 0xa000a000a000a000
    .quad 0

CISC Instruction Sets

RISC Instruction Sets

Summary