SHL (d, n)

Chapter 5 Instruction Specifications

Item number

Application instructions-5

 

 

Name

 

Shift left

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Ladder format

 

 

 

 

 

 

Condition code

 

 

 

 

Processing time (s)

Remark

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

R7F4

 

R7F3

 

R7F2

R7F1

 

R7F0

Average

Maximum

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SHL (d, n)

 

 

DER

 

ERR

 

SD

 

V

 

 

 

C

 

 

 

 

 

 

Upper case: W

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

38

 

 

Lower case: DW

 

 

 

 

 

z

 

 

z

 

 

z

 

z

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Instruction format

 

 

 

 

 

 

Number of steps

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Condition

 

 

 

Steps

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SHL (d, n)

 

 

 

 

 

 

 

 

 

 

 

 

 

3

 

 

46

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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

I/O to be shifted

 

 

 

 

 

 

 

 

 

 

{

 

{

 

{

 

{

{

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

n

Number of bits to be

 

 

 

 

 

 

 

 

 

{

{

 

{

 

{

 

 

 

 

{

 

The constant is set in

shifted

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

decimal.

Function

Shifts the contents of d to the left (toward the upper digits) by n bits.

Sets n bits of SD (R7F2) contents starting with the least significant bit.

Sets the content of the nth bit from the most significant bit in C (R7F0).

Before execution

 

 

 

 

 

 

d

n bits

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

B

 

 

 

 

 

 

 

 

 

 

 

 

 

C (R7F0)

After execution

B

Most significant bit (MSB)

 

 

 

 

 

 

 

 

 

SD

 

 

 

 

 

 

 

 

 

SD (R7F2)

 

SD

 

SD

 

 

 

 

SD

 

 

n bits

SD

SD

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Least significant bit (LSB)

If d is a word:

Designates the shift amount, depending on the contents (0 to 15) of the lower 4 bits (b3 to b0) of n

 

(WX, WY, WR, WM, TC). (Upper bits are ignored and considered as “0.”)

 

The n (constant) can be set to 0 to 15 (decimal).

If d is a double word:

Designates the shift amount, depending on the contents (0 to 31) of the lower 5 bits (b4 to b0) of n

 

(WX, WY, WR, WM, TC). (Upper bits are ignored and considered as “0.”)

 

The n (constant) can be set to 0 to 31 (decimal).

Notes

If n is equal to “0,” the shifting is not performed. The previous state is retained in C.

Program example

 

X00000

R7F2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

X00001 DIF1

 

 

 

 

SHL

(DR0000 ,1 )

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

R7F0

Y00100

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

LD

X00000

OUT

R7F2

LD

X00001

AND

DIF1

[

 

SHL

(DR0000,1)

]

 

LD

R7F0

OUT

Y00100

Program description

The R7F2 value is determined by the on/off of X00000.

The content of DR0000 is shifted to the left by one bit when X00001 rises.

At this time, the value of R7F2 is set in b0 and the value of b31 (b15 of WR1) in R7F0.

The Y00100 turns on/off depending on the b31 value of DR0000 (b15 of WR1) prior to the shift.

5-74

Page 124
Image 124
Hitachi NJI-350B manual Application instructions-5, Shift left, SHL d, n