Cmp %Rd, %Rs; Cmp/C %Rd, %Rs; Cmp/Nc %Rd, %Rs - Epson S1C17 Series Manual

Cmos 16-bit single chip microcontroller
Hide thumbs Also See for S1C17 Series:
Table of Contents

Advertisement

cmp
%rd, %rs
cmp/c
%rd, %rs

cmp/nc %rd, %rs

Function
16-bit comparison
Standard)
Extension 1) rs(15:0) - imm13(zero extended)
Extension 2) rs(15:0) - imm16
15 14 13 12 11 10
Code
0
0
1
|
|
0
0
1
|
|
0
0
1
|
|
IL
IE
C
Flag
|
– ↔ ↔ ↔ ↔
|
|
|
– ↔ ↔ ↔
Mode
Src: Register direct %rs = %r0 to %r7
Dst: Register direct %rd = %r0 to %r7
CLK
One cycle
Description
(1) Standard
cmp
Subtracts the contents of the rs register from the contents of the rd register, and sets or resets the
flags (C, V, Z and N) according to the results. The operation is performed in 16-bit size. It does
not change the contents of the rd register.
(2) Extension 1
ext
cmp
Subtracts the 13-bit immediate imm13 from the contents of the rs register, and sets or resets the
flags (C, V, Z and N) according to the results. The imm13 is zero-extended into 16 bits prior to
the operation. The operation is performed in 16-bit size. It does not change the contents of the
rd and rs registers.
* This combination does not use the rd register value for comparison.
(3) Extension 2
ext
ext
cmp
Subtracts the 16-bit immediate imm16 from the contents of the rs register, and sets or resets the
flags (C, V, Z and N) according to the results. The operation is performed in 16-bit size. It does
not change the contents of the rd and rs registers.
* This combination does not use the rd register value for comparison.
(4) Conditional execution
The /c or /nc suffix on the opcode specifies conditional execution.
cmp/c
cmp/nc Executed as cmp when the C flag is 0 or executed as nop when the flag is 1
In this case, the ext instruction can be used to extend the operand.
The conditional execution instruction above sets/resets the flags (V, Z and N) according to the
results if it is executed.
S1C17 CORE MANUAL
(Rev. 1.2)
rd(15:0) - rs(15:0)
9
8
7
6
|
|
1
1
1
1
r d
|
|
|
|
|
|
|
1
1
1
r d
0
|
|
|
|
|
|
|
1
1
1
r d
0
|
|
|
|
|
V
Z
N
|
|
|
cmp
|
|
|
cmp/c, cmp/nc
%rd,%rs
; rd - rs
imm13
%rd,%rs
; rs - imm13
imm3
; imm3(2:0) = imm16(15:13)
imm13
; = imm16(12:0)
%rd,%rs
; rs - imm16
Executed as cmp when the C flag is 1 or executed as nop when the flag is 0
Seiko Epson Corporation
5
4
3
2
1
0
|
0
0
0
r s
|
|
|
|
|
|
0
0
0
r s
|
|
|
|
|
|
1
0
0
r s
|
|
|
|
|
7 DETAILS OF INSTRUCTIONS
cmp
cmp/c
cmp/nc
7-21

Advertisement

Table of Contents
loading

Table of Contents