Chapter 5 Instruction Specifications

Item number

 

Arithmetic instructions-2

 

 

Name

 

Binary addition (BINARY ADDITION)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Ladder format

 

 

 

 

 

 

Condition code

 

 

 

 

Processing time (s)

Remark

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

R7F4

 

R7F3

 

R7F2

R7F1

 

R7F0

Average

Maximum

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

d = s1 + s2

 

 

DER

 

ERR

 

SD

 

V

 

 

 

C

 

 

 

 

 

 

Upper case: W

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

45

 

 

Lower case: DW

 

 

 

 

 

 

 

z

 

 

z

 

 

z

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Instruction format

 

 

 

 

 

 

Number of steps

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Condition

 

 

 

Steps

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

d = s1 + s2

 

 

 

 

 

Word

 

 

 

 

 

4

 

 

61

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Double word

 

 

 

6

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Bit

 

 

 

 

 

 

 

Word

 

Double word

 

Constant

 

 

 

Usable I/O

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Other

 

 

 

X

Y

M

 

 

CU, CT

 

WX

WY

WM

 

TC

DX

DY

DM

 

 

 

 

 

 

 

 

 

 

R,

 

 

TD, SS,

 

 

 

 

WR,

 

 

 

 

DR,

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

d

Substitution destination

 

 

 

 

 

 

 

 

 

 

{

 

{

 

{

 

{

{

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

s1

Augend

 

 

 

 

 

 

 

 

 

 

 

{

{

 

{

 

{

{

{

{

 

{

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

s2

Addend

 

 

 

 

 

 

 

 

 

 

 

{

{

 

{

 

{

{

{

{

 

{

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Function

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Adds s1 and s2 as the binary data, and substitutes the result into d as the binary data.

The C flag is set to “0” if the operation result is within the range of H0000 to HFFFF for word and H00000000 to HFFFFFFFF for double word. Otherwise, It is set to “1.”

C = s1m x s2m + s1m x dm + s2m x dm

The V flag is set to “1” if the operation result is meaningless as signed binary data, and “0” if it is meaningful.

s1

s2

d

V

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Most significant bit

 

Positive

Positive

Positive

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Positive

Positive

Negative

1

 

 

 

 

s1m

 

 

0

s1

 

 

 

 

 

 

 

 

 

 

 

 

 

Positive

Negative

Positive/Negative

0

 

 

 

 

 

 

 

 

 

+

 

 

s2m

 

 

0

s2

 

 

 

 

 

 

 

 

Negative

Positive

Negative/Positive

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Negative

Negative

Positive

1

 

 

 

 

 

 

 

 

 

C

 

 

dm

 

 

0

d

 

 

 

 

 

 

 

 

 

 

 

 

 

Negative

Negative

Negative

0

 

 

 

 

 

 

 

 

 

 

 

 

 

V = s1m x s2m x dm + s1m x s2m x dm

 

 

 

 

 

 

Notes

The combinations of d, s1 and s2 are as follows:

 

 

 

 

 

d

s1

s2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Word

Word

Word

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Double word

Double word

Double word

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Program example

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

LD

X00000

 

X00000 DIF0

 

 

 

 

 

 

 

 

WR0002 = WR0000 + WR0001

 

 

 

AND

DIF0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

[

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

WR0002 = WR0000 + WR0001

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

]

 

 

 

 

 

 

 

 

 

 

Program description

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The sum of WR0000 and WR0001values is substituted into WR0002 at the leading edge of input X00000.

d = s1 + s2

5-47

Page 97
Image 97
Hitachi NJI-350B manual Arithmetic instructions-2, Binary addition Binary Addition, Word Double word, Positive, Negative