And no I don't mean "How do you write a program for a processor".

What I want to know is how does a processor interpret some aribtrary instruction, say 100001 as ADD r1,r2 etc.? What do the individual bits in the bit sequence mean and how does the bit sequence tell the processor what to do?

Is it similar to how an FPGA works? Is the processor logic just a bunch of gates?


closed as unclear what you're asking by JYelton, Matt Young, Chetan Bhargava, Nick Alexeev, tcrosley Feb 5 '14 at 1:17

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


The canonical work to read here is "Computer Organization and Design" by Hennessy / Patterson. Basically the first 4-6 bits of the machine code is called the opcode which tells the ALU on the processor which operation to perform (addition, subtraction, multiplication, division), and the remaining bits are the 2 operands to perform the addition on and where to store the result. The actual arthmetic is done by the ALU which is composed bu mux, decoder, fulladder and primitives. If you look at how an ALU (arhithmetic-logic unit) is working, you will know the important part of the processor. A modern processor also has cache memory, pipelining, data forwarding and branch prediction but that is not central for the question you ask. To intrepret machine code, the processor uses the opcode to decide the operation and the rest of the bit sequence is the two registers that are the operands and which register to store the result in. The rest is specific circuits that you can find in the book "Computer Organization and Design"

enter image description here


Not the answer you're looking for? Browse other questions tagged or ask your own question.