Skip to main content
@shmVirus

Datapath and Microoperations

Describe clocked data movement with register-transfer notation and build buses, arithmetic circuits, logic circuits, shifters, and an arithmetic logic shift unit.

Updated

Learning objectives

  • Write unconditional and conditional register-transfer statements
  • Explain multiplexer and three-state-buffer implementations of a common bus
  • Specify memory read and write transfers precisely
  • Implement arithmetic, logic, and shift microoperations
  • Trace an arithmetic logic shift unit from control word to stored result

Prerequisites

  • Digital Components

A digital computer is defined internally by its registers, the microoperations performed on their stored values, and the control functions that initiate those microoperations. Register-transfer language makes that behavior precise without descending immediately to individual gates.

Timing rule: the right-hand side of a register-transfer statement is evaluated from the old state during a clock interval; the destination changes at the active edge.

TermMeaning in this chapter
Register transferCopy a word from a named source to a named destination.
MicrooperationOne elementary operation on register contents during a clock interval.
Control functionA Boolean condition that enables a transfer or selects a function.
BusShared word-wide lines carrying one selected value at a time.
Control wordThe complete group of select and load bits applied during one interval.

Register-Transfer Language

The statement

R2R1R_2\leftarrow R_1

means that the binary content of source register R1R_1 is copied into destination register R2R_2. R1R_1 is unchanged; the previous content of R2R_2 is overwritten. The notation assumes a path from R1R_1 to R2R_2 and a parallel-load input on R2R_2.

Register names may be annotated:

  • MARMAR denotes a register by its function;
  • R2(0-7)R_2(0\text{-}7) denotes a selected part;
  • R2(L)R_2(L) and R2(H)R_2(H) may denote low and high portions;
  • a comma separates microoperations that occur concurrently, as in R2R1, R4R3R_2\leftarrow R_1,\ R_4\leftarrow R_3.

Two transfers separated by a comma are legal in one interval only if the datapath has the required independent sources, destinations, and write ports.

Conditional transfer

P:R2R1P:R_2\leftarrow R_1

means “if control function P=1P=1, load R2R_2 from R1R_1 at the next active edge.” It is equivalent to the Boolean control statement

if P then R2R1.\text{if }P\text{ then }R_2\leftarrow R_1.
Hardware implementation of the conditional transfer P colon R2 receives R1 using a source register, destination register with load enable, data path, control gate, and common clock
The data path is continuously available. Control $P$ enables the destination load; the clock edge makes the transfer permanent.

The source output can change combinationally before the edge without changing R2R_2. Setup and hold constraints require the selected value and load enable to remain stable around that edge.

Common Bus Systems

Dedicated wires between every pair of registers scale poorly. A common bus lets many registers share one set of word-wide lines.

Four four-bit registers connected to a four-line common bus through parallel four-to-one multiplexers, with select lines and independent destination load signals
One multiplexer selects the source for each bit of the bus. Separate load controls choose which destination register captures that shared bus value.

For registers A,B,C,DA,B,C,D, source select S1S0S_1S_0 may use:

S1S0S_1S_0Bus source
00AA
01BB
10CC
11DD

To perform R2CR_2\leftarrow C, the controller selects CC onto the bus and asserts LoadR2:

BUSC,R2BUS.BUS\leftarrow C,\qquad R_2\leftarrow BUS.

The two symbolic actions describe one physical transfer: source selection is combinational; destination loading is clocked.

Bus hardware grows with both register count and word width. Eight 16-bit source registers require sixteen 8-to-1 multiplexers—one for each bus bit—and log28=3\log_2 8=3 shared source-select bits. Destination selection is separate: a 3-to-8 decoder can produce eight one-hot load enables. This separation is why several destinations may capture one selected source, while two different sources cannot occupy a single bus simultaneously.

Three-state bus

A multiplexer bus may be replaced by one three-state buffer per source bit. A buffer output can be 0, 1, or high impedance ZZ. Exactly one register’s buffers may be enabled at a time:

  • no enabled source leaves the bus floating unless pull or hold circuitry is provided;
  • two enabled sources can contend, producing an invalid level and excessive current;
  • decoder-generated one-hot enables prevent contention.

Memory Transfers

M[AR]M[AR] denotes the memory word whose address is held in address register ARAR.

OperationRegister-transfer statementRequired control
ReadDRM[AR]DR\leftarrow M[AR]Address valid, memory read asserted, destination load after data is valid
WriteM[AR]DRM[AR]\leftarrow DRAddress and data valid while memory write is asserted

A read does not destroy the memory word. A write changes memory state and therefore must not be asserted until address and data are stable.

Four Classes of Microoperations

  1. Register transfer: copy binary information.
  2. Arithmetic: interpret words as numbers and add, subtract, increment, or decrement.
  3. Logic: manipulate corresponding bits without numeric carry.
  4. Shift: move bit positions logically, arithmetically, or circularly.

The classes describe meaning. One physical ALU may implement several classes by changing its select inputs.

Arithmetic Microoperations

Parallel adder

An nn-bit ripple-carry adder chains nn full adders:

Si=AiBiCi,Ci+1=AiBi+AiCi+BiCi.S_i=A_i\oplus B_i\oplus C_i,\qquad C_{i+1}=A_iB_i+A_iC_i+B_iC_i.

Ci+1C_{i+1} must propagate to the next stage. This makes ripple delay grow with word width.

Adder-subtractor

A common circuit uses mode MM to complement every BB input and supply the initial carry:

Yi=BiM,C0=M,S=A+Y+C0.Y_i=B_i\oplus M,\qquad C_0=M,\qquad S=A+Y+C_0.
MMYYC0C_0Operation
0BB0A+BA+B
1B\overline B1A+B+1=ABA+\overline B+1=A-B

For unsigned subtraction, final carry 1 means no borrow. For two’s-complement signed arithmetic, carry out is not the overflow test:

V=CnCn1.V=C_n\oplus C_{n-1}.

For example, with four bits, 7+37+3 gives 0111 + 0011 = 1010. The carry into the sign bit is 1 and the carry out is 0, so V=1V=1: two positive operands produced a negative four-bit pattern.

Increment and decrement

Increment is RR+1R\leftarrow R+1. A chain of half adders can propagate the initial 1, or an existing adder can use a zero second operand and Cin=1C_{in}=1. Decrement may add an all-ones word:

R1=R+(2n1)(mod2n).R-1=R+(2^n-1)\pmod{2^n}.

Multifunction arithmetic circuit

If multiplexers choose Y{0,B,B,111}Y\in\{0,B,\overline B,11\ldots1\}, one parallel adder computes D=A+Y+CinD=A+Y+C_{in}:

S1S0S_1S_0CinC_{in}YYResult DD
00000Transfer AA
00100Increment AA
010BBA+BA+B
011BBA+B+1A+B+1
100B\overline BA+BA+\overline B
101B\overline BABA-B
110all onesDecrement AA
111all onesTransfer AA with carry out

Logic Microoperations

Logic operations act independently on bit pairs. If A=1100A=1100 and B=1010B=1010:

OperationBitwise result
ABA\land B1000
ABA\lor B1110
ABA\oplus B0110
A\overline A0011

AND can clear selected bits, OR can set selected bits, XOR can toggle selected bits, and a mask can isolate a field. All 16 Boolean functions of two variables are possible, but an ALU commonly implements a useful subset.

Shift Microoperations

ShiftInserted bitPrimary interpretation
Logical left/right0Unsigned multiply/divide by two when no significant bit is lost
Arithmetic rightOld sign bitSigned two’s-complement division by two with rounding caveats
Circular left/rightBit shifted out at opposite endRotation, field manipulation, some cryptographic operations

For 10110110:

  • logical right → 01011011;
  • arithmetic right → 11011011;
  • rotate right → 01011011 because the old low bit happened to be 0.

Arithmetic Logic Shift Unit

One-bit-slice and word-level arithmetic logic shift unit containing input multiplexers, parallel adder, logic circuit, mode selector, shifter, destination register, and status outputs
The ALU first selects arithmetic or logic, then the shifter optionally transforms that result before the destination register loads it.

A typical control word contains:

FieldPurpose
Source A / source BSelect operand registers
ModeChoose arithmetic or logic unit
FunctionChoose add, subtract, AND, OR, XOR, complement, and so on
Carry inComplete increment or two’s-complement subtraction
ShiftNo shift, left, or right
DestinationSelect register load enable

Suppose A=0101A=0101, B=0011B=0011, the arithmetic function is add, carry in is 0, and shift is logical right. The combinational stages produce:

0101+0011=1000,shr(1000)=0100.0101+0011=1000,\qquad \operatorname{shr}(1000)=0100.

The destination remains unchanged during the interval and becomes 0100 only on the active edge.

Timing one microoperation

For R3R1+R2R_3\leftarrow R_1+R_2, the active path may be source register \rightarrow operand multiplexers \rightarrow ALU \rightarrow destination register. Suppose the delays are:

ComponentDelay
Source clock-to-Q80 ps
Operand selection140 ps
Addition350 ps
Destination setup70 ps

Ignoring skew, the clock period must be at least

Tclock=80+140+350+70=640 ps,T_{clock}=80+140+350+70=640\text{ ps},

so this datapath cannot exceed about 1/640 ps=1.561/640\text{ ps}=1.56 GHz. A logic AND using a 90 ps ALU path finishes sooner, but a common clock must still accommodate the slower addition. Pipelining can divide the long path, at the cost of extra registers, latency, and control complexity.

Datapath Resource Conflicts

With one common bus, only one source can drive it during an interval. The simultaneous transfers

R1R2,R3R4R_1\leftarrow R_2,\qquad R_3\leftarrow R_4

cannot both occur if they require different bus sources. The controller must use two cycles or the datapath must provide a second read path. Register-transfer notation is therefore also a resource specification.

Self-Check

  1. Which part of P:R2R1P:R_2\leftarrow R_1 is combinational and which part is clocked?
  2. Why are CnC_n and signed overflow different?
  3. For A=1001A=1001 and B=0011B=0011, compute ABA-B with four-bit two’s-complement addition.
  4. Can two destination registers load the same bus value on one edge?
  5. How many bit-slice multiplexers and select bits are required to place one of 16 different 32-bit registers on a common bus?
Answers
  1. Evaluating PP and routing R1R_1 are combinational; storing into R2R_2 is clocked.
  2. Carry describes the unsigned boundary; signed overflow compares the carries into and out of the sign position.
  3. 1001+0011+1=1001+1100+1=101101001+\overline{0011}+1=1001+1100+1=1\,0110, so the four-bit result is 0110.
  4. Yes, if both load enables are asserted and electrical fan-out permits it.
  5. Thirty-two 16-to-1 multiplexers and four shared select bits.