![Epson S1C17 Series Скачать руководство пользователя страница 37](http://html.mh-extra.com/html/epson/s1c17-series/s1c17-series_manual_107781037.webp)
S1C17 CORE MANUAL
Seiko Epson Corporation
5-15
(Rev. 1.2)
5.6 Arithmetic Operation Instructions
The instruction set of the S1C17 Core supports add/subtract, and compare instructions for arithmetic operations.
add
16-bit addition
add.a
24-bit addition
adc
16-bit addition with carry
sub
16-bit subtraction
sub.a
24-bit subtraction
sbc
16-bit subtraction with borrow
cmp
16-bit comparison
cmp.a
24-bit comparison
cmc
16-bit comparison with borrow
The above arithmetic operations are performed between one general-purpose register and another (R0–R7), or be-
tween a general-purpose register and an immediate. Furthermore, the
add.a
and
sub.a
instructions can perform
operations between the SP and a general-purpose register/immediate. Immediates in sizes smaller than the opera-
tion unit (16 bits or 24 bits), except for the
cmp
instruction, are zero-extended when operation is performed.
The
cmp
instruction compares two operands, and may alter a flag, depending on the comparison result. Basically,
it is used to set conditions for conditional jump instructions. If an immediate smaller than operation unit in size is
specified as the source, it is sign-extended when comparison is performed.
Conditional execution
The arithmetic operation instructions for between registers (
op %rd,%rs
) allow use of the switches to specify
whether the instruction will be executed or not depending on the C flag status.
Unconditional execution instructions
op %rd,%rs
(
op
=
add
,
add.a
,
adc
,
sub
,
sub.a
,
sbc
,
cmp
,
cmp.a
,
cmc
)
The instruction without a switch will be always executed regardless how the C flag is set.
Example:
add %rd,%rs
Instructions executable under C condition
op/c %rd,%rs
(
op
=
add
,
add.a
,
adc
,
sub
,
sub.a
,
sbc
,
cmp
,
cmp.a
,
cmc
)
The instruction with the
/c
switch will be executed only when the C flag has been set to 1.
Example:
sub/c %rd,%rs
Instructions executable under NC condition
op/nc %rd,%rs
(
op
=
add
,
add.a
,
adc
,
sub
,
sub.a
,
sbc
,
cmp
,
cmp.a
,
cmc
)
The instruction with the
/nc
switch will be executed only when the C flag has been cleared to 0.
Example:
cmp/nc %rd,%rs