1. List Search SER/SERD/SERF

1. List Search SER/SERD/SERF

1.1. Instruction description

The single word list lookup (SER) instruction gives a matching value (V), performs a search in the list, returns the first matching position, and the total number of matches found. These two values are saved in RES and the following register. The double words list lookup (SERD) uses double characters, and the floating-point list lookup (SERF) uses floating-point. The index and quantity returned are always two single characters.

Floating point search requires two values to be given, and will search for the value between these two values

For example, SER K123 D10 D120 K6, search for 123 in D10 to D15, and store the search results in D120 and D121.

Single word List Search

图1 Single word List Search

SERD K5678901 D10 D120 K5, search for 5678901 in D10D11 to D18D19, and store the search results in D120 and D121.

Double Word List Search

图2 Double Word List Search

SERF K0.99 K1.01 D10 D120 K6, search for values between 0.99 and 1.01 in D10D11 to D20D21, and store the search results in D120 and D121.

Floating List Search

图3 Floating List Search

1.2. The valid operands of the instruction

1.2.1. Single word List Search(SER)

Input/Output Data Type operand Description
IN 16 bit integer D/CV/TV/AI/AO/K/H/V/Z/FD, bit composite word (X/Y/M/C/T/S), local variable (LW) current value
T 16 bit integer D List
RES 16 bit integer D/CV/TV/AO/V/Z, bit composite word (Y/M/C/T/S), local variable (LW) result
N 16 bit integer D/CV/TV/AI/AO/K/H/V/Z/FD, bit composite word (X/Y/M/C/T/S), local variable (LW) length

1.2.2. Double word List Search(SERD)

Input/Output Data Type operand Description
IN 32-bit integer D/CV/K/H/FD, bit composite word (X/Y/M/C/T/S), local variable (LD) current value
T 32-bit integer D List
RES 16 bit integer D/CV/TV/AO/V/Z, bit composite word (Y/M/C/T/S), local variable (LW) result
N 16 bit integer D/CV/TV/AI/AO/K/H/V/Z/FD, bit composite word (X/Y/M/C/T/S), local variable (LW) length

1.2.3. Floating List Search(SERF)

Input/Output Data Type operand Description
MIN 32-bit real number D/K/FD, local variable (LF) minimum
MAX 32-bit real number D/K/FD, local variable (LF) maximum
T 32-bit Real Number D List
RES 16 bit integer D/CV/TV/AO/V/Z, bit composite word (Y/M/C/T/S), local variable (LW) result
N 16 bit integer D/CV/TV/AI/AO/K/H/V/Z/FD, bit composite word (X/Y/M/C/T/S), local variable (LW) length

1.3. Example

Command table:

NETWORK 000

LDP X000

SER K123 D10 D120 K6 // Search for values between D10 and D15, and return matching results to D120 and D121.

SER

图4 SER