Processor Architecture
Processor Architecture
Processor Architecture
Application Program
Compiler OS ISA CPU Design Circuit Design Chip Layout
Instructions
Layer of Abstraction
Above: how to program machine
Processor executes instructions in a sequence
Different models
8086, 80386, Pentium, Pentium 4
Program registers
%eax %ecx %edx %ebx %esi %edi %esp %ebp
Condition Codes
Single-bit flags set by arithmetic or logical instructions OF: Overflow ZF: Zero SF: Negative
Condition codes
OF ZF SF
Program Counter
Indicates address of instruction
Memory
Byte-addressable storage array Words stored in little-endian byte order
PC
Memory
6 7 4 5
Encoded Representation
Encoded Representation
Encoding: 60 06
First indicates instruction type Second gives source and destination registers
And
andl rA, rB 6 2 rA rB
Exclusive-Or
xorl rA, rB 6 3 rA rB
Move Operations
rrmovl rA, rB 2 0 rA rB irmovl V, rB 3 0 8 rB V
mrmovl D(rB), rA 5 0 rA rB
Like the IA32 movl instruction Simpler format for memory addresses Give different names to keep them distinct
Y86
irmovl $0xabcd, %edx rrmovl %esp, %ebx mrmovl -12(%ebp),%ecx
Encoding
30 82 cd ab 00 00 20 43 50 15 f4 ff ff ff
movl %esi,0x41c(%esp) rmmovl %esi,0x41c(%esp)40 64 1c 04 00 00 movl $0xabcd, (%eax) movl %eax, 12(%eax,%edx) movl (%ebp,%eax,4),%ecx
Jump Instructions
Jump Unconditionally jmp Dest 7 0 Dest
Jump When Less or Equal jle Dest 7 1 Dest Jump When Less jl Dest 7 2 Jump When Equal je Dest 7 3 Jump When Not Equal jne Dest 7 4 Dest Dest Dest
Jump When Greater or Equal jge Dest 7 5 Dest Jump When Greater jg Dest 7 6 Dest
Refer to generically as jXX Encodings differ only by function code Based on values of condition codes Same as IA32 counterparts Encode full destination address
Unlike PC-relative addressing seen in IA32
Stack Top
Stack Operations
pushl rA a 0 rA 8
Read word from memory at %esp Save in rA Increment %esp by 4 Like IA32
Push address of next instruction onto stack Start executing instructions at Dest Like IA32
ret 9 0
Pop value from stack Use as address for next instruction Like IA32
Miscellaneous Instructions
nop 0 0
Dont do anything
halt 1 0
Stop executing instructions IA32 has comparable instruction, but cant execute it in user mode We will use it to stop the simulator
# List of elements