# Instruction Set Architecture (ISA)

47 views
0

I’ve been trying to wrap my head around what ISAs are. Is it just the way a CPU is made? I’ve read it’s like a CPUs “vocabulary”. So if the vocabulary comparison is correct, AMD and Intel CPUs are kind of the same since they are both X86 right?

In: 1

The vocabulary analogy is about right, and yes, AMD and Intel are just two vendors who both make CPUs using the x86 instruction set. A windows program will work on an Intel CPU or an AMD CPU just fine. But run that program on, say, ARM, and things will fail to work properly since that’s its own instruction set.

It’s vocabulary for the actual wiring in the CPU. But, unlike how we learn languages, a CPU knows only 1 language, the ISA, it can’t learn anything else because that how the wires were physically set up by the manufacturers. Kind of like a set of instructions how to operate a specific lawn mower.

To explain what an ISA is and why it depends on the wires, let’s start real simple:

Let’s say you make a circuit with a switch and a lightbulb, your “instruction set” is basically a list of all the ways you can affect the lightbulb with the switch. As you could imagine, your ISA will have only 2 instructions, ON (1) and OFF (0). It takes a 1 bit number, because you only have 1 switch.

Ramping it up, you could replace 1 switch with 3 switches in series, the light would only turn on if all 3 switches were ON (1). Because you have 3 switches, you must give your circuit a 3 bit number in order to tell the lightbulb what to do. Your ISA would have an ON instruction which = 111 in binary, 7 in decimal. (You’d also have 7 other instructions, none of which turn on the lightbulb). You have 8 instructions total because you have 2^(3) possible switch combinations.

Hopefully this explains how the ISA is inherent to the actual circuitry, how we bridge the gap between the physical wires and the software.

Now, x86 CPUS take 32 bit numbers (Which usually contain the OPCODE and some other stuff), which turn on 32 different switches and light up different parts of the CPU circuits, which instead of turning on lightbulbs, it’ll do something else like write to RAM, or read from RAM, etc.

I haven’t covered OPERANDS. Unlike our light switch circuit, the CPU doesn’t just have 32 switches, it has more. For example Before you set the switches to the ADD instruction, you need to set extra switches for the 1st and 2nd numbers, once the CPU sees ADD A + B lit up, the wires will naturally result in the numbers being added together and put in a register.

So, the reason why AMD and Intel don’t have to be the same is because although they may have 32 switches, the manufacturer gets to decide what the CPU will do in response to 10100010000001…etc. Does it Add, Subtract, Write, Read, etc? That’s for the CPU designers to decide, and it all depends how they set up those internal wires.