• Aucun résultat trouvé

TR °1(lsBl)s02(B2) [SS]

I

B 1

I

/

~U

lOCi l °1 B2

/

0 8 16 20 32 36 47

The bytes of the first operand are used as eight-bit arguments to reference a list designated by the second-operand address. Each function byte selected from the list replaces the corresponding argument in the first operand.

The L field designates the length of only the first operand.

The bytes of the first operand are selected orie by one for translation, proceeding left to right.

Each argument byte is added to the initial

second-operand address. The addition is performed following the rules for address arithmetic, with the argument byte treated as an eight-bit unsigned binary integer and extended with high-order zeros.

The sum is used as the address of the function byte, which then replaces the original argument byte.

The operation proceeds until the first-operand field is exhausted. The list is not altered unless an overlap occurs.

When the operands overlap, the result is obtained as if each result byte Were stored

immediately after the corresponding function byte is fetched.

Access exceptions are recognized only for those bytes in the second operand which are actually required.

Condition Code: The code remains unchanged.

Program Exceptions:

Access (fetch, operand 2; fetch and store, operand 1)

7-36 IBM 4300 Processors Principles of Operation

Programming Notes

1. An example of the use of TRANSLATE is given in Appendix A.

2. The instruction TRANSLATE may be used to convert data from one code to another code.

3. The instruction may also be used to rearrange data. This may be accomplished by placing a pattern in the destination area, by designating the pattern as the first operand of

TRANSLA TE, and by designating the data that is to be rearranged as the second operand.

Each byte of the pattern contains an eight..,bit number specifying the byte destined for this position. Thus, when the instruction is executed, the pattern selects the bytes of the second operand in the desired order.

4. The fetch and subsequent store accesses to a particular byte in the first-operand field do not necessarily occur one immediately after the other. Thus, this instruction cannot be safely used to update a location in storage if the possibility exists that another CPU or a channel may also be updating the location. An example of this effect is shown for the instruction OR (01) in the section "Multiprogramming and Multiprocessing Examples '.' in Appendix A.

5. Because each eight-bit argument· byte is added to the initial second-operand address to obtain the address of a function byte, the list may contain 256 bytes. In cases where it is known that not all eight-bit argument values will occur, it is possible to reduce the size of the list.

I

6. Significant performance degradation is possible when the second-operand address of

TRANSLA TE designates a location that is less than 256 bytes to the left of a2,048-byte boundary. This is because the machine may perform a trial execution of the' instruction to determine if the secondoperand actually crosses the boundary.

TRANSLATE AND TEST

The bytes of the first operand .are· used as eight..;bit arguments to select function bytes from a list designated by the second-operand address. The,

first nonzero function byte is inserted in general register 2, and the related argument address in general register 1.

The L field designates the length of only the first operand.

The bytes of the first operand are selected one by one for translation, proceeding from left to right. The first operand remains unchanged in storage. Fetching of the function byte from the list is performed as in TRANSLATE. The function byte retrieved from the list is inspected for a value of zero.

When the function byte is zero, the operation proceeds with the next byte of the first operand.

When the first-operand field is exhausted before a nonzero function byte is encountered, the operation is completed by setting condition code O. The contents of general registers 1 and 2 remain unchanged.

When the function byte is nonzero, the operation is completed by inserting the function byte in general register 2 and the related argument address in general register 1. This address points to the argument byte last translated. The function byte replaces bits 24-31 of general register 2. The address replaces bits 8-31 of general register 1.

Bits 0-7 of general register 1 and bits 0-23 of general register 2 remain unchanged.

When the function byte is nonzero, either condition code 1 or 2 is set, depending on whether the argument byte is the rightmost byte of the first operand. Condition code 1 is set if one or more argument bytes remain to be translated. Condition code 2 is set if no more argument bytes remain.

Access exceptions are recognized only for those bytes in the second operand which are actually required. Access exceptions are not recognized for those bytes in the first operand which are to the right of the first byte for which a nonzero function byte is obtained.

Resulting Condition Code:

o

All function bytes zero

1 Nonzero function byte; first-operand field not exhausted

2 Nonzero function byte; first-operand field exhausted

3

Program Exceptions:

Access (fetch, operands 1 and 2)

Programming Notes

1. An example of the use of TRANSLATE AND TEST is given in Appendix A.

2. The instruction TRANSLATE AND TEST may be used to scan the first operand for characters with special meaning. The second operand, or list, is set up with all-zero function bytes for those characters to be skipped over and with nonzero function bytes for the characters to be detected.

UNPACK

UNPK D1(L1,B1),D2(L2,B2) [55]

'F31

I

Ll

I

L2

I

81

I ~_1 --L....-B_2...J....-~~

o

8 12 16 20 32 36 47

The format of the second operand is changed from packed to zoned, and the result is placed in the first-operand location. The packed and zoned formats are described in Chapter 8, IIDecimal Instructions. II

The second operand is treated as having the packed format. Its digits and sign are placed unchanged in the first-operand location, using the zoned format. Zones with coding of 1111 are supplied for all bytes except the low-order byte, which receives the sign of the second operand. The sign and digits are not checked for valid codes.

The result is obtained as if the operands were processed right to left. When necessary, the second operand is considered to be extended on the left with zeros. If the first-operand field is too short to contain all digits of the second operand, the

remaining leftmost portion of the second operand is ignored. Access exceptions for the unused portion

· of the second operand mayor may not be indicated.

When the operands overlap, the result is obtained as if the operands were processed one byte at a time and each result byte were stored immediately after the necessary operand byte is fetched. The entire rightmost second-operand byte is used in forming the first result byte. For the remainder of the field, information for two result bytes is obtained from a single second-operand byte, and the leftmost four bits of the byte remain

available and are not refetched. Thus, two result bytes are stored immediately after fetching a single operand byte.

Chapter 7. General Instructions 7-37

Condition Code: The code remains unchanged.

Program Exceptions:

Access (fetch, operand 2; store, operand 1) Programming Notes

1. An example of the use of UNPACK is given in Appendix A.

2. A field that is to be unpacked can be destroyed by improper overlapping. To save storage space for unpacking by overlapping the operands, the rightmost position of the first operand must be to the right of the rightmost position of the second operand by the number of bytes in the second operand minus 2. If only one or two bytes are to be unpacked, the low-order positions of the two operands may coincide.

7-38 IBM 4300 Processors Principles of Operation

Chapter 8. Decimal Instructions

Contents