Professional Documents
Culture Documents
Nguyên Lý 80/20 - Bí Quyết Làm Ít Được Nhiều
Nguyên Lý 80/20 - Bí Quyết Làm Ít Được Nhiều
Nguyên Lý 80/20 - Bí Quyết Làm Ít Được Nhiều
1
Shift Instructions Restore and Save Instructions
Assembler Syntax Assembler Syntax
operation reg rs1 , reg rs2 , reg rd operation reg rs1 , reg rs2 , reg rd
operation reg rs1 , const 5, reg rd operation reg rs1 , siconst 13, reg rd
Instruction Formats Instruction Formats
31:30 29:25 24:19 18:14 13 12:5 4:0 31:30 29:25 24:19 18:14 13 12:5 4:0
10 rd op3 rs1 0 unused (zero) rs2 10 rd op3 rs1 0 unused (zero) rs2
10 rd op3 rs1 1 unused (zero) const5 10 rd op3 rs1 1 siconst13
Operations Operations
operation op3 operation op3
sll 100101 restore 111101
sra 100111 save 111100
srl 100110
Trap Instructions
Branch Instructions Assembler Syntax
Assembler Syntax operation reg rs1 , reg rs2 , reg rd
operation label operation reg rs1 , siconst 13, reg rd
operation ,a label
Instruction Formats
Instruction 24:22
31:30 29 28:25
Format 21:0
31:30 29 28:25 24:19 18:14 13 12:5 4:0
10 r cond 111010 rs1 0 unused (zero) rs2
00 a cond 010 disp22
10 r cond 111010 rs1 1 siconst13
Operations
operation cond operation cond Operations
bn 0000 ba 1000 operation cond operation cond
be (bz) 0001 bne (bnz) 1001 tn 0000 ta 1000
ble 0010 bg 1010 te (tz) 0001 tne (tnz) 1001
bl 0011 bge 1011 tle 0010 tg 1010
bleu 0100 bgu 1100 tl 0011 tge 1011
bcs (blu) 0101 bcc (bgeu) 1101 tleu 0100 tgu 1100
bneg 0110 bpos 1110 tcs (tlu) 0101 tcc (tgeu) 1101
bvs 0111 bvc 1111 tneg 0110 tpos 1110
tvs 0111 tvc 1111
Jump and Link Instructions The NOP Instruction
Assembler Syntax
jmpl address , reg rd Assembler Syntax
nop
Instruction Formats
31:30 29:25 24:19 18:14 13 12:5 4:0 Instruction
31:3029:25
Format
24:22 21:0
10 rd 111000 rs1 0 unused (zero) rs2 00 00000 100 0000000000000000000000
10 rd 111000 rs1 1 siconst 13
The UNIMP Instruction
Return from Trap Instructions Assembler Syntax
Assembler Syntax unimp const 22
rett address
Instruction Format
Instruction Formats 31:3029:25
00 reserved
24:22
000
21:0
const22
31:30 29:25 24:19 18:14 13 12:5 4:0
10 00000 111001 rs1 0 unused (zero) rs2
10 00000 111001 rs1 1 siconst13
The STBAR Instruction
Assembler Syntax
Call and Link Instructions stbar
Assembler Syntax Instruction Format
call label 31:30
10
29:25 24:19
00000 101000
18:14
01111
13:0
unused (zero)
Instruction Format
31:30 29:0
01 disp30
2
Read State Register Instructions Synthetic Instructions
Assembler Syntax Synthetic instruction
bclr rs , rd
Implementation
andn rd , rs , rd
rd statereg , rd bclr rs , siconst 13 andn rs , siconst 13 , rd
Instruction
31:3029:25
Format
24:19 18:14 13:0
bset rs , rd
bset siconst 13 , rd
or
or
rd , rs , rd
rd , siconst 13 , rd
10 rd op3 rs1 unused (zero) btst rs 1, rs 2 andcc rs 1 , rs 2, %g0
btst rs , siconst 13 andcc rs , siconst 13 , %g0
btog rs , rd xor rd , rs , rd
Register Encodings btog rs , siconst 13 xor rs , siconst 13 , rd
state register op3 rs1 call address jmpl address , %g0
%y 101000 0 clr rd or %g0, %g0, rd
%asr1{%asr31 101000 1{31 clrb [address ] stb %g0, [address ]
%psr 101001 reserved clrh [address ] sth %g0, [address ]
%wim 101010 reserved clr [address ] st %g0, [address ]
%tbr 101011 reserved cmp rs 1, rs 2 subcc rs 1 , rs 2, %g0
cmp rs , siconst 13 subcc rs , siconst 13 , %g0
Write State Register Instructions dec
dec
rd
siconst 13 , rd
sub
sub
rd , 1, rd
rd , siconst 13 , rd
Assembler Syntax deccc rd subcc rd , 1, rd
wr reg rs1 , reg rs2 , statereg deccc siconst 13 , rd subcc rd , siconst 13 , rd
wr reg rs1 , siconst 13, statereg inc rd add rd , 1, rd
inc siconst 13 , rd add rd , siconst 13 , rd
Instruction Formats inccc rd addcc rd , 1, rd
31:30 29:25 24:19 18:14 13 12:5 4:0 inccc siconst 13 , rd addcc rd , siconst 13 , rd
10 rd op3 rs1 0 unused (zero) rs2 jmp address jmpl address , %g0
op3
mov rs , rd or %g0, rs , rd
10 rd rs1 1 siconst13 mov siconst 13 , rd or %g0, siconst 13 , rd
mov statereg , rd rd statereg , rd
Register Encodings mov rs , statereg
mov siconst 13 , statereg
wr
wr
%g0, rs , statereg
%g0, siconst 13 , statereg
state register op3 rd
%y 110000 0 neg rs , rd sub %g0, rs , rd
neg rd sub %g0, rd , rd
%asr1{%asr31 110000 1{31 not rd xnor rd , %g0, rd
%psr 110001 reserved not rs , rd xnor rs , %g0, rd
%wim 110010 reserved restore restore %g0, %g0, %g0
%tbr 110011 reserved save save %g0, %g0, %g0
ret jmpl %i7+8, %g0
FLUSH Instructions retl jmpl %o7+8, %g0
Assembler Syntax set iconst , rd or %g0, iconst , rd
|or |
ush address sethi %hi(iconst ), rd
Instruction Formats sethi
|or |
%hi(iconst ), rd
31:30 29:25 24:19 18:14 13 12:5 4:0
or rd , %lo(iconst ), rd
10 unused 111011 rs1 0 unused (zero) rs2 tst rs orcc %g0, rs , %g0
10 unused 111011 rs1 1 siconst13
Assembler Directives
.align n
.ascii "string " [, "string "]*
.asciz "string " [, "string "]*
.byte 8-bitval [, 8-bitval ]*
.data
.global label [, label ]*
.half 16-bitval [, 16-bitval ]*
.include "lename "
.skip n
.text
.word 32-bitval [, 32-bitval ]*
ISEM Traps
0 terminate program
1 putchar( %r8 )
2 blocking getchar( %r8 )
3 nonblocking getchar( %r8 )