Logical Instruction Types

Each instruction that the Interdata machine understands will be presented below. Where instructions may be of more than one type (e.g. RR, RX, RS), they will be grouped together. Note that some instructions are only valid on machines with appropriate options - this is especially true of the multiply/ divide and floating- point operations.

In general, instructions will be presented by their assembler mnemonics, followed by their class and hexidecimal operation code (opcode). Notes about each instruction's operational characteristics will be presented where appropriate and any effects upon the PSW or CC bits will be discussed.

This page describes the logic class instructions in the Interdata set. Other pages describe:

The AND Halfword instruction takes the logical product (the Boolean AND function) of the first and second operands and places the result into R1. This is a bit- wise operation.

Affected CC bits:

C V G L ------- 0 0 - Result is zero 0 1 - Result is Not zero 1 0 - Result is Not zero

Notes:

The logical AND function is represented by the truth table below:

X Y | Q ---------- 0 0 0 0 1 0 1 0 0 1 1 1

The OR Halfword instruction performs a Boolean OR function between the first first and second operands and places the result into R1. This is a bit- wise operation.

Affected CC bits:

C V G L ------- 0 0 - Result is zero 0 1 - Result is Not zero 1 0 - Result is Not zero

Notes:

The logical OR function is represented by the truth table below:

X Y | Q ---------- 0 0 0 0 1 1 1 0 1 1 1 1

The Exclusive OR Halfword instruction performs a Boolean exclusive OR function between the first first and second operands and places the result into R1. This is a bit- wise operation.

Affected CC bits:

C V G L ------- 0 0 - Result is zero 0 1 - Result is Not zero 1 0 - Result is Not zero

Notes:

The logical exclusive OR function is represented by the truth table below:

X Y | Q ---------- 0 0 0 0 1 1 1 0 1 1 1 0

The Compare Halfword instruction compares the contents of the first and second operands and sets the CC bits accordingly. Neither operand is altered.

Affected CC bits:

C V G L ------- 0 0 - Operands are Equal 0 1 - Operands are Not Equal 1 0 - Operands are Not Equal 1 - First operand less than second operand 0 - First operand equal to or greater than second

The Floating- Point Compare instruction compares the contents of the first and second operands and sets the CC bits accordingly. Neither operand is altered. The comparison is based on the rules of algebra and takes into account sign, exponent, and mantissa.

Affected CC bits:

C V G L ------- 0 0 - Operands are Equal 0 1 - Operands are Not Equal 1 0 - Operands are Not Equal 1 - First operand less than second operand 0 - First operand equal to or greater than second

Notes:

The Floating- Point Compare instruction is an optional instruction and may not appear on all machines.

The Shift Left Halfword Arithmetic instruction shifts the value contained in R1 left by the number specified by the sum of X2 and the Address field. The shift involves bits 1 - 15; bit 0, the sign, is left untouched. The Carry bit receives the contents of bit one following the shifting operation; zeroes are shifted into bit 15.

Affected CC bits:

C V G L ------- 0 0 - Result is zero 0 1 - Result is less than zero 1 0 - Result is greater than zero 0 - The last bit shifted out was a "0" 1 - The last bit shifted out was a "1"

Notes:

The ASHL instruction is useful for integer multiplying a number by a power of two. Shifting by one bit position is equivalent to multyplying by two, two bit positions, by four, etc.

The Shift Right Halfword Arithmetic instruction shifts the value contained in R1 right by the number specified by the sum of X2 and the Address field. The shift involves bits 1 - 15; bit 0, the sign, is left untouched. The Carry bit receives the contents of bit 15 following the shifting operation; zeroes are shifted into bit 1.

Affected CC bits:

C V G L ------- 0 0 - Result is zero 0 1 - Result is less than zero 1 0 - Result is greater than zero 0 - The last bit shifted out was a "0" 1 - The last bit shifted out was a "1"

Notes:

The ASHL instruction is useful for integer dividing a number by a power of two. Shifting by one bit position is equivalent to dividing by two, two bit positions, by four, etc.

The Shift Left Logical Halfword instruction shifts the value contained in R1 left by the number specified by the sum of X2 and the Address field. The shift involves all 16 bits of the halfword. The Carry bit receives the contents of bit 0 following the shifting operation; zeroes are shifted into bit 15.

Affected CC bits:

C V G L ------- 0 0 - Result is zero 0 1 - Result is less than zero 1 0 - Result is greater than zero 0 - The last bit shifted out was a "0" 1 - The last bit shifted out was a "1"

The Shift Right Logical Halfword instruction shifts the value contained in R1 right by the number specified by the sum of X2 and the Address field. The shift involves all 16 bits of the halfword. The Carry bit receives the contents of bit 15 following the shifting operation; zeroes are shifted into bit 0.

Affected CC bits:

This page described the logic class of instructions in the Interdata set. Other pages describe:

- Architecture Overview
- Load/Store Instructions
- Arithmetic Instructions
- Branching Instructions
- Input/Output Instructions

Copyright © 1997 - 2003, Carl R. Friend. All rights reserved.

Webspace design by: Carbon & Silicon Alliance

Comments to: carl.friend@rcsri.org Last Modified: Sat May 13 13:04:15 EDT 2000