Coursify

Microprocessor

8051 Internal Block Diagram and CPU Architecture

1.5 hours

Learning Goals

  • Analyze the complete internal block diagram of 8051 identifying all major functional blocks and their interconnections
  • Explain the role and operation of the CPU core in the 8051 architecture
  • Describe the Arithmetic Logic Unit (ALU) and its function in executing arithmetic and logical operations
  • Understand the address bus (16-bit), data bus (8-bit), and control bus in the 8051 architecture
  • Trace the flow of instruction and data through the internal data bus connecting various components
  • Analyze the role of the control unit in decoding instructions and generating appropriate control signals
  • Explain the interrupt controller block and its integration within the CPU architecture
  • Relate the internal block diagram to the pin diagram and external I/O connections

The 8051 microcontroller is a classic 8-bit embedded controller belonging to the Intel MCS-51 family. Its internal architecture integrates the CPU core, program memory, data memory, I/O ports, timers/counters, serial interface, interrupt controller, and timing/control circuitry on a single chip. This makes the 8051 an important reference architecture for understanding how microcontrollers differ from general-purpose microprocessors.

In the context of Microprocessor studies, the 8051 is especially valuable because its internal block diagram clearly shows how computation, control, storage, and external interfacing are organized around a compact CPU. The architecture is centered on:

  • an 8-bit ALU
  • key CPU registers such as A, B, PSW, PC, SP, and DPTR
  • an 8-bit internal data bus
  • 16-bit addressing capability
  • a control unit that fetches, decodes, and executes instructions
  • an interrupt controller tightly integrated with CPU execution flow

Conceptually, the 8051 combines a CPU and peripheral subsystem around a shared internal data path:

The 8051 follows a separate code and data memory organization often described as a Harvard-style architecture, although internally the programmer experiences it through specific instruction pathways such as MOV, MOVC, and MOVX. The CPU processes 8-bit data, while addresses for code and external memory access can extend to 16 bits, enabling access to up to 64 KB of program memory and 64 KB of external data memory.

8051 | Architecture Block Diagram

Core Architectural Identity

The 8051 is primarily an 8-bit microcontroller because its ALU, accumulator, internal data paths, and most data operations are 8 bits wide, even though it uses 16-bit addressing through registers such as the Program Counter and DPTR.

1. Major Functional Blocks in the 8051 Internal Block Diagram

The complete internal block diagram can be understood by grouping the chip into functional regions.

Functional BlockMain PurposeImportant Elements
CPU CoreExecutes instructions and controls all operationsALU, Control Unit, Instruction Register/Decoder, A, B, PSW
Program SequencingTracks instruction flowProgram Counter (PC), incrementer, jump/call logic
Data AddressingSupports memory accessDPTR, SP, register banks, RAM addressing logic
Data MemoryTemporary storage and register spaceInternal RAM, bit-addressable area, stack
SFR SpaceControl/status for CPU and peripheralsACC, B, PSW, IE, IP, TCON, TMOD, SCON, SBUF, P0-P3
I/O InterfaceExternal digital connectionPort 0, Port 1, Port 2, Port 3
Timing SubsystemDelay/event countingTimer 0, Timer 1
Serial CommunicationUART-based transferSBUF, SCON, TxD, RxD
Interrupt SystemEvent-driven CPU responseIE, IP, interrupt flags, vector logic
Oscillator and ControlGenerates timing and machine cyclesOscillator, clock division, timing/control signals

The blocks are interconnected by an internal 8-bit data bus, while the CPU uses dedicated control logic to coordinate transfers between memory, registers, ALU, and peripherals.

How to Read the 8051 Internal Block Diagram

  1. 1
    Step 1

    Identify the ALU, accumulator, B register, PSW, instruction decoder, and control unit at the center of the architecture. These perform computation and generate control actions.

  2. 2
    Step 2

    Follow the path from program memory to the instruction register and decoder, then to the control unit. This shows how opcodes are fetched and interpreted.

  3. 3
    Step 3

    Observe the internal 8-bit data bus connecting internal RAM, SFRs, I/O ports, timers, and serial circuitry. This bus carries operand and result bytes across the chip.

  4. 4
    Step 4

    Distinguish program memory access from data memory access. The Program Counter is used for instruction fetch, while registers such as DPTR, R0/R1, and SP support data access.

  5. 5
    Step 5

    Find the interrupt control block and note that interrupt requests are evaluated by the CPU control logic, which can suspend normal execution and branch to an interrupt vector.

  6. 6
    Step 6

    Map Port 0 through Port 3 to the external pin diagram. Note alternate functions such as RxD, TxD, INT0, INT1, T0, T1, RD, and WR.

  7. 7
    Step 7

    Recognize that Port 0 and Port 2 participate in external memory addressing, while ALE, PSEN, RD, and WR provide control signals for program and external data memory transfers.

2. CPU Core of the 8051

The CPU core is the computational and decision-making center of the 8051. It is responsible for:

  • fetching instructions from program memory
  • decoding the opcode
  • generating control signals
  • obtaining operands from registers or memory
  • executing arithmetic, logical, branch, and bit-manipulation operations
  • storing the result back into registers, RAM, SFRs, or external interfaces

The CPU core includes the following important elements:

Accumulator (A)

The Accumulator is the main 8-bit working register used by the ALU. Most arithmetic and logic instructions use A implicitly.

B Register

The B register is mainly used with MUL AB and DIV AB, but may also serve as a general-purpose SFR in some programs.

ALU

The Arithmetic Logic Unit performs arithmetic and logical operations on 8-bit operands.

PSW

The Program Status Word contains status flags and register bank select bits.

Program Counter (PC)

A 16-bit register that holds the address of the next instruction to fetch from program memory.

Stack Pointer (SP)

An 8-bit register that points to the top of the stack in internal RAM. In the standard 8051, the stack resides in internal data memory.

Data Pointer (DPTR)

A 16-bit register used primarily for addressing external data memory or lookup tables in code memory.

A simplified CPU-centric view is:

Exam-Oriented Memory Aid

When explaining the CPU core, always mention these six elements together: ALU, Accumulator, B register, PSW, Program Counter, and Control Unit. Then add SP and DPTR to show how execution and addressing are managed.

3. ALU and Its Role in Execution

The ALU is the block that performs actual data processing. In the 8051, it is an 8-bit ALU, meaning it operates on 8-bit operands in a single fundamental operation.

Its functions include:

  • Arithmetic operations: addition, subtraction via complement methods, increment, decrement, multiplication, division
  • Logical operations: AND, OR, XOR, complement, compare
  • Shift/rotate support: through specific instructions controlled by CPU logic
  • Bit manipulation support: central to the 8051's control-oriented design

Common ALU-related registers and flags:

Register/FlagRole
APrimary operand/result register
BUsed in multiply/divide
CYCarry flag
ACAuxiliary carry
OVOverflow flag
PParity flag

For arithmetic, the ALU often updates PSW flags as follows:

PSW=f(result,carry,overflow,parity)\text{PSW} = f(\text{result}, \text{carry}, \text{overflow}, \text{parity})

Examples:

  • ADD A, R1 adds register R1 to A
  • ANL A, #0Fh performs bitwise AND
  • MUL AB multiplies A and B
  • DIV AB divides A by B

Because the 8051 is heavily used in control applications, its ALU is not only arithmetic-oriented but also optimized for Boolean and bit-level operations.

CPU Registers and Their Architectural Significance

4. Buses in the 8051 Architecture

The 8051 architecture is best understood through three conceptual buses:

4.1 Address Bus

The 8051 supports a 16-bit address bus, allowing:

216=655362^{16} = 65536

distinct addresses, or 64 KB of addressable space.

This is used for:

  • program memory addressing
  • external data memory addressing

The address is generated by registers such as:

  • PC for instruction fetch
  • DPTR for external data/code table access
  • internal addressing hardware for RAM and SFR access

4.2 Data Bus

The architecture uses an 8-bit data bus, so the CPU transfers one byte at a time.

This applies to:

  • ALU operations
  • internal RAM reads/writes
  • SFR access
  • I/O port transfers
  • serial buffer movement
  • external data bus transfers

4.3 Control Bus

The control bus is not always drawn as one single line in textbook block diagrams, but it consists of signals generated by the control unit and timing circuitry, including:

  • RD
  • WR
  • PSEN
  • ALE
  • interrupt acknowledge behavior
  • timer control signals
  • serial control actions
  • internal read/write enables

These signals synchronize all data transfers and execution phases.

8051 Architectural Widths

Comparison of core bus and key register widths

5. Internal Data Bus and Data Flow

A critical feature of the 8051 internal block diagram is the internal 8-bit data bus. This bus interconnects:

  • ALU
  • Accumulator and B register
  • internal RAM
  • register banks
  • stack area
  • SFRs
  • I/O ports
  • timer registers
  • serial buffer
  • interrupt-related control registers

This bus allows the CPU to move a byte from one subsystem to another under control-unit supervision.

Example: instruction fetch and execution flow

For an instruction like:

1ADD A, 30H

the flow is:

  1. The PC points to the opcode in program memory.
  2. The instruction is fetched into the decoder.
  3. The control unit interprets ADD A, direct.
  4. Direct address 30H is used to read a byte from internal RAM.
  5. That byte is placed on the internal data bus.
  6. The ALU adds it to the Accumulator.
  7. The result is written back to A.
  8. PSW flags are updated.

This movement can be represented as:

This is the essence of tracing data through the 8051 architecture.

Instruction Execution Inside the 8051 CPU

  1. 1
    Step 1

    The Program Counter supplies the code memory address of the next instruction. The instruction byte is fetched from program memory.

  2. 2
    Step 2

    The instruction register and decoder identify the opcode, addressing mode, and the type of operation to be performed.

  3. 3
    Step 3

    The control unit activates the required internal read, write, ALU, bus, and timing signals needed for execution.

  4. 4
    Step 4

    The operand is obtained from the accumulator, register bank, internal RAM, SFR, code memory table, or external memory depending on addressing mode.

  5. 5
    Step 5

    Arithmetic, logical, branch evaluation, or bit operation is carried out by the CPU core.

  6. 6
    Step 6

    The result is stored in the destination register, memory location, SFR, or output port.

  7. 7
    Step 7

    Flags in the PSW may change, the Program Counter advances or branches, and the next instruction cycle begins.

6. Control Unit and Instruction Decoding

The control unit is the supervisory logic of the 8051 CPU. It does not perform arithmetic itself; instead, it coordinates all internal operations.

Its responsibilities include:

  • decoding the opcode
  • selecting the addressing mode
  • controlling reads and writes
  • activating ALU functions
  • updating the Program Counter
  • sequencing machine cycles
  • managing branch, call, and return operations
  • accepting interrupts when enabled and appropriate

In effect, the control unit converts an instruction into a sequence of micro-operations. For example, a single instruction may involve:

  • fetching an operand
  • selecting an ALU function
  • updating flags
  • storing a result
  • incrementing or reloading the PC

Thus, the control unit is the bridge between the instruction set architecture and the hardware blocks shown in the internal diagram.

Common Conceptual Error

Do not confuse the control unit with the interrupt controller. The control unit manages overall instruction sequencing, while the interrupt controller supplies prioritized interrupt requests that the control unit services at defined points in execution.

7. Interrupt Controller and Its Integration with the CPU

The 8051 contains an integrated interrupt control system that allows asynchronous events to temporarily suspend normal program execution.

In the standard 8051 core, the principal interrupt sources are:

  • External Interrupt 0
  • Timer 0 Overflow
  • External Interrupt 1
  • Timer 1 Overflow
  • Serial Port Interrupt

The interrupt mechanism is governed mainly by:

  • IE: Interrupt Enable register
  • IP: Interrupt Priority register
  • flag bits in timer and serial control registers
  • external interrupt trigger configuration in TCON

CPU integration

The interrupt controller is tightly coupled to the CPU:

  1. It monitors interrupt request flags.
  2. It checks whether interrupts are enabled.
  3. It resolves priority.
  4. It signals the CPU control unit.
  5. The CPU completes the current instruction.
  6. The return address is pushed onto the stack.
  7. The PC loads the interrupt vector address.
  8. The ISR executes.
  9. RETI returns execution to the interrupted program.

This interaction shows that interrupts are not an external add-on; they are part of the normal CPU sequencing model.

  1. Event occurs
  2. Interrupt flag is set
  3. IE and IP are checked
  4. CPU finishes current instruction
  5. PC is saved on stack
  6. Vector address is loaded
  7. ISR executes
  8. RETI restores normal execution

8. Relation Between Internal Block Diagram and Pin Diagram

One important learning goal is to connect the internal architecture to the external pin functions.

Port mapping

The 8051 has four 8-bit ports:

  • Port 0
  • Port 1
  • Port 2
  • Port 3

These are internal SFR-controlled latches connected to external pins.

Architectural interpretation of external pins

Pin/PortInternal Architectural Role
P0General I/O or multiplexed low-order address/data bus for external memory
P1General-purpose I/O
P2General I/O or high-order address bus for external memory
P3General I/O with alternate special functions
ALEAddress latch enable for de-multiplexing Port 0 address/data
PSENProgram Store Enable for external code memory read
RDExternal data memory read control
WRExternal data memory write control
RXD/TXDSerial receive/transmit lines from serial block
INT0/INT1External interrupt request inputs
T0/T1Timer external count inputs
XTAL1/XTAL2Oscillator connections
RSTReset input to control initialization

Why this relation matters

The block diagram explains why certain pins have special behavior:

  • Port 0 is not just an I/O port; it is part of the multiplexed address/data interface
  • Port 2 supplies upper address bits during external memory access
  • Port 3 pins map directly to internal special-function blocks such as serial port, interrupt lines, timer inputs, and external memory control

So, the pin diagram is the external manifestation of the internal block diagram.

Pin Diagram Connections Explained

9. Internal Memory and Register Organization Relevant to the CPU

The CPU architecture cannot be separated from the internal memory organization.

Internal RAM organization in the standard 8051

The lower internal RAM is typically divided as:

  • 00H–1FH: four register banks (R0–R7)
  • 20H–2FH: bit-addressable RAM
  • 30H–7FH: general-purpose RAM

Special Function Registers

The SFR space occupies addresses 80H–FFH for control-oriented registers such as:

  • ACC
  • B
  • PSW
  • SP
  • DPL, DPH
  • P0, P1, P2, P3
  • TMOD, TCON
  • TH0, TL0, TH1, TL1
  • SCON, SBUF
  • IE, IP
  • PCON

This structure is important because CPU instructions frequently move data between:

  • register banks
  • RAM
  • SFRs
  • ALU-oriented registers

The result is a tightly integrated architecture with fast control operations.

Standard 8051 Internal RAM Lower 128-Byte Organization

Functional division of the lower internal RAM

10. Architectural Summary: How All Blocks Work Together

The 8051 internal architecture can be interpreted as a coordinated system:

  1. Program memory stores instructions.
  2. PC points to the next instruction.
  3. The instruction decoder and control unit interpret it.
  4. The internal data bus moves operands among RAM, SFRs, ports, and ALU.
  5. The ALU performs arithmetic and logic.
  6. The PSW reflects status.
  7. Timers, serial port, and interrupt controller operate as autonomous functional units but remain under CPU supervision.
  8. Ports and external control pins connect the internal architecture to the external world.

This is why the 8051 is best seen not merely as a CPU, but as a complete embedded computing system on a chip.

Knowledge Check

Question 1 of 5
Q1Single choice

Why is the 8051 classified primarily as an 8-bit microcontroller?

8051 Internal Block Diagram and CPU Architecture | Microprocessor | Coursify