# Hardware Implementation - selective set

**4/5**

The selective-set operation sets to 1 the bits in register A where there are corresponding 1's in register B. It does not affect bit positions that have D's in B. The following numerical example clarifies this operation.

1010 A before

1100 B (logic operand)

1110 A after

The two leftmost bits of B are 1' s, so the corresponding bits of A are set to 1. One of these two bits was already set and the other has been changed from 0 to I. The two bits of A with corresponding 0' s in B remain unchanged. The example above serves as a truth table since it has all four possible combinations of two binary variables. From the truth table we note that the bits of A after the operation are obtained from the logic-OR operation of bits in B and previous values of A. Therefore, the OR rnicrooperation can be used to selectively set bits of a register.

**selective-complement: **The selective-complement operation complements bits in A where there are selective-clear corresponding l's in B. It does not affect bit positions that have D's in B. For example

1010 A before

1100 B (logic operand)

0110 A after

Again the two leftmost bits of B are 1's, so the corresponding bits of A are complemented. This example again can serve as a truth table from which one can deduce that the selective-complement operation is just an exclusive-OR rnicrooperation. Therefore, the exclusive-OR rnicrooperation can be used to selectively complement bits of a register.

**4/5**