FCA4
FCA4
CPU DESIGN
LEARNING OBJECTIVES
1. Arithmetic and Logic Unit framework.
2. Arithmetic and Logic Unit operations (IEEE
standard).
3.Control Unit (types and organization).
INTRODUCTION
This Unit explains the key components of the Central Processing Unit (CPU): the Arithmetic and
Logic Unit (ALU) and the Control Unit (CU). These parts work together to process data and control
the system.
The CPU is the “brain” of the computer, responsible for executing instructions, performing
calculations, and managing system operations.
Main Components of the CPU:
Arithmetic and Logic Unit (ALU) - Performs mathematical operations (e.g., add, subtract) and
logical comparisons (e.g.,AND, OR, NOT). Handles actual data processing tasks.
Control Unit (CU) - Directs the CPU’s operations by fetching, decoding, and managing
instructions. Coordinates the flow of data between the CPU, memory, and input/output devices.
Registers: Temporary storage locations inside the CPU used for fast data access.
Types of CPUs: Single-core, Multi-core, Microcontroller, DSP.
The ALU processes data, while the CU controls how and when that processing happens—together,
they allow the CPU to execute programs efficiently.
PRIMARY FUNCTIONS OF THE CPU
The CPU operates in a sequence of stages commonly referred to as
the instruction cycle:
Fetch – Retrieve the instruction from main memory.
Decode – Translate the instruction into signals that direct the next steps.
Execute – Perform the required operation (e.g., arithmetic calculation, data
movement).
Store – Save the result to memory or a register.
Example: When calculating 2 + 3, the CPU fetches the addition
instruction, decodes it, uses the ALU to compute the sum, and
stores the result in a register.
ARITHMETIC AND LOGIC UNIT
ARITHMETIC AND LOGIC UNIT (ALU) FRAMEWORK
An Arithmetic Logic Unit (ALU) is a key part of the CPU
(Central Processing Unit). It's like the "brain" of the computer
that does all the math and logic work.
The ALU handles two main types of tasks:
Arithmetic operations: like addition, subtraction, multiplication, and
division.
Logical operations: like AND, OR, NOT, and comparing numbers (e.g.,
checking if one number is bigger or equal to another).
It uses binary numbers (1s and 0s) to do all this.
ARITHMETIC AND LOGIC UNIT (ALU) FRAMEWORK
The ALU gets instructions from another part of the CPU called the
Control Unit. Based on those instructions, it performs the right
operation on the data.
Types of ALUs
Simple ALUs: Can do basic tasks like add, subtract,AND, OR.
Complex ALUs: Can do more advanced things like multiply, divide, or shift bits.
Overflow (V) Result is out of range for signed numbers. Detecting arithmetic errors.
Logic Circuit
Handles logical tasks:AND, OR, NOT, etc.
Shift Unit
Moves bits left or right.
Used in operations like multiplication or division.
May be a separate unit or built into the ALU.
HOW THE ALU WORKS
1. Control Unit Sends Instructions 4. Result Is Produced Instantly
The Control Unit (CU) tells the ALU what
operation to perform (e.g., add, subtract, AND, The result comes out as soon as the inputs
OR). are processed (this is called combinational
2. Data Is Loaded into the ALU logic—no waiting or clock cycles needed
The data needed for the operation comes from inside the ALU itself).
the CPU’s registers or memory.
5. Result Is Stored
This data enters the ALU through input registers
and data buses. The result is sent to a register, memory, or
3. ALU Performs the Operation back to the CPU for the next step.
If it’s a math task: the arithmetic circuit adds, Flags (like Zero, Carry, Overflow) are
subtracts, etc.
updated in the status register to show the
If it’s a logic task: the logic circuit applies AND, outcome.
OR, NOT, etc.
If needed, the shift unit moves bits left or right.
INPUTS & OUTPUTS OF THE ALU
Inputs:
Two Operands: From CPU registers (e.g., R1, R2).
General-purpose registers:Temporarily hold data during operations.
Control Signals: Tell the ALU what operation to perform (ADD, SUB, AND,
etc.).
Outputs:
Result: Sent to a register or memory.
Accumulator: Keeps the result of calculations so it can be reused easily.
Status Flags: Indicate the outcome (zero, carry, etc.).
INTERNAL STRUCTURE OF THE ALU
The ALU is made up of small, specialized units:
Adders, Logic Gates, Multiplexers work together in one unit.
A 32-bit ALU, for example, is made from 32 tiny 1-bit ALUs connected in a row
-each one handles one bit of the input.
Control signals guide each part (e.g., do an AND or ADD).
ALU Operation Path:
Inputs from registers.
Logic circuits perform operations.
Multiplexer selects the correct result.
Output goes to destination register.
ALU
ARITHMETIC AND LOGIC UNIT
OPERATIONS (IEEE 754 STANDARD)
ARITHMETIC OPERATIONS
These are basic math operations done by the ALU:
ADD – Adds two numbers (e.g., 5 + 3 = 8).
SUB – Subtracts one number from another using a method called
two’s complement (used to represent negative numbers in binary).
These are used in both integer and floating-point calculations
(e.g., in calculators, processors, or software applications).
LOGICAL OPERATIONS
These work bit-by-bit (on 1s and 0s), often used in decision-making or comparing
binary data:
AND – Returns 1 if both bits are 1.
OR – Returns 1 if at least one bit is 1.
XOR – Returns 1 if the bits are different.
NOT – Flips the bit (1 becomes 0, 0 becomes 1).
The ALU chooses which operation to perform using control signals sent from the
Control Unit.
IEEE 754 FLOATING-POINT
STANDARD
IEEE 754 FLOATING-POINT FORMAT
The IEEE 754 standard is a common way computers store and work with real numbers
(decimals).
It was created in 1985 by the Institute of Electrical and Electronics Engineers (IEEE) to make
calculations more accurate and consistent across different computers.
Before IEEE 754, different computers handled decimals differently. This made programs less
portable and harder to trust.
IEEE 754 fixed this by setting clear rules.
Floating-Point Operations:
Ensures accurate and predictable results.
Handles rounding, zero, infinity, NaN (Not a Number), overflow, and underflow.
Makes calculations consistent across different systems (like Windows, Mac, Unix).
FIXED-POINT
VS
FLOATING-POINT ARITHMETIC
FIXED-POINT ARITHMETIC
Numbers have a fixed number of digits after (and sometimes before) the decimal point.
Pros:
Faster and simpler.
Good precision at low hardware cost.
Great for systems where speed and power use are important (like digital watches, microcontrollers).
Cons:
Limited range (Cannot handle very large or very small numbers well).
Example:
To store 10.75, you might multiply by 100 to remove the decimal:
10.75 → 1075
Then the system knows to place the decimal after 2 digits, so it reads it as 10.75.
FLOATING-POINT ARITHMETIC
Floating-point numbers are stored using three parts:
Sign: shows if the number is positive or negative.
Exponent: shows the scale (how big or small).
Mantissa (or significand): holds the actual digits of the number.
This format lets computers handle very large or very small
numbers.
Example: The number 123456.78 or 0.000045 can both be
stored efficiently using floating-point format.
FLOATING-POINT ARITHMETIC
Pros:
Can represent a huge range of values — from tiny decimals to massive numbers.
Allows dynamic precision, meaning more digits can be used where needed.
Ideal for scientific calculations, graphics, simulations, and engineering applications.
Cons:
Uses more memory (e.g., 32 or 64 bits per number).
Slower and more complex than fixed-point, especially on simple hardware.
Small rounding errors can happen due to binary approximations of decimal
numbers.
FLOATING-POINT ARITHMETIC PRECISION TYPES
128 64 32 16 8 4 2 1
1 0 0 0 0011
REPRESENT 24.125 IN IEEE 754 DOUBLE PRECISION
FIXED-POINT VS FLOATING-POINT ARITHMETIC
Feature Fixed-Point Floating-Point
Precision Constant (depends on fraction bits) Varies (relative to number size)
Limited (based on number of integer Very wide (supports tiny to huge
Range
bits) numbers)
Speed Fast, simple hardware Slower, more complex
Hardware Requires fewer resources Needs more gates and logic
32 or 64 bits (more for double-
Storage Compact (8, 16, or 32 bits)
precision)
Scientific computing, graphics,
Use Cases Embedded, real-time control
simulations
FIXED-POINT VS FLOATING-POINT ARITHMETIC USE CASE
Complexity Handling Works best for simple, fixed instruction Great for complex or evolving instruction
sets (like RISC). sets (like CISC).
Development Time Takes longer — requires designing Faster — uses reusable memory-based
custom hardware for control. control logic.
Cost Cheaper for simple, stable designs. Better for systems that may need updates
or support complex tasks.
Use Cases Simple devices like microwave ovens, More advanced systems like washing
calculators, embedded controllers. machines, printers, and CISC-based
CPUs.
REFERENCE
Englander, I. (2014). The Architecture Of Computer Hardware, Systems Software, &
Networking. (5th Edition). John Wiley & Sons, Inc.
Silberschatz A., Galvin P.B., & Gagne G. (2018). Operating System Concepts. (10ed).
John Wiley & Sons, Inc.
Stallings, W. (2020). Computer Organization and Architecture. Pearson.
Tanenbaum, A. S. (2016). Structured Computer Organization. Pearson.
UNIT 4 END