CPU - Instruction (Machine Language Word)

1 - About

A machine instruction is a unique bit string that a device can identify and execute.

An Instruction refers generally to the words of the language understood by the CPU but other device (such as the GPU or printer) has also one. See (CPU|GPU) - Instruction Set - Processor Language

The CPU requires a fixed number of clock ticks (or clock cycles) to execute each instruction.

3 - Implementation

Each instruction is implemented via a circuit.

You can see them as function name.

4 - Pointer

The instruction pointer holds the location of the next instruction, and increments itself after every instruction. So basically, the CPU reads the instruction pointer, fetches the next instruction, does it, increments the instruction pointer and then goes back to step one.

5 - Example

5.1 - Math

With logic gates, it's possible to build a machine that perform the following instructions when the following code input are received.

Instruction 		                        Code
"add a number to another number" 	   	00000001
"subtract a number from another number" 	00000010

5.2 - x86 architecture

  • the pattern 10100000 means add two numbers,
  • the pattern 000000101 means halt a computer

More, see X86_instruction_listings

6 - Documentation / Reference

os/cpu/instruction.txt ยท Last modified: 2018/12/10 21:45 by gerardnico