The following page(s) exists already in other namespace(s) with the same name part:
- Instruction (Machine Language)
- Instruction - Instruction Pointer Register
- Instruction - Instruction Set (Device Language)
- Assembly - Instruction
- Intel Instruction Interpretation
- DockerFile - Instruction
Instruction (Machine Language)
Table of Contents
1 - About
2 - Articles Related
3 - Type
Instruction that involves a memory address:
- branch instruction
- loading/saving data
4 - Syntax
- is a fixed-size series of bits.
- has a length that may varies.
- shares the same structure (see below)
The instruction format is device dependent but show always this structure:
- an opcode - an single digit that identify a unique operation (function)
- and zero or more operands (the argument of the opcode)
There is no grammar that defines what is a valid sequence of machine instructions. The CPU reads the instruction bytes, and if it is a valid machine instruction, it will be executed. Otherwise, typically an “invalid instruction” hardware exception will be generated.
Instructions are usually written in assembly with the help of mnemonic. See Assembly - Instruction
5 - Example
6 - List
6.1 - Type
6.2 - General-purpose
This group of instructions are general-purpose instructions that perform:
- basic data movement,
- binary integer,
- logic operations,
- shift and rotate,
- bit and byte operations,
- program control (program flow)
- flag control,
- segment register operations,
- and miscellaneous subgroups.
They operate on:
- data contained in memory, in the general-purpose registers (EAX, EBX, ECX, EDX, EDI, ESI, EBP, and ESP) and in the EFLAGS register.
- address information contained in memory, the general-purpose registers, and the segment registers (CS, DS, SS, ES, FS, and GS).
7 - Implementation
Each instruction is implemented via a circuit.
You can see them as function name.
8 - Execution
9 - Pointer
The instruction pointer holds the location of the next instruction, and increments itself after every instruction.
10 - Example
10.1 - Basic
10.2 - 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
10.3 - x86 architecture
Example on the x86 ISA architecture:
- the pattern 10100000 means add two numbers,
- the pattern 000000101 means halt a computer