Introduction to Digital Logic

Chapter 12
Register-Transfer Systems and Basic Processor Datapaths

Bachelors Program in IT
Introduction to Digital Logic   •   Bachelor

Register-Transfer Systems and Basic Processor Datapaths

Introduction

A digital system becomes a processor when it can store binary information, transform it, and control the sequence of transformations. Registers provide temporary storage, combinational circuits perform operations, buses transfer values, and control logic selects and sequences these activities. Together, these elements form a register-transfer system and, at a larger scale, a processor datapath.

Register-transfer design provides a bridge between Boolean logic and computer architecture. Instead of describing every transistor or gate, the designer describes transfers and operations between registers. These descriptions can then be implemented with multiplexers, decoders, arithmetic circuits, flip-flops, and control signals.

For example, the register-transfer statement R2 ← R1 means that the contents of register R1 are copied into R2 at an active clock edge. The statement R3 ← R1 + R2 means that an arithmetic circuit adds the two source registers and loads the result into R3. Such notation is compact, precise, and central to processor design.

Learning Objectives

After studying this chapter, a student should be able to:

  • interpret and write register-transfer notation;
  • distinguish registers, buses, multiplexers, and tri-state interfaces;
  • design an arithmetic logic unit (ALU) and identify its status outputs;
  • construct a basic datapath for instruction execution;
  • explain hardwired control and timing of microoperations;
  • analyze datapath limitations, hazards, and implementation trade-offs;
  • relate register-transfer systems to processors, microcontrollers, and digital devices.

1. Register-Transfer Concepts

A register is a group of edge-triggered flip-flops that stores a binary word. An n-bit register contains n flip-flops and can represent one of 2n possible bit patterns. A register has a data input, a clock, and commonly an enable and reset input.

A transfer occurs when the destination register is enabled and the clock edge arrives. If E is an enable signal, the next state of a register may be described as:

Q(t+1) = E·D + ¬E·Q(t)

Here, Q(t) is the present register content, D is the input word, E is the enable, and Q(t+1) is the content after the active clock edge. The expression assumes an active-high enable and synchronous loading. If E = 1, the register loads D; if E = 0, it retains its previous value.

Register-transfer notation

Common notation includes:

NotationMeaning
R2 ← R1Copy R1 into R2
R1 ← 0Clear R1
R1 ← R1 + 1Increment R1
R3 ← R1 + R2Add two registers and store the result
P: R2 ← R1Perform the transfer when control signal P is active
R1 ← R1[7:0]]Load a selected field or slice, subject to word-size rules

Several transfers separated by commas or semicolons are considered simultaneous when they occur during the same clock period, provided that the hardware supports them. Thus, R1 ← R2, R3 ← R4 can occur in parallel. However, R1 ← R2, R2 ← R3 requires careful interpretation: both right-hand sides refer to the old values, not to values updated halfway through the clock event.

A microoperation is a basic operation performed on data stored in registers. Typical microoperations are register transfer, arithmetic, logic, and shift operations. A sequence of microoperations forms the internal steps of instruction execution.

2. Buses and Data Movement

A bus is a shared set of conductors used to transfer a word between components. An n-bit bus has n parallel signal lines. A bus reduces wiring compared with connecting every register directly to every other register, but it normally permits only one source to drive it at a time.

Multiplexer-based buses

A multiplexer bus connects the outputs of several registers to a common destination. For k possible source registers, a selection network requires enough control bits to encode the selected source. The minimum number of select bits is:

s = ⌈log₂ k⌉

This formula assumes binary selection and that all source choices must be represented. If k is not a power of two, some select codes remain unused.

For example, four 8-bit registers require an 8-bit, 4-to-1 multiplexer bank and two select lines. If the select value is 10₂, the third register is connected to the bus. A destination register loads the bus only when its load-enable signal is asserted.

Tri-state buses

A tri-state driver can produce logic 0, logic 1, or high impedance. High impedance electrically disconnects the driver from the shared bus. Tri-state systems require strict control: two drivers must never be enabled simultaneously, because contention can produce incorrect values and excessive current. Modern integrated circuits often implement internal buses with multiplexers rather than physical tri-state wiring, although tri-state interfaces remain common at chip boundaries.

Bus timing

A synchronous bus transfer normally follows this sequence:

  1. The control unit selects a source.
  2. The source drives the bus.
  3. Combinational propagation allows the bus value to settle.
  4. The destination enable is asserted.
  5. The active clock edge stores the value.

The clock period must be long enough for selection, propagation, setup, and clock-to-output delays. A simplified timing constraint is:

Tclk ≥ tco + tlogic + tsetup + tskew

Here, Tclk is the clock period, tco is source clock-to-output delay, tlogic is combinational delay, tsetup is destination setup time, and tskew represents clock skew and related margin. The relation is a design constraint, not an exact universal performance formula; hold-time requirements must also be checked.

Register bus datapath Register R1 Register R2 MUXsource select ALUoperation R3 busload enable + clock
Register bus datapath with two source registers, a multiplexer, an ALU, and a destination register
Figure: Register bus datapath with two source registers, a multiplexer, an ALU, and a destination register

Figure: A simplified register-transfer datapath. Selection and enable signals determine which value reaches the destination register.

3. Arithmetic and Logic Units

An ALU is a combinational circuit that performs arithmetic and logical operations on operands. A typical ALU has two n-bit inputs, an operation-select field, an optional carry-in, an n-bit result, and status outputs.

For addition, the ALU computes:

F = A + B + Cin

where A and B are unsigned or two’s-complement bit patterns, Cin is carry-in, and F is the low-order n bits of the result. A carry-out may be produced beyond bit n−1. Because binary addition is modular in a fixed-width register, a result exceeding the range is truncated unless an extra carry bit is stored.

A one-bit full adder illustrates the basic construction:

S = A ⊕ B ⊕ Cin
Cout = AB + Cin(A ⊕ B)

S is the sum bit, Cout is carry-out, and juxtaposition denotes AND. An n-bit ripple-carry adder connects full adders so that each carry feeds the next stage. Its main limitation is that carry propagation delay increases with word length. Carry-lookahead and prefix adders reduce this delay at the cost of additional hardware.

Logic operations

Common bitwise ALU functions include AND, OR, XOR, and NOT. For example, Fi = Ai ∧ Bi applies AND independently to each bit i. Bitwise logic differs from Boolean comparison of whole numbers: XOR produces a one in each position where the corresponding operands differ.

Shifts

A logical left shift moves bits toward the most significant position and inserts zeros at the least significant position. A logical right shift inserts zeros at the most significant position. An arithmetic right shift copies the sign bit, preserving the sign of a two’s-complement integer approximately when division by two is intended. A barrel shifter can shift by multiple positions in one combinational operation, while a one-bit shifter may require repeated cycles.

Status flags

ALUs commonly produce:

  • Zero (Z): one when every result bit is zero;
  • Negative or sign (N): commonly equal to the most significant result bit in two’s-complement systems;
  • Carry (C): carry out of the most significant bit for addition;
  • Overflow (V): signed arithmetic result outside the representable range.

For two’s-complement addition, overflow occurs when two operands with the same sign produce a result with the opposite sign. One expression is:

V = ¬(An−1 ⊕ Bn−1) · (An−1 ⊕ Fn−1)

This formula applies to addition, where subscript n−1 denotes the sign bit. Carry and signed overflow are different conditions. For example, a carry may occur in a signed addition without overflow, and signed overflow may occur without a useful interpretation as an unsigned carry error.

4. Datapath Organization

The datapath is the portion of a processor that stores and transforms data. It usually contains a program counter (PC), instruction register (IR), general-purpose registers, an ALU, multiplexers, memory-data registers, and status registers. The control unit generates signals that direct the datapath.

A single-bus datapath is economical but may require several clock cycles for an operation because only one value can occupy the bus at a time. A multi-bus datapath permits simultaneous operand transfers. For example, two read ports can supply ALU inputs while a third path returns the result to a register file. More buses improve throughput but increase wiring, multiplexing, area, and power consumption.

A register file is an organized collection of registers with read and write ports. If it has two read ports and one write port, an instruction such as Rd ← Rs1 + Rs2 can read both source operands in one cycle, perform the ALU operation, and write the result subject to the processor’s timing design.

5. Instruction Execution as Microoperations

Instruction execution is often divided into fetch, decode, execute, memory access, and write-back activities. The exact implementation varies, but the following sequence illustrates a simple processor.

Fetch

MAR ← PC
MDR ← Memory[MAR]
IR  ← MDR
PC  ← PC + 1

MAR is the memory-address register and MDR is the memory-data register. These operations may require separate cycles in a single-bus machine. In a design with suitable memory and datapath hardware, some can overlap.

Decode

The instruction decoder interprets the opcode and identifies source registers, destination registers, addressing modes, and immediate fields. Decoding does not necessarily change the architectural state; it generates control signals or internal control information.

Execute

For an add instruction, a possible register-transfer sequence is:

A ← R_s1
B ← R_s2
F ← A + B
R_d ← F

In a multiport register file, the first two transfers may be implemented as simultaneous reads rather than separate temporary-register cycles.

Memory access

For a load instruction:

MAR ← R_b + sign_extend(offset)
MDR ← Memory[MAR]
R_d ← MDR

For a store instruction:

MAR ← R_b + sign_extend(offset)
MDR ← R_s
Memory[MAR] ← MDR

The address calculation assumes a base register Rb and a signed immediate offset. The memory interface must obey its own timing and alignment requirements.

Control transfer

A conditional branch tests a condition, often a flag or register comparison, and changes the PC if the condition is true:

if Z = 1 then PC ← PC + sign_extend(offset)

The exact branch-address calculation depends on the instruction-set architecture. Some processors use a PC-relative offset scaled by instruction size; others use byte offsets or absolute addresses.

6. Hardwired Control

Hardwired control generates datapath control signals using combinational logic, decoders, counters, and state registers. A finite-state machine (FSM) represents instruction-cycle states such as FETCH, DECODE, EXECUTE, and MEMORY.

Let St denote the current state, X the instruction and status inputs, and C the control outputs. An FSM can be represented by:

St+1 = f(St, X)
Ct = g(St, X)

The next-state function f determines the following state, while the output function g determines control signals. In a Moore-style controller, outputs depend primarily on state; in a Mealy-style controller, outputs may also depend directly on inputs. Practical processors may use mixtures of these approaches.

For an ADD instruction, the controller might assert signals for register-file read, ALU-select = ADD, destination-register write, and status update. Control signals must be mutually compatible. For example, a shared bus must not have two source enables active at once.

Hardwired control is generally fast and efficient for a small, fixed instruction set. Its disadvantage is reduced flexibility: modifying the instruction set may require redesigning logic. Microprogrammed control stores sequences of control words in a control memory. It is often easier to modify and can support complex instructions, but the control-memory access may add latency.

7. Worked Example: Designing a Small Datapath

Consider an illustrative 8-bit processor with registers R0 through R3, an 8-bit ALU, a PC, and instructions encoded as:

FieldWidthPurpose
Opcode4 bitsSelects operation
Destination2 bitsSelects destination register
Source A1 bitSelects one of two sources
Source B1 bitSelects one of two sources

Suppose the instruction is ADD with destination R2, sources R0 and R1, and the current values are R0 = 00110110₂ and R1 = 00001101₂.

The required register-transfer action is:

R2 ← R0 + R1

The binary addition is:

00110110₂   (54₁₀)
+ 00001101₂   (13₁₀)
───────────
  01000011₂   (67₁₀)

Thus R2 receives 010000112. No carry out is generated, the zero flag is 0, and the sign bit is 0. For signed 8-bit interpretation, the result is also +67, within the range −128 to +127, so signed overflow is 0.

A suitable datapath requires two operand paths into the ALU and a write-back path to R2. The controller decodes the opcode, selects ADD, enables the destination write, and ensures that the register-file read values are stable before the active clock edge.

8. Applied Case: A Microcontroller Timer Update

Background. Consider an illustrative 8-bit microcontroller used in a low-power environmental sensor. A timer register increments periodically and triggers an interrupt when it reaches a programmed threshold.

Problem. The firmware must update the timer safely while hardware may inspect its value. A careless multi-step update could produce an intermediate value that causes a false comparison.

Analysis. If the timer is 8 bits wide and the datapath writes all eight bits in one clocked operation, a transfer such as TIMER ← TIMER + 1 is atomic with respect to that clock edge. If the timer is implemented as two separate 4-bit fields or accessed through an 8-bit interface using two writes, an observer may see an intermediate state.

Approach. The designer can use an 8-bit register with a single load enable, synchronize the update to the timer clock, and define interrupt behavior precisely. A compare circuit evaluates TIMER = LIMIT. If the equality signal is true, control logic sets an interrupt request and optionally clears the timer. Firmware documentation must specify whether the limit value itself produces an interrupt and how simultaneous update and clear requests are prioritized.

Outcome. The register-transfer model exposes the required hardware: an incrementer or ALU, a comparator, a load-enable control, and an interrupt latch. It also reveals timing and atomicity requirements that may be hidden in high-level code.

Learning points. Register-transfer analysis is useful not only for CPUs but also for timers, communication controllers, digital signal-processing units, and safety-critical embedded systems. Clear ownership of clock domains and explicit priority rules prevent many design errors.

9. Design Challenges and Best Practices

Word length and overflow

A fixed-width datapath cannot represent every mathematical result. Designers must specify whether arithmetic is unsigned, signed, saturating, or modular. Software-visible flags must have documented meanings.

Bus contention and illegal control combinations

Control logic should enforce one bus source at a time. Formal assertions, simulation, and hardware verification can check that mutually exclusive enables are never simultaneously active.

Clocking and timing

Every transfer must satisfy setup and hold requirements. Long combinational paths limit the maximum clock frequency. Pipelining divides a long path into stages, but introduces latency and creates hazards when dependent instructions are close together.

Reset and initialization

Registers that affect safety, memory access, or control flow should have defined reset states. Reset behavior must account for asynchronous assertion, synchronous release, and interactions between clock domains.

Power and area

Wider buses and multiple ALU units improve parallelism but increase switching activity and silicon area. Clock gating can reduce dynamic power, but gating must preserve safe clock behavior and avoid unintended state loss.

Verification and hardware description

Register-transfer designs are commonly expressed in hardware description languages such as Verilog or VHDL. A statement describing a clocked register should distinguish sequential behavior from combinational logic. Incomplete combinational assignments can infer unintended latches, while incorrect blocking and nonblocking assignment usage can produce simulation mismatches. Simulation, synthesis checks, static timing analysis, and formal verification complement one another.

10. Contemporary Relevance

Modern processors often contain multiple datapaths, pipeline stages, caches, speculative control, vector units, and specialized accelerators. Nevertheless, the basic ideas remain unchanged: values are stored in state elements, combinational units transform them, and control logic determines when transfers occur.

Microcontrollers apply these principles under strict constraints on cost, power, and real-time response. Field-programmable gate arrays (FPGAs) allow designers to configure registers, lookup tables, carry chains, and routing resources into custom datapaths. Application-specific integrated circuits optimize the same structures for speed, energy, or security.

AI hardware also relies on register-transfer design. Multiply-accumulate arrays, systolic dataflows, quantized arithmetic, and local buffers are organized as datapaths controlled by finite-state machines or scheduled control networks. The use of AI does not remove the need for precise digital design; instead, it makes correct data movement and arithmetic even more important because large numbers of operations occur in parallel.

Security is another contemporary concern. Control and datapath designs must consider fault injection, unauthorized memory access, information leakage through timing or power, and correct isolation between privilege levels. A formally specified transfer policy can help establish that protected registers and buses are accessible only under permitted conditions.

Chapter Summary

Register-transfer systems describe how binary values move among registers and how arithmetic, logic, and shift operations transform them. Registers provide clocked state; buses and multiplexers provide controlled movement; ALUs provide combinational computation; and control units sequence microoperations. Timing constraints determine whether a transfer can complete within a clock period.

A processor datapath combines these elements to fetch, decode, execute, and complete instructions. Hardwired control implements these activities with finite-state logic and decoders, while microprogrammed control uses stored control sequences. Datapath organization affects performance, area, power, and design complexity. Careful treatment of word length, overflow, bus contention, clocking, reset, verification, and security is essential in professional digital-system design.

Key Terms

Register: A clocked group of flip-flops used to store a binary word.

Register-transfer notation: A symbolic description of data movement and operations between registers.

Microoperation: A basic operation performed on data in registers.

Bus: A shared group of conductors used to transfer a binary word.

Multiplexer: A circuit that selects one of several inputs.

Tri-state driver: A driver with logic 0, logic 1, and high-impedance states.

Enable: A control signal that permits a register or circuit to act.

ALU: Arithmetic logic unit that performs arithmetic and logical operations.

Carry: A bit propagated beyond the most significant position in arithmetic.

Overflow: A signed-arithmetic condition in which the result exceeds the representable range.

Status flag: A bit indicating a result condition such as zero, carry, sign, or overflow.

Datapath: Processor hardware that stores, moves, and transforms data.

Control unit: Hardware that generates signals coordinating datapath operations.

Register file: An organized collection of registers with read and write ports.

Program counter: A register containing the address of the next instruction.

Instruction register: A register holding the currently processed instruction.

Hardwired control: Control implemented with logic gates, decoders, and state machines.

Microprogrammed control: Control implemented as stored sequences of control words.

Finite-state machine: A sequential model with states, transitions, and outputs.

Pipeline: An organization that divides instruction processing into overlapping stages.

Review Questions

Short Answer Questions

  1. What does the register-transfer statement R2 ← R1 mean?
  2. Why must only one source drive a shared tri-state bus at a time?
  3. Distinguish carry from signed overflow.
  4. What are the principal responsibilities of an ALU?
  5. What is the role of the control unit in a datapath?

Long Answer Questions

  1. Explain how a multiplexer-based bus transfers data from one register to another, including the roles of source selection, destination enable, and the clock.
  2. Describe the construction and operation of an n-bit ripple-carry adder. Discuss its main timing limitation.
  3. Explain the fetch, decode, execute, memory, and write-back stages using register-transfer notation.
  4. Compare hardwired and microprogrammed control in terms of speed, flexibility, hardware complexity, and typical use.
  5. Discuss how word length, overflow policy, clock timing, reset design, and verification influence datapath reliability.

Analytical / Application Questions

  1. Design the microoperations needed to execute R4 ← R2 − R3 in a single-bus datapath. Identify any temporary registers and control signals required.
  2. An 8-bit ALU adds 011111112 and 000000012. Determine the binary result, carry-out, sign, and signed-overflow status, and explain the difference between the unsigned and signed interpretations.
  3. A microcontroller timer can be updated by either an increment request or a clear request in the same clock cycle. Propose a priority rule and explain how the corresponding control logic prevents ambiguous behavior.

Multiple Choice Questions with Answers

Question 1

What does R2 ← R1 specify?

A. Add the contents of R1 and R2

B. Copy the contents of R1 into R2

C. Clear both R1 and R2

D. Copy the contents of R2 into R1

Correct Answer: B. Copy the contents of R1 into R2

Question 2

How many binary select lines are required for a multiplexer with eight possible sources?

A. 2

B. 3

C. 4

D. 8

Correct Answer: B. 3

Question 3

Which ALU flag is normally 1 when every result bit is zero?

A. Carry

B. Overflow

C. Zero

D. Sign

Correct Answer: C. Zero

Question 4

What is the main danger of enabling two tri-state bus drivers simultaneously?

A. Instruction starvation

B. Bus contention

C. Automatic sign extension

D. Clock division

Correct Answer: B. Bus contention

Question 5

Which component normally contains the address of the next instruction?

A. Program counter

B. Instruction register

C. Memory-data register

D. Status register

Correct Answer: A. Program counter

Question 6

For two’s-complement addition, signed overflow occurs when

A. operands have opposite signs and the result is zero

B. operands have the same sign and the result has the opposite sign

C. the carry-in is always zero

D. the result contains at least one zero bit

Correct Answer: B. operands have the same sign and the result has the opposite sign

Question 7

What is the principal role of a datapath?

A. Store the operating system permanently

B. Transform and move data under control signals

C. Decode network addresses only

D. Generate a power-supply voltage

Correct Answer: B. Transform and move data under control signals

Question 8

Which control style uses a finite-state machine and logic gates to generate signals?

A. Hardwired control

B. Optical control

C. Mechanical control

D. Analog feedback control

Correct Answer: A. Hardwired control

Question 9

An 8-bit unsigned addition produces 001100002 + 000011112. What is the result?

A. 00111111₂

B. 01000001₂

C. 00100001₂

D. 11111111₂

Correct Answer: A. 00111111₂

Question 10

Why can a single-bus datapath require multiple cycles for one arithmetic instruction?

A. The ALU cannot perform addition

B. Only one shared value can normally occupy the bus at a time

C. Registers cannot be clocked

D. The program counter stores only decimal values

Correct Answer: B. Only one shared value can normally occupy the bus at a time

Introduction to Digital Logic
Chapter 12 of 15