COA Notes
Arithmetic micro-operations including addition, subtraction, increment, decrement, and their hardware implementation.
Introduction
Arithmetic micro-operations are the basic calculations performed on data stored in registers. They're called "micro-operations" because they're the smallest unit of work the hardware can perform — each one completes in a single clock cycle. When you execute an ADD instruction, the CPU breaks it down into micro-operations like "read register A, read register B, add them, write result to register C." Let's explore each type and see how they're implemented in hardware.
Types of Arithmetic Micro-operations
The fundamental arithmetic micro-operations are:
| RTL Notation | Operation | Description |
|---|---|---|
| R3 ← R1 + R2 | Addition | Add two registers |
| R3 ← R1 - R2 | Subtraction | Subtract R2 from R1 |
| R1 ← R1 + 1 | Increment | Add 1 to register |
| R1 ← R1 - 1 | Decrement | Subtract 1 from register |
| R1 ← R̄1 + 1 | Negate (2's complement) | Negate the value |
| R3 ← R1 + R̄2 + 1 | Subtract via complement | A - B = A + B̄ + 1 |
Addition Micro-operation
RTL Description
Hardware: Binary Adder
The binary adder is built from full adder cells cascaded together:
Each full adder takes three inputs (A, B, Carry-in) and produces two outputs (Sum, Carry-out). The carry ripples from LSB to MSB — this is the ripple carry adder.
Full Adder Truth Table
| A | B | Cin | Sum | Cout |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 | 1 |
Subtraction Micro-operation
The Complement Method
Instead of building a separate subtractor, we reuse the adder:
Hardware: Adder-Subtractor
By adding XOR gates to the B input, we can build a combined adder-subtractor:
This elegant design means we need only ONE hardware unit for both addition and subtraction.
Increment Micro-operation
RTL Description
Hardware Implementation
A dedicated incrementer can be simpler than a full adder. It's implemented using half adders cascaded together with the initial carry set to 1:
Half adder: Sum = A ⊕ 1 = Ā (for the first stage, complement the bit if carry-in is 1)
Decrement Micro-operation
RTL Description
Implementation
Can be done as: R1 + all_ones (adding -1 in two's complement) Or using a specialized decrementer circuit (cascade of half-subtractors with initial borrow = 1)
Negate (Two's Complement) Micro-operation
RTL Description
Hardware
- Pass R1 through NOT gates (complement each bit)
- Pass result through incrementer (add 1)
- Store back in R1
This converts positive to negative and vice versa.
The Arithmetic Circuit: A Complete Unit
A practical arithmetic circuit combines these operations using a controlled adder:
| S1 | S0 | Cin | B_modified | Operation | Result |
|---|---|---|---|---|---|
| 0 | 0 | 0 | B | Add | A + B |
| 0 | 0 | 1 | B | Add with carry | A + B + 1 |
| 0 | 1 | 0 | B̄ | Subtract - 1 | A + B̄ (= A - B - 1) |
| 0 | 1 | 1 | B̄ | Subtract | A + B̄ + 1 (= A - B) |
| 1 | 0 | 0 | 0 | Transfer A | A |
| 1 | 0 | 1 | 0 | Increment A | A + 1 |
| 1 | 1 | 0 | All 1s | Decrement A | A - 1 |
| 1 | 1 | 1 | All 1s | Transfer A | A (through carry) |
This single circuit handles ALL arithmetic micro-operations by controlling the B input and carry-in.
Status Flags
Arithmetic operations produce status information stored in a condition code register:
- C (Carry): Carry out of the MSB — indicates unsigned overflow
- Z (Zero): Result is zero — all bits are 0
- N (Negative): MSB of result is 1 (negative in two's complement)
- V (Overflow): Signed overflow — carry into MSB ≠ carry out of MSB
These flags are used by conditional branch instructions to make decisions.
Key Takeaways
- Arithmetic micro-operations are single-clock-cycle calculations on register contents
- The binary adder (cascade of full adders) is the fundamental building block
- Subtraction is implemented as addition with two's complement (A + B̄ + 1)
- A single adder circuit with input logic handles ADD, SUB, INCREMENT, DECREMENT, and NEGATE
- Status flags (C, Z, N, V) record the conditions of each arithmetic result
- This shared hardware design is exactly how real ALUs are built — one circuit, many operations
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Arithmetic Micro-operations.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Computer Organization & Architecture topic.
Search Terms
computer-organization, computer organization & architecture, computer, organization, register, transfer, and, microoperations
Related Computer Organization & Architecture Topics