程序代写代做 C Y86-64 Instructions Encoding

Y86-64 Instructions Encoding
Byte 0 1 23456789
halt
nop
rrmovq rA, rB cmovXX rA, rB irmovq V, rB rmmovq rA, D(rB) mrmovq D(rB), rA OPq rA, rB
jXX Dest
call Dest
ret
pushq rA
popq rA
Y86-64 ISA Reference
0
0
1
0
2
0
rA
rB
2
fn
rA
rB
3
0
F
rB
V
4
0
rA
rB
D
5
0
rA
rB
D
6
fn
rA
rB
7
fn
Dest
8
0
Dest
9
0
A
0
rA
F
B
0
rA
F
Instruction
Semantics
Example
rrmovq %rs, %rd cmovXX %rs, %rd irmovq $i, %rd rmmovq %rs, D(%rd) mrmovq D(%rs), %rd OPq %rs, %rd
jmp D jXX D call D
ret
pushq %rs popq %rd
r[rd] ← r[rs]
r[rd] ← r[rs] if last ALU result XX 0 (XX is le/l/e/ne/ge/g) r[rd] ← i
m[D + r[rd]] ← r[rs]
r[rd] ← m[D + r[rs]]
r[rd] ← r[rd] OP r[rs]
goto D
goto D if last ALU result XX 0 (XX is le/l/e/ne/ge/g) pushq PC; jmp D
popq PC
m[r[rsp] – 8] ← r[rs]; r[rsp] = r[rsp] – 8
r[rd] ← m[r[rsp]]; r[rsp] = r[rsp] + 8
rrmovq %rax, %rbx cmovle %rax, %rbx irmovq $100, %rax rmmovq %rax, 100(%rbx) mrmovq 100(%rbx), %rax addq %rax, %rbx
jmp foo
jle foo
call foo
ret
pushq %rax popq %rax
Register
Name
Register
Name
0 1 2 3 4 5 6 7
%rax %rcx %rdx %rbx %rsp %rbp %rsi %rdi
8
9
A (10) B (11) C (12) D (13) E (14)
%r8
%r9 %r10 %r11 %r12 %r13 %r14
ifun
OPq
jXX
0 1 2 3 4 5 6
addq subq andq xorq mulq divq modq
jmp jle jl je jne jge jg
⃝c 2020MargoSeltzer&DonaldActon–Nottobecopiedorrevisedwithoutexplicitwrittenpermissionofcopyrightowners.

21 =2 22 =4 23 =8 24 =16
Amdahl’s Law:
Told= 1 Tnew (1 − α) + α
k
25 =32 26 =64 27 =128 28 =256
29 =512 210 =1024 211 =2048 212 =4096
213 =8192 214 =16384 215 =32768 216 =65536
page 2
HEX
DEC
BIN
HEX
DEC
BIN
HEX
DEC
BIN
HEX
DEC
BIN
0 1 2 3
0 1 2 3
0000
0001
0010
0011
4 5 6 7
4 5 6 7
0100
0101
0110
0111
8 9 A B
8
9 10 11
1000
1001
1010
1011
C D E F
12 13 14 15
1100
1101
1110
1111
⃝c 2020MargoSeltzer&DonaldActon–Nottobecopiedorrevisedwithoutexplicitwrittenpermissionofcopyrightowners.

page 3
Write back
Stat
stat W_stat
W
M
stat
icode
dmem_error


data out
data in
dstE
dstM
Data memory
Mem.
M_Cnd
read write
Addr

stat
icode
Cnd


dstE
dstM
e_Cnd
CC
ALU AB
ALU fun.
dstE
ALU
ALU
E
stat
icode
ifun



dstE
dstM
srcA
srcB
d_srcA d_srcB
dstE dstM srcA srcB
ABM Register

E

D
stat
icode
ifun
rA
rB


Instruction memory
PC increment
F
predPC
m_stat stat
Memory
M_stat
Execute
E_stat
Decode
D_stat
f_stat stat
imem_error
Fetch
A

f_pc
PC
Predict PC

⃝c 2020MargoSeltzer&DonaldActon–Nottobecopiedorrevisedwithoutexplicitwrittenpermissionofcopyrightowners.