No history yet

Processor Architecture

Architecture Blueprints

At the heart of every processor lies a fundamental design philosophy for how it handles instructions and data. The most prevalent is the Von Neumann architecture, where both program instructions and the data they operate on are stored in the same memory. A single bus is used to fetch both, which is simple and flexible. Think of it as a single library where books (data) and instructions on how to read them are all on the same shelves, accessed through one main entrance.

Lesson image

The alternative is the Harvard architecture. It physically separates the storage and signal pathways for instructions and data. This means the CPU can fetch the next instruction while simultaneously reading or writing data for the current instruction, leading to faster execution in certain scenarios. This design is common in specialized chips like Digital Signal Processors (DSPs), where predictable, high-speed data throughput is critical.

The Engine's Rhythm

No matter the architecture, a CPU runs on a constant, rhythmic cycle to process instructions. This is the fetch-decode-execute cycle, the fundamental operation of a processor.

  1. Fetch: The [{}] retrieves the next instruction from memory. A special register called the Program Counter (PC) keeps track of which instruction is next.
  2. Decode: The instruction, now in binary, is interpreted by the instruction decoder. The Control Unit determines what operation to perform and which parts of the CPU are needed.
  3. Execute: The operation is carried out. This is usually the job of the Arithmetic Logic Unit (ALU), which performs calculations (add, subtract) and logical comparisons (is X greater than Y?).
  4. Store: The result of the execution is written back to a register or memory location. The cycle then repeats.

Speaking the Language of Silicon

An (ISA) is the formal contract between software and hardware. It defines the set of commands the processor can understand and execute. Think of it as the CPU's vocabulary. The two dominant philosophies are CISC and RISC.

CISC (Complex Instruction Set Computer), used by processors like Intel's series, features a large set of powerful instructions. A single CISC instruction might perform a multi-step operation, like loading a value from memory, performing arithmetic on it, and storing it back. This makes assembly programming easier and can result in smaller program code.

RISC (Reduced Instruction Set Computer), found in ARM processors used in virtually all smartphones, takes the opposite approach. It uses a small, highly optimized set of simple instructions. Each instruction performs a single, fast operation, like LOAD, ADD, or STORE. Complex tasks require combining more of these simple instructions, but the simplicity allows for faster and more energy-efficient processor designs.

FeatureCISC (e.g., x86)RISC (e.g., ARM)
Instruction ComplexityHigh (Multi-step operations)Low (Single-step operations)
Number of InstructionsLargeSmall
Clock Cycles per InstructionVariable (often many)Fixed (usually one)
EmphasisHardware complexitySoftware compiler complexity
Energy UseGenerally higherGenerally lower
Typical UseDesktops, Laptops, ServersSmartphones, Tablets, Embedded Systems

The Assembly Line Advantage

Early processors completed the entire fetch-decode-execute-store cycle for one instruction before starting the next. This is like a single mechanic building a car from start to finish. It works, but it's slow.

Modern processors use a technique called pipelining. It works like a factory assembly line. The instruction cycle is broken into stages, and the processor works on multiple instructions at once, each at a different stage. As one instruction moves from the 'fetch' stage to the 'decode' stage, the next instruction enters the 'fetch' stage.

Pipelining dramatically increases throughput, the number of instructions completed per unit of time. But what happens when an instruction depends on the result of one still in the pipeline? Or when the program needs to 'jump' to a different part of the code, making the fetched instructions useless? This is where things get clever.

Superscalar execution takes this a step further by having multiple, parallel pipelines. A superscalar processor can fetch, decode, and execute more than one instruction per clock cycle, like having several assembly lines working at once.

To keep these pipelines full, CPUs use branch prediction. When the processor encounters a conditional jump (an if statement), it makes an educated guess about which path the code will take. If it guesses right, the pipeline stays full and execution continues at full speed. If it guesses wrong, it has to flush the pipeline and start over from the correct instruction path, which incurs a performance penalty.

To minimize this penalty, some processors use speculative execution. They execute instructions from the predicted path 'speculatively' but don't commit the results until the branch outcome is certain. This way, if the prediction was correct, the results are ready to go, saving precious time.

Quiz Questions 1/6

What is the defining characteristic of a Von Neumann architecture?

Quiz Questions 2/6

A processor found in a modern smartphone, designed for high energy efficiency, is most likely based on which instruction set philosophy?