L9_CMPR: Compare Register
(Original Document)
Naming
Name in LL984 Editor
Function Block Name
name of legacy 984 instruction
name in other tools and editors like:
  • Type Library Browser
  • Data Editor
  • Animation Tables
  • Search Results
Function Description
The L9_CMPR procedure compares the bit pattern in matrix a against the bit pattern in matrix b for miscompares. In a single scan, the two matrices are compared bit position by bit position until a miscompare is found or the end of the matrices is reached (without miscompares).
L9_CMPR has two control inputs. ENABLE initiates the comparison. The state of RESET determines the location in the logic program where the next comparison will start.
The pointer parameter entered in DEST is the pointer to matrix b, the other matrix to be compared. The first element in matrix b is the next contiguous parameter following the pointer parameter. The value stored inside the pointer parameter increments with each bit position in the two matrices that is being compared. As bit position 1 in matrix a and matrix b is compared, the pointer word contains a value of 1; as bit position 2 in the matrices are compared, the pointer value increments to 2; etc. When the outputs signal a miscompare, you can check the accumulated count in the pointer parameter to determine the bit position in the matrices of the miscompare.
The integer value entered in LENGTH specifies a length of the two matrices, i.e. the number of parameters or 16-bit words in each matrix. (matrix a and matrix b have the same length.) The matrix length can range from 1 ... 100, i.e. a length of 2 indicates that matrix a and matrix b contain 32 bits.
L9_CMPR produces three possible outputs (OUT, MIS, INA).
OUT echoes the state of ENABLE. Power is passed to MIS when a miscompare is found. The state of INA indicates whether the miscompared bit in matrix a is a 1  or  a 0.
Representation
Parameters
Input Pin
Name
Data Type
Address Range
Meaning
Top
ENABLE
ON = initiates compare operation
Middle
RESET
BOOL
OFF = restart at last miscompare
ON = restart at the beginning
Node
Node Type
Name
Data Type
Address Range
Meaning
Top
IN
SOURCE
ANY_ARRAY_UINT or ANY_ARRAY_EBOOL
%M, %I, %IW, %MW
Matrix a declared either as an ARRAY[1..LENGTH*16] OF EBOOL or as an ARRAY[1..LENGTH] OF UINT. LENGTH is the value of the LENGTH parameter. The result of LENGTH*16 is represented as an constant.
Middle
IN/OUT
DEST
ANY_ARRAY_UINT
%MW
The comparison pointer followed by matrix b together in one array declared as ARRAY[1..(LENGTH +1)] OF UINT.
The comparison pointer determines the bit position in Matrix a/b. Bit 1 is the MSB (16#8000) in the first word of the matrices.
Bottom
IN
LENGTH
UINT
1...100
matrix length; range: 1 ... 100
Output Pin
Name
Data Type
Address Range
Meaning
Top
OUT
BOOL
echoes the state of ENABLE
Middle
MIS
BOOL
ON = miscompare detected
Bottom
INA
BOOL
ON = miscompared bit in matrix a is 1
OFF = miscompared bit in matrix a is 0