User guide

Instructions
Chapter 23
Bit Shift, FIFO, and LIFO
239
Operation
Instruction parameters have been programmed in the LFL LFU instruction
pair shown below. For purposes of comparison, the same parameters are
used here as in the FFL FFU example on page 237.
(EN)
(DN)
(EM)
LFL
LIFO LOAD
Source N7:10
LIFO #N7:12
Control R6:0
Length 34
Position 9
(EU)
(DN)
(EM)
LFU
LIFO UNLOAD
LIFO #N7:12
Dest N7:11
Control R6:0
Length 34
Position 9
LFU instruction unloads
data from stack #N7:12 at
position 8.
N7:12 0
N7:13 1
N7:14 2
3
4
5
6
7
8
9
N7:45 33
34 words are
allocated for LIFO
stack starting at
N7:12, ending at
N7:45.
Loading and Unloading of stack #N7:12
N7:10
N7:11
Position
Destination
Source
LFL instruction loads data
into stack #N7:12 at the
next available position, 9 in
this case.
LFLLFU Instruction Pair
LFL instruction operation When rung conditions change from
falsetotrue, the LFL enable bit (EN) is set. This loads the contents of the
Source, N7:10, into the stack element indicated by the Position number, 9.
The position value then increments.
The LFL instruction loads an element at each falsetotrue transition of the
rung, until the stack is filled (34 elements). The done bit (DN) is then set,
which inhibits further loading.
LFU instruction operation When rung conditions change from
falsetotrue, the LFU enable bit (EU) is set. This unloads data from the last
element loaded into the stack (at the position value minus 1), placing it in the
Destination, N7:11. The position value then decrements.
The LFU instruction unloads one element at each falsetotrue transition of
the rung, until the stack is empty. The empty bit (EM) is then set.
Effects on Index Register S:24
The value present in S:24 is overwritten with the position value when a
falseto-true transition of the LFL or LFU rung occurs. For the LFL, the
position value determined at instruction entry is placed in S:24. For the
LFU, the position value determined at instruction exit is placed in S:24.
When the DN bit is set, a false-totrue transition of the LFL rung does not
change the position value or the index register value. When the EM bit is
set, a false-totrue transition of the LFU rung does not change the position
value or the index register value.