Y86 encoding / SEQ part 1
1
Y86 encoding / SEQ part 1 1 last time instruction set (interface) - - PowerPoint PPT Presentation
Y86 encoding / SEQ part 1 1 last time instruction set (interface) v microarchitecture (implementation) RISC (simpler HW) v CISC (more fmexible ASM) Y86-64 ISA started Y86 encoding 3 Y86-64 instruction formats 9 0 rA rB OP q rA, rB 6 fn rA
1
3
byte: 1 2 3 4 5 6 7 8 9 halt nop 1 rrmovq/cmovCC rA, rB 2 cc rA rB irmovq V, rB 3 F rB rmmovq rA, D(rB) 4 0 rA rB mrmovq D(rB), rA 5 0 rA rB OPq rA, rB 6 fn rA rB jCC Dest 7 cc call Dest 8 ret 9 pushq rA A 0 rA F popq rA B 0 rA F V D D Dest Dest
4
byte: 1 2 3 4 5 6 7 8 9 halt nop 1 rrmovq/cmovCC rA, rB 2 cc rA rB irmovq V, rB 3 F rB rmmovq rA, D(rB) 4 0 rA rB mrmovq D(rB), rA 5 0 rA rB OPq rA, rB 6 fn rA rB jCC Dest 7 cc call Dest 8 ret 9 pushq rA A 0 rA F popq rA B 0 rA F V D D Dest Dest 0 always (jmp/rrmovq) 1 le 2 l 3 e 4 ne 5 ge 6 g
5
byte: 1 2 3 4 5 6 7 8 9 halt nop 1 rrmovq/cmovCC rA, rB 2 cc rA rB irmovq V, rB 3 F rB rmmovq rA, D(rB) 4 0 rA rB mrmovq D(rB), rA 5 0 rA rB OPq rA, rB 6 fn rA rB jCC Dest 7 cc call Dest 8 ret 9 pushq rA A 0 rA F popq rA B 0 rA F V D D Dest Dest
1
2
3
6
byte: 1 2 3 4 5 6 7 8 9 halt nop 1 rrmovq/cmovCC rA, rB 2 cc rA rB irmovq V, rB 3 F rB rmmovq rA, D(rB) 4 0 rA rB mrmovq D(rB), rA 5 0 rA rB OPq rA, rB 6 fn rA rB jCC Dest 7 cc call Dest 8 ret 9 pushq rA A 0 rA F popq rA B 0 rA F V D D Dest Dest
8
1
9
2
A
3
B
4
C
5
D
6
E
7
F
7
byte: 1 2 3 4 5 6 7 8 9 halt nop 1 rrmovq/cmovCC rA, rB 2 cc rA rB irmovq V, rB 3 F rB rmmovq rA, D(rB) 4 0 rA rB mrmovq D(rB), rA 5 0 rA rB OPq rA, rB 6 fn rA rB jCC Dest 7 cc call Dest 8 ret 9 pushq rA A 0 rA F popq rA B 0 rA F V D D Dest Dest
8
byte: 1 2 3 4 5 6 7 8 9 halt nop 1 rrmovq/cmovCC rA, rB 2 cc rA rB irmovq V, rB 3 F rB rmmovq rA, D(rB) 4 0 rA rB mrmovq D(rB), rA 5 0 rA rB OPq rA, rB 6 fn rA rB jCC Dest 7 cc call Dest 8 ret 9 pushq rA A 0 rA F popq rA B 0 rA F V D D Dest Dest
8
9
9
3 F %rax 01 00 00 00 00 00 00 00
10
3 F 01 00 00 00 00 00 00 00
10
3 F 01 00 00 00 00 00 00 00
6 add %rdi %rax
10
3 F 01 00 00 00 00 00 00 00
6 7
10
3 F 01 00 00 00 00 00 00 00 6 7
9
10
3 F 01 00 00 00 00 00 00 00 6 7 9
10
6 add %rax %rax
11
6 add %rax %rax
11
6
11
6 7 5 23 01 00 00 00 00 00 00
11
6
7 5 23 01 00 00 00 00 00 00
11
6 7 5 23 01 00 00 00 00 00 00
11
byte: 1 2 3 4 5 6 7 8 9 halt nop 1 rrmovq/cmovCC rA, rB 2 cc rA rB irmovq V, rB 3 F rB rmmovq rA, D(rB) 4 0 rA rB mrmovq D(rB), rA 5 0 rA rB OPq rA, rB 6 fn rA rB jCC Dest 7 cc call Dest 8 ret 9 pushq rA A 0 rA F popq rA B 0 rA F V D D Dest Dest
12
byte: 1 2 3 4 5 6 7 8 9 halt nop 1 rrmovq/cmovCC rA, rB 2 cc rA rB irmovq V, rB 3 F rB rmmovq rA, D(rB) 4 0 rA rB mrmovq D(rB), rA 5 0 rA rB OPq rA, rB 6 fn rA rB jCC Dest 7 cc call Dest 8 ret 9 pushq rA A 0 rA F popq rA B 0 rA F V D D Dest Dest
12
byte: 1 2 3 4 5 6 7 8 9 halt nop 1 rrmovq/cmovCC rA, rB 2 cc rA rB irmovq V, rB 3 F rB rmmovq rA, D(rB) 4 0 rA rB mrmovq D(rB), rA 5 0 rA rB OPq rA, rB 6 fn rA rB jCC Dest 7 cc call Dest 8 ret 9 pushq rA A 0 rA F popq rA B 0 rA F V D D Dest Dest
12
byte: 1 2 3 4 5 6 7 8 9 halt nop 1 rrmovq/cmovCC rA, rB 2 cc rA rB irmovq V, rB 3 F rB rmmovq rA, D(rB) 4 0 rA rB mrmovq D(rB), rA 5 0 rA rB OPq rA, rB 6 fn rA rB jCC Dest 7 cc call Dest 8 ret 9 pushq rA A 0 rA F popq rA B 0 rA F V D D Dest Dest
12
byte: 1 2 3 4 5 6 7 8 9 halt nop 1 rrmovq/cmovCC rA, rB 2 cc rA rB irmovq V, rB 3 F rB rmmovq rA, D(rB) 4 0 rA rB mrmovq D(rB), rA 5 0 rA rB OPq rA, rB 6 fn rA rB jCC Dest 7 cc call Dest 8 ret 9 pushq rA A 0 rA F popq rA B 0 rA F V D D Dest Dest
12
byte: 1 2 3 4 5 6 7 8 9 halt nop 1 rrmovq/cmovCC rA, rB 2 cc rA rB irmovq V, rB 3 F rB rmmovq rA, D(rB) 4 0 rA rB mrmovq D(rB), rA 5 0 rA rB OPq rA, rB 6 fn rA rB jCC Dest 7 cc call Dest 8 ret 9 pushq rA A 0 rA F popq rA B 0 rA F V D D Dest Dest
12
13
13
13
14
14
14
15
16
16
16
17
17
17
17
17
17
19
20
20
20
21
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
22
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
22
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
22
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
22
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
to reg
l
i c
to PC
22
time
23
time
23
time
23
%rax, %rdx, … reg values read reg #s write reg #s data to write
time
24
%rax, %rdx, … reg values read reg #s write reg #s data to write
time
24
%rax, %rdx, … reg values read reg #s write reg #s data to write
time
24
%rax, %rdx, … reg values read reg #s write reg #s data to write
time
24
25
%rXX %rYY (two 4-bit register #s)
26
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
%rXX %rYY
0 (=%rax) 2 (=%rdx) 2 (=%rdx) 10 (value of RAX) 30 (value of RDX)
27
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
%rXX %rYY
0 (=%rax) 2 (=%rdx) 2 (=%rdx) 10 (value of RAX) 30 (value of RDX)
27
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
%rXX %rYY
0 (=%rax) 2 (=%rdx) 2 (=%rdx) 10 (value of RAX) 30 (value of RDX)
27
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
%rXX %rYY
0 (=%rax) 2 (=%rdx) 2 (=%rdx) 10 (value of RAX) 30 (value of RDX)
27
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
%rXX %rYY
0 (=%rax) 2 (=%rdx) 2 (=%rdx) 10 (value of RAX) 30 (value of RDX)
27
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
%rXX %rYY
0 (=%rax) 2 (=%rdx) 2 (=%rdx) 10 (value of RAX) 30 (value of RDX)
27
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
%rXX %rYY
0 (=%rax) 2 (=%rdx) 2 (=%rdx) 10 (value of RAX) 30 (value of RDX)
27
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
%rXX %rYY
0 (=%rax) 2 (=%rdx) 2 (=%rdx) 10 (value of RAX) 30 (value of RDX)
27
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
%rXX %rYY
0 (=%rax) 2 (=%rdx) 2 (=%rdx) 10 (value of RAX) 30 (value of RDX)
27
28
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
29
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
29
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
29
30
30
30
31
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
MUX
dest
nop 1 jmp Dest 7 Dest
32
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
MUX
dest
nop 1 jmp Dest 7 Dest
32
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
MUX
dest
nop 1 jmp Dest 7 Dest
32
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
MUX
dest
nop 1 jmp Dest 7 Dest
32
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
MUX
dest
nop 1 jmp Dest 7 Dest
32
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
MUX
dest
nop 1 jmp Dest 7 Dest
32
Instr. Mem.
srcA srcB R[srcA] R[srcB] dstE next R[dstE] dstM next R[dstM]
MUX
dest
nop 1 jmp Dest 7 Dest
32
33