# What Is an Instruction?

A computer can perform calculations, move data, compare values, and make decisions—but how does the processor know what operation to perform?

The answer is instructions.

An instruction is a command given to the CPU that tells it what operation to perform and, depending on the instruction, what data or locations are involved.

Instructions are the basic units of work executed by a processor.

What Is an Instruction?

An instruction is a binary-coded command that tells the processor to perform a specific operation.

At the hardware level, instructions are represented as sequences of 0s and 1s.

For example, an instruction might tell the CPU to:

Transfer data Add two values Subtract two values Perform a logical operation Shift bits Jump to another instruction

The exact instructions available depend on the processor's Instruction Set Architecture (ISA).

Instruction and Data

It is important to distinguish between instructions and data.

An instruction tells the computer what to do.

Data is the information that the instruction operates on.

For example, consider:

ADD R1, R2

Conceptually:

ADD → operation to perform R1, R2 → registers involved in the operation

The instruction tells the processor to perform an addition involving those registers.

What Does an Instruction Contain?

An instruction generally contains information about the operation that should be performed and, when required, the operands involved.

Two important concepts are:

Opcode

The opcode, or operation code, specifies what operation the CPU should perform.

Examples include operations such as:

ADD SUB LOAD STORE AND OR SHIFT Operand

An operand identifies the data or location involved in the operation.

For example:

ADD R1, R2

Here, ADD represents the operation, while R1 and R2 identify the operands.

Not every instruction requires explicit operands.

Instruction Execution

When a program runs, the CPU repeatedly processes instructions.

The basic instruction cycle is commonly described as:

Fetch → Decode → Execute

1.  Fetch
    

The CPU obtains the next instruction from memory.

The Program Counter (PC) contains the address of the next instruction.

The instruction is fetched from that location and placed into the appropriate CPU register, commonly the Instruction Register (IR).

2.  Decode
    

The Control Unit examines the instruction.

It determines:

What operation is required Which operands are involved What resources are needed 3. Execute

The CPU performs the operation.

Depending on the instruction, this might involve:

The ALU Registers Memory Input/output devices Program control mechanisms

After execution, the processor continues with the next instruction unless the current instruction changes the normal execution flow.

Example

Suppose a program contains:

ADD R1, R2

A simplified execution process could be:

PC → Fetch instruction

↓

Instruction Register → Holds instruction

↓

Control Unit → Decodes ADD

↓

Registers → Provide required values

↓

ALU → Performs addition

↓

Result → Stored in the appropriate destination

This happens extremely quickly inside the processor.

Machine Instructions

Although programmers often see instructions written using assembly language, the CPU ultimately works with binary machine instructions.

For example, an assembly instruction might look like:

ADD R1, R2

The processor does not literally receive the letters A, D, and D.

Instead, the assembler converts the assembly instruction into the binary encoding defined by the processor's instruction set.

Conceptually:

Assembly Instruction ↓ Assembler ↓ Machine Instruction ↓ CPU Instruction Set

A processor supports a defined collection of instructions called its Instruction Set.

An instruction set determines what operations a particular processor can understand.

For example, an instruction set may provide instructions for:

Data transfer Arithmetic Logical operations Bit shifting Program control

Different processor architectures can have different instruction sets.

This is one of the reasons software compiled for one architecture may not directly run on another architecture without appropriate translation or compatibility support.

Instruction Length

Instructions can have different lengths depending on the processor architecture.

An instruction might occupy:

A fixed number of bits Or a variable number of bits

For example, some architectures use fixed-length instructions, while others use variable-length instructions.

Instruction length affects aspects of:

Memory usage Instruction fetching Decoding Processor design Instructions and the Control Unit

The Control Unit plays a major role in instruction execution.

It interprets the instruction and generates the control signals needed to coordinate the CPU's components.

For example, an instruction may require:

Register → ALU → Register

The Control Unit coordinates these operations so that the correct data moves to the correct locations at the correct time.

Instructions and Registers

Registers are closely connected to instruction execution.

We previously learned about registers such as:

Program Counter Instruction Register Address Register Data Register Accumulator Temporary Register

During instruction execution, these registers can help the CPU fetch, store, process, and transfer information.

For example:

PC helps locate the next instruction.

IR holds the current instruction.

Other registers may hold operands, addresses, or intermediate results.

Why Are Instructions Important?

Everything a general-purpose processor does is ultimately controlled by instructions.

Applications, operating systems, games, browsers, and other software are eventually translated into machine-level instructions that the processor executes.

Understanding instructions therefore provides a bridge between:

Software

and

Hardware

When you write a high-level program, you are describing what you want the computer to accomplish.

Eventually, that program must become instructions that the processor can execute.

Final Thoughts

An instruction is a command that tells the CPU what operation to perform.

An instruction can contain an opcode describing the operation and information identifying the required operands.

The processor repeatedly performs the basic cycle:

Fetch → Decode → Execute

Different processors support different instruction sets, and those instruction sets define the operations the processor understands.

Now that we know what an instruction is, the next question is:

What different kinds of instructions can a processor execute?

That leads us to the next topic:

Types of Instructions.
