Processors

Before assembly languge or machine language can make any sense, we need to get a (very) basic idea about how a (conventional) processor works.

A Simplified View of a Processor

A simplified view, indeed:

cpu.gif

The Bus

The bus contains a number of lines (over one hundred in many modern processors).

Address and Data Lines

These are used for reading from memory or devices and writing to memory or devices. The number of address lines determines how many words of memory can possibly be addressed. The number of data lines determines how much data can be moved at one time.

Power and Ground Lines

The power line is a convenient way to get a 1 whenever you need one; the ground line gives you your 0.

IO/MEM Line

When 1 (IO), the address line specifies the "address" of a port on a device connected to the bus; when 0 (MEM) the address line specifies a memory address.

R/W Line

When 1 (R), we want to read what's on the data bus; when 0 (W) we want to write the contents of the data bus to memory or to a device.

Clock Line

This alternates between 0 and 1, a given number of times per second.

Registers

Parts of the processor that can store data and do arithmetic and logic. Most processors work by reading data from memory or a device into registers, doing computations, and writing back out to memory or devices. We need registers since it is generally too expensive to put arithmetic and logic circuitry within every memory cell.

Some registers aren't for computation but rather to provide information (status) or put the processor in a particular mode of operation (control).

The instruction pointer register contains the address (in memory) of the next "instruction" to be executed.

The Fetch-Execute Cycle

As long as the processor is on, and not in a "halted" state, it will repeatedly:

  1. Read (fetch) the word in memory whose address is in the instruction pointer register, the increment the register.
  2. Do something based on the fetched value (execute).

The fetched value is an instruction. For example, a processor could be designed so that if the octet 8C were fetched, it would cause two of its registers to be multiplied together. And maybe a 35 would cause a register to be decremented, and a C9 would cause the contents of a register to be written to memory.

Note how the autoincrementing of the instruction pointer means that a "program" is a sequence of instructions in consecutive memory locations. Almost every processor though, has a jump instruction which is implemented by writing a completely different value into the instruction pointer.

Instruction Set Architectures

A processor is said to implement an Instruction Set Architecture (ISA) which specifies a set of instructions and its associated machine language.

Common ISAs today:

See Intel's free documentation on the IA-32 and Intel 64 architectures.

Microarchitectures

A microarchitecture is a kind of implementation of an architecture. For example the Intel 64 architecture can be implemented with the NetBurst, Core, Nehalem, or Sandy Bridge microarchitectures, among others.

Some Intel Processors

Wikipedia has a more complete list, but here are few of the common ones:

Architecture Microarchitecture Processors
IA-32 P6 Pentium Pro, Pentium II, Pentium |||
IA-32 Pentium M Pentium M
IA-32 Enhanced Pentium M Core Solo, Core Duo, Xeon LV
IA-32 NetBurst Pentium 4, Pentium 4F
Intel 64 NetBurst Pentium 4F, Pentium D, Pentium Extreme Edition, Xeon 5000, Xeon 7100
Intel 64 Intel Core Pentium Dual Core, Core 2 Duo, Core 2 Quad, Core 2 Extreme
Intel 64 Nehalem, Sandy Bridge, Ivy Bridge Core i3, Core i5, Core i7