What are instruction set architectures?


I know some examples are x96, x64 and arm. Are they abstract models of computation, like Turing machines?

In: 2

The instruction set is the language the CPU speaks. It’s not an abstract model, it’s the actual way the CPU reads a program and performs actions.

For example maybe for an x86 CPU the binary sequence B805000000 in a program would store the number 0, but for ARM it’s E3A02000 to do the same.

This is also why you can’t directly run programs compiled for one type of CPU on a different type.

Sort of. They describe how a specific archetype of cpu handles registers, instructions, data types, memory addressing and so on. It tells you two different CPUs will run machine code in exactly the same way with exactly the same outcome even if they differ greatly in how they physically do it.

Grossly oversimplified: it doesn’t matter if cpu A calculates 4+(5+6) and cpu B calculates (4+5)+6 because we know they both use decimal architecture and return 15. Cpu C uses octal architecture and would have returned 17.

The main processor on a computer works by putting numbers into memory called registers. Some will be data, and one will be a number that is a code for what the processor should do. 1 might be ‘Add A and B and save the result in C’, and two might be ‘Check if A and B are the same and save the result in C’.

The instruction set is the list of numerical codes and what they do. The same codes used by two different processors means that they can process the same instructions in computer programs.

The instruction set architecture goes one more step and describes things like optional processor features and how to check of the processor has them, and other details about sending instructions to the processor.

It’s a translation book. Every possible program instruction on the CPU has a translation into a binary code. The architecture is the whole collection of matched codes and instructions. If you try to use an x86 instruction guide programming for an x64 chip, your translations will be wrong and your program will not run correctly.

In general, computers perform actions by following a list of instructions. The “instruction set” is the list of instructions that a computer processor can physically perform. These are the most basic operations that a processor does. For each instruction in the instruction set, a processor has a circuit that represents that operation. Some common instructions are things like reading a value from a memory address or adding two numbers together, for which a processor will have a memory read circuit and an addition circuit. To do a more complicated command like adding 3 numbers together, a computer will use it’s circuit that adds two numbers together twice. Every more complex action that a computer does like loading an image or clicking a link on a website, ends up being carried out by the processor as a list of instructions from the instruction set.

A related concept is assembly programming. While most programming languages have many complicated commands, assembly programming typically only supports commands direct from the instruction set. Each single command in assembly will tell a simple processor to run a single logic circuit.