Register Transfer and Microoperations
Logic Microoperations

Logic Microoperations

Logic microoperations specify binary operations for strings of bits stored in registers. These operations consider each bit of the register separately and treat them as binary variables. For example, the exclusive-OR microoperation with the contents of two registers R1 and R2 is symbolized by the statement:

P:R1R1R2P: R1 \leftarrow R1 \oplus R2

This specifies a logic microoperation to be executed on the individual bits of the registers provided that the control variable P=1P = 1. As a numerical example, assume that each register has four bits. Let the content of R1R1 be 1010 and the content of R2R2 be 1100. The exclusive-OR microoperation stated above symbolizes the following logic computation:

  • 1010 Content of R1
  • 1100 Content of R2
  • 0110 Content of R1 after P=1P = 1

The content of R1R1, after the execution of the microoperation, is equal to the bit-by-bit exclusive-OR operation on pairs of bits in R2R2 and previous values of R1R1. The logic microoperations are seldom used in scientific computations, but they are very useful for bit manipulation of binary data and for making logical decisions.

Special Symbols

Special symbols are adopted for the logic microoperations OR, AND, and complement, to distinguish them from the corresponding symbols used to express Boolean functions. The symbol \vee will be used to denote an OR microoperation and the symbol \wedge to denote an AND microoperation. The complement microoperation is the same as the 1's complement and uses a bar on top of the symbol that denotes the register name.

By using different symbols, it is possible to differentiate between a logic microoperation and a control (or Boolean) function. Another reason for adopting two sets of symbols is to be able to distinguish the symbol ++, when used to symbolize an arithmetic addition, from a logic OR operation. Although the ++ symbol has two meanings, it is possible to distinguish between them by noting the context in which the symbol occurs. When the symbol ++ occurs in a microoperation, it denotes an arithmetic addition. When it occurs in a control (or Boolean) function, it denotes an OR operation. For example, in the statement:

P+Q:R1R2+R3,R4R5R6P + Q: R1 \leftarrow R2 + R3, \quad R4 \leftarrow R5 \vee R6

The ++ between PP and QQ is an OR operation between two binary variables of a control function. The ++ between R2R2 and R3R3 specifies an addition microoperation. The OR microoperation is designated by the symbol \vee between registers R5R5 and R6R6.

List of Logic Microoperations

There are 16 different logic operations that can be performed with two binary variables. These operations can be determined from all possible truth tables obtained with two binary variables. The 16 Boolean functions of two variables xx and yy are expressed in algebraic form, and the corresponding logic microoperations are derived by replacing variable xx with the binary content of register AA and variable yy with the binary content of register BB. Each bit of the register is treated as a binary variable and the microoperation is performed on the string of bits stored in the registers.

Boolean FunctionMicrooperationDescription
F0=0F_0 = 0F0F \leftarrow 0Clear
F1=xyF_1 = xyFABF \leftarrow A \wedge BAND
F2=xyˉF_2 = x \bar{y}FABˉF \leftarrow A \wedge \bar{B}AND with NOT B
F3=xF_3 = xFAF \leftarrow ATransfer A
F4=xˉyF_4 = \bar{x} yFAˉBF \leftarrow \bar{A} \wedge BNOT A AND B
F5=yF_5 = yFBF \leftarrow BTransfer B
F6=xyF_6 = x \oplus yFABF \leftarrow A \oplus BExclusive-OR
F7=xyF_7 = x \vee yFABF \leftarrow A \vee BOR
F8=xyF_8 = \overline{x \vee y}FABF \leftarrow \overline{A \vee B}NOR
F9=xyF_9 = \overline{x \oplus y}FABF \leftarrow \overline{A \oplus B}Exclusive-NOR
F10=yˉF_{10} = \bar{y}FBˉF \leftarrow \bar{B}Complement B
F11=xyˉF_{11} = x \vee \bar{y}FABˉF \leftarrow A \vee \bar{B}OR with NOT B
F12=xˉF_{12} = \bar{x}FAˉF \leftarrow \bar{A}Complement A
F13=xˉyF_{13} = \bar{x} \vee yFAˉBF \leftarrow \bar{A} \vee BNOT A OR B
F14=xyF_{14} = \overline{xy}FABF \leftarrow \overline{A \wedge B}NAND
F15=1F_{15} = 1Fall 1’sF \leftarrow \text{all 1's}Set all bits to 1

Hardware Implementation

The hardware implementation of logic microoperations requires that logic gates be inserted for each bit or pair of bits in the registers to perform the required logic function. Although there are 16 logic microoperations, most computers use only four—AND, OR, XOR (exclusive-OR), and complement—from which all others can be derived.

A typical stage of a circuit that generates the four basic logic microoperations consists of four gates and a multiplexer. Each of the four logic operations is generated through a gate that performs the required logic. The outputs of the gates are applied to the data inputs of the multiplexer. The two selection inputs S1S_1 and S0S_0 choose one of the data inputs of the multiplexer and direct its value to the output. This stage must be repeated for each bit in the register.

Applications of Logic Microoperations

Logic microoperations are very useful for manipulating individual bits or a portion of a word stored in a register. They can be used to change bit values, delete a group of bits, or insert new bit values into a register. The following examples illustrate some of these operations:

Selective-Set

The selective-set operation sets to 1 the bits in register AA where there are corresponding 1's in register BB. It does not affect bit positions that have 0's in BB. For example:

  • 1010 AA before
  • 1100 BB (logic operand)
  • 1110 AA after

The OR microoperation can be used to selectively set bits of a register:

AABA \leftarrow A \vee B

Selective-Complement

The selective-complement operation complements bits in AA where there are corresponding 1's in BB. It does not affect bit positions that have 0's in BB. For example:

  • 1010 AA before
  • 1100 BB (logic operand)
  • 0110 AA after

The exclusive-OR microoperation can be used to selectively complement bits of a register:

AABA \leftarrow A \oplus B

Selective-Clear

The selective-clear operation clears to 0 the bits in AA where there are corresponding 1's in BB. For example:

  • 1010 AA before
  • 1100 BB (logic operand)
  • 0010 AA after

The AND microoperation with the complement of BB can be used to selectively clear bits of a register:

AABˉA \leftarrow A \wedge \bar{B}

Mask Operation

The mask operation clears bits in AA where there are corresponding 0's in BB. For example:

  • 1010 AA before
  • 1100 BB (logic operand)
  • 1000 AA after masking

The mask operation is an AND microoperation:

AABA \leftarrow A \wedge B

Insert Operation

The insert operation inserts a new value into a group of bits. This is done by first masking the bits and then ORing them with the required value. For example, to replace the four leftmost bits of an 8-bit register AA (01101010) with the value 1001:

  1. Mask the four unwanted bits:

    • 01101010 (A before)
    • 00001111 (B mask)
    • 00001010 (A after masking)
  2. Insert the new value:

    • 00001010 (A before)
    • 10010000 (B insert)
    • 10011010 (A after insertion)

The insert operation involves both AND and OR microoperations:

A(Amask)valueA \leftarrow (A \wedge \text{mask}) \vee \text{value}

Clear Operation

The clear operation compares the words in AA and BB and produces an all 0's result if the two numbers are equal. This operation is achieved by an exclusive-OR microoperation:

  • 1010 AA
  • 1010 BB
  • 0000 AABA \leftarrow A \oplus B

When AA and BB are equal, the result of the exclusive-OR operation is an all-0's word. This result can then be checked to determine if the two numbers were equal.

Logic microoperations are fundamental tools in digital logic design, enabling efficient bit manipulation and logical decision-making in various computing tasks.