Data Manipulation Micro-Operations in COA: Arithmetic, Logic and Shift Operations Worked Step by Step

Learn a fixed-width method for tracing arithmetic, logic, and shift micro-operations. Every example tracks register values, result bits, carry, and overflow.

KnowledgeGate Team

Exam prep & CS education

Updated 19 Oct 20265 min read

You may know arithmetic, logic, and shift micro-operations, yet lose track when register arrows, carry bits, and signed values appear together. Freeze the word width, then trace every source, result, and flag separately.

Data manipulation micro-operations act on register contents

A micro-operation is an elementary register-data operation, usually completed in one clock step under control signals. Read R3 ← R1 + R2 as: sample old R1 and R2, add at the fixed width, then load R3 at the clock edge.

A register transfer such as R2 ← R1 copies data. Arithmetic changes a numeric value, logic changes selected bits, and shifting moves bit positions. CPUs may combine an ALU and shifter, but control encoding is architecture-specific.

RTL control functions and common-bus design come first in Register Transfer and Microoperations in COA. Fixed-width 8-bit calculations then isolate arithmetic, logic masks, shifts, flags, and clock-edge state changes.

Each register holds 8 bits. We group binary into nibbles, check it in hexadecimal, and label unsigned or two's-complement signed meaning. Revise with Number Systems and Base Conversions Explained if needed.

Arithmetic micro-operations: add, subtract, increment, and flags

Fix R1 = 1011 0110 (0xB6, 182 unsigned, -74 signed) and R2 = 0010 1101 (0x2D, 45). Add them:

Code
  1011 0110
+ 0010 1101
= 1110 0011

The result is 0xE3, 227 unsigned or -29 signed, with carry 0. Signed overflow is 0 because the operands have different signs.

Perform subtraction through the adder identity R1 - R2 = R1 + NOT(R2) + 1:

Code
NOT(0010 1101) = 1101 0010
1101 0010 + 1 = 1101 0011
1011 0110 + 1101 0011 = 1 1000 1001

Discard the ninth bit. Store 1000 1001 (0x89, 137 unsigned or -119 signed). Here carry-out 1 means no unsigned borrow.

Related results are R2 + 1 = 0010 1110 (46), R2 - 1 = 0010 1100 (44), and R1 + R2 + 1 = 1110 0100 (0xE4).

Carry and overflow differ. 0111 1111 + 0000 0001 = 1000 0000 has carry 0 but overflow 1, since 127 + 1 does not fit signed 8-bit form. 1111 1111 + 0000 0001 = 1 0000 0000 has carry 1 but no overflow because -1 + 1 = 0 is valid. Carry observes the ninth unsigned bit. Overflow checks the signed range.

Logic micro-operations: masks, toggles, and field insertion

Apply each logic operation bit by bit to the same R1 and R2:

Operation

8-bit result

Hex

Unsigned

R1 AND R2

0010 0100

0x24

36

R1 OR R2

1011 1111

0xBF

191

R1 XOR R2

1001 1011

0x9B

155

NOT R1

0100 1001

0x49

73

AND clears or preserves, OR sets or preserves, XOR toggles where its mask has 1, and NOT flips every bit.

For field insertion, let D = 1011 0010 and S = 0000 0101. Clear low D with D AND 1111 0000 = 1011 0000. Isolate low S with S AND 0000 1111 = 0000 0101. OR them to get 1011 0101 (0xB5). Upper 1011 remains, while low 0101 is inserted.

Field insertion in eight bits: D 1011 0010 AND mask 1111 0000, S 0000 0101 AND mask 0000 1111, ORed to give D 1011 0101 or 0xB5.

Instruction fields differ from logic operations applied to register bits after decoding. Their encoding does not imply a universal ALU control code.

Shift micro-operations: logical, circular, and arithmetic cases

Take Q = 1011 0111 (0xB7, 183 unsigned or -73 signed). Its end bits are both 1.

Operation

Result

What happens to the expelled bit

Logical left

0110 1110

Old MSB 1 goes out

Logical right

0101 1011

Old LSB 1 goes out

Rotate left

0110 1111

Old MSB 1 re-enters at bit 0

Rotate right

1101 1011

Old LSB 1 re-enters at bit 7

Arithmetic right copies the sign bit: 1011 0111 → 1101 1011, or -37. This divides by two with the negative odd result rounding down; logical right gives positive 91. Arithmetic left also gives 0110 1110, but -73 × 2 = -146 is outside the signed 8-bit range, so the sign change shows overflow.

Use logical shift when zeros enter, rotate when the expelled bit returns, and arithmetic right to preserve a signed value's sign. Record the outgoing bit separately, then test overflow separately.

Trace a complete micro-operation sequence clock by clock

Start with A = 1011 0110 (0xB6) and B = 0010 1101 (0x2D). Each row uses pre-edge values.

Clock

Sources before edge

Selected operation

8-bit result

Carry or outgoing bit

Destination after edge

T0

A = 1011 0110, B = 0010 1101

A AND B

0010 0100

Not applicable

C = 0010 0100

T1

C = 0010 0100, B = 0010 1101

C + B

0101 0001

Carry 0

C = 0101 0001

T2

C = 0101 0001

Logical left

1010 0010

Outgoing 0

C = 1010 0010

T3

C = 1010 0010, mask 0000 1111

C XOR mask

1010 1101

Not applicable

C = 1010 1101

Check in hexadecimal: 0x24 + 0x2D = 0x51, 0x51 << 1 = 0xA2, and 0xA2 XOR 0x0F = 0xAD. Final C = 1010 1101 (0xAD, 173 unsigned or -83 signed).

An ALU forms a result, an optional shifter moves it, a multiplexer selects the input, and the clock loads the register. Our toy selector uses 00 = AND, 01 = ADD, 10 = logical left, and 11 = XOR, giving 00, 01, 10, 11.

Clock-by-clock trace from A 1011 0110 and B 0010 1101: AND gives 0x24, add B gives 0x51, logical left 0xA2, XOR mask 0xAD.

Data manipulation micro-operation exam patterns and traps

Questions may ask you to evaluate an operation, trace a sequence, decode a control table given in the question, or select a mask or shift. Use this order:

  1. Freeze the word width.

  2. Copy all old source values.

  3. Compute one clock row.

  4. Retain only eight result bits.

  5. Record flags separately.

  6. Update the destination only at the edge.

For simultaneous A ← A + B and B ← A XOR B, old A = 0xB6 and B = 0x2D produce new A = 0xE3 and B = 0x9B. Using new A too early wrongly gives B = 0xCE.

Other traps are confusing rotate with shift, equating carry with overflow, omitting the subtraction +1, and assuming signed meaning. KnowledgeGate has over 10 practice questions on these micro-operations. Place the topic in the broader GATE CS Exam Preparation map. Once hand tracing is reliable, use the GATE Test Series for wider timed practice.

The short version and the next practice step

Arithmetic changes values and flags, logic reshapes selected bits, and shifts move bit positions. Preserve fixed width, keep sources unchanged until the edge, and separate carry from overflow.

Recompute the addition and subtraction, reproduce the field insertion, trace every shift case on Q, then rebuild the T0 to T3 table. For organised COA and wider subject coverage, GATE Guidance by Sanchit Sir is the next structured step.