RegisterA holds the 8-bits 11011001. Determine the B operand and the logic micro-operation to be performed in order to change the value in A to: 5m Dec2005

RegisterA holds the 8-bits 11011001. Determine the B operand and the logic micro-operation to be performed in order to change the value in A to: 5m Dec2005

01101101

11111101

First refer the table for Logic micro-operations which can be applied.

R1:- 1 0 1 0 (initial value) R2:- 1 1 0 0 (initial value)

Operation name

What is the operation?

Explanation

Example

Selective Set

Sets those bits in Register R1 for which the corresponding R2 bit is 1.

The value 1110 suggests that selective set can be done using logic OR micro-operation.Please note that all those bits of R1, for which we have 0 bit in R2, have remained unchanged. The bits in R1 which need to be set selectively must have the corresponding R2 bits as 1.

1010 = R11100 = R21110

Selective Clear

Clear those bits in register R1 for which corresponding R2 bits are 1.

The R1 value after the operation is 0010which suggests that Corresponding micro-operation is R1 AND Compliment R2

1010 = R11100 = R20010

Selective Complement

Complement those bits in register R1 for which the corresponding R2 bits are 1.

The R1, value 0110 after the operation suggests that the selective complement can be done using exclusive – OR micro-operation.The bits in R1 which need to be complemented selectively must have the corresponding R2 bits as 1.

1010 = R11100 = R20110

Mask Operations

Clears those bits in Register R1 for which the corresponding R2 bits are 0.

The R1 value after the operation is 1000 which suggests that the mask operation can be performed using AND micro-operation.However, the bits in R1 which are cleared or masked correspond to the bits on R2 having a 0 value. The mask operation is preferred over selective clear as most of the computers provide AND micro-operation while the micro-operation required for implementing selective clear is normally not provided in computers

1010 = R11100 = R21000

Clear

Clear all the bits

Implemented by taking exclusive OR with the same number. The exclusive OR, thus, can also be used for checking whether two numbers are equal or not.

1010 = R11010 = R10000

Insert

For inserting a new value in a bit. It is a two-step process: Step 1: Mask out the existing bit valueStep 2: Insert the bit using OR micro-operation with the bits which are to be inserted.

This is a two-step process. Example:Say contents of R1 = 0011 1011Suppose, we want to insert 0110 in place of left most 0011 then:0011 1011 (R1 before)0000 1111 (R2 for masking)