CHAPTER 4: PROCESSOR FUNDAMENTALS

4.1 CENTRAL PROCESSING UNIT (CPU) ARCHITECTURE

4.1.1 Von Neumann Model

Key Concept:

Components:

4.1.2 Registers

Definition: The smallest unit of storage in a microprocessor; allows fast data transfer.

General Purpose Registers:

Special Purpose Registers:

Register Function
PC (Program Counter) Holds address of next instruction
MDR (Memory Data Register) Holds data fetched from memory
MAR (Memory Address Register) Holds address of memory cell to access
ACC (Accumulator) Holds values processed by ALU
IX (Index Register) Stores number to modify address
CIR (Current Instruction Register) Holds current instruction for decoding
Status Register Holds results of comparisons, arithmetic flags

4.1.3 CPU Components

ALU (Arithmetic and Logic Unit):

Control Unit (CU):

System Clock:

IAS (Immediate Access Store):

4.1.4 Buses

Definition: Set of parallel wires allowing data transfer between components.

Data Bus:

Address Bus:

Control Bus:

4.1.5 Performance Factors

Clock Speed:

Bus Width:

Cache Memory:

Number of Cores:

4.1.6 Ports

Port Type Description
USB Connects input and output devices
HDMI High-definition video and audio output
VGA Video output only (older displays)

4.1.7 Fetch-Execute Cycle

Fetch Stage:

  1. PC holds address of next instruction
  2. Address copied to MAR
  3. PC incremented
  4. Instruction loaded to MDR from address in MAR
  5. Instruction from MDR loaded to CIR

Decode Stage:

Execute Stage:

Register Transfer Notation (RTN):

<TEXT>

MAR ← [PC]
PC ← [PC] + 1
MDR ← [[MAR]]
CIR ← [MDR]
Decode
Execute
Return to start

4.1.8 Interrupts

Definition: A signal from a program seeking the processor's attention.

ISR (Interrupt Service Routine):

Interrupt Handling Process:

  1. Processor checks interrupt register at end of F-E cycle
  2. If interrupt flag is set, source detected
  3. If low priority, interrupt disabled
  4. If high priority:
    • Save register contents to stack
    • Load PC with ISR address
    • Execute ISR
    • Restore registers from stack
    • Continue interrupted program

4.2 ASSEMBLY LANGUAGE

4.2.1 Introduction

Assembly Language:

Machine Code:

Assembler:

4.2.2 Assembler Types

One-Pass Assembler:

Two-Pass Assembler:

Pass 1:

Pass 2:

4.2.3 Addressing Modes

Mode Description
Immediate Data is the actual value (e.g., LDM #n)
Direct Load contents at given address (e.g., LDD address)
Indirect Address to use is at given address (e.g., LDI address)
Indexed Address = given address + contents of IX (e.g., LDX address)
Relative Next instruction is offset from current instruction

4.2.4 Instruction Types

Data Movement:

Arithmetic:

Comparing:

Conditional Jumps:

Unconditional Jumps:

I/O:

End:


4.3 BIT MANIPULATION

4.3.1 Binary Shifts

Left Shift (LSL #n):

Right Shift (LSR #n):

Arithmetic Shift:

Cyclic Shift:

4.3.2 Bit Masking

Purpose: Each bit can represent an individual flag. By manipulating bits, flags can be operated upon.

Operations:

Masking to 1:

Masking to 0:

Testing Bits:

Practical Applications:


Revision #1
Created 2026-03-16 12:01:11 UTC by Samuel Lee
Updated 2026-03-16 12:01:26 UTC by Samuel Lee