How does the CPU know its instruction set?

johnny picture johnny · Dec 13, 2010 · Viewed 7.3k times · Source

Basic computer operation question but I'm not sure how to ask it. When we say that a computer has an instruction set, how does the computer know what that set is? Is it stored in a ROM chip? Is it stored in the CPU somewhere? Where did the manufacturer put it so that it can read a disk and start processing machine code?

Answer

In silico picture In silico · Dec 13, 2010

Short answer: The actual circuitry in the processor of the computer is what "determines" the instruction set.

Relatively short answer: The software that runs on the processor is physically just patterns of electrical signals. The transistors in the computer switch on and off many, many, many times a second, modifying these patterns of signals based on other signals. For example, consider the mov instruction found on just about every processor out there:

mov dest, src

This is encoded by a certain electrical signal pattern "stored" in memory. That signal pattern activates certain transistors on and off in such a way that the signals stored at dest matches that at src, because of how the circuitry is wired.

Long answer: Take a class in computer architecture. :-)