What Is an Instruction Register?
In terms of computer hardware, an instruction register is an element in the central processing unit (CPU) of a computer or other device that holds the programming instruction that will be executed at the start of the next clock cycle as dictated by other parts of the CPU. Other elements of the CPU, such as the instruction decoder, rely on the instruction register to hold this information so it can be decoded, resolved and eventually executed. With some types of microprocessor architecture, there can be more than one instruction register so multiple instructions can be processed at the same time, forming an assembly-line style of logic that is known as a pipeline. Generally, new instructions are given to the instruction register through another part of the CPU known as the program counter, which serves a very similar purpose but can move ahead to the next instruction while information the instruction register is holding is executed.
A register is a series of physical switches on a microprocessor or circuit board that can be turned on or off, making each switch equivalent to a bit. When several of the switches, also called latches, are linked, they are able to store binary data such as numbers, which can be turned into memory addresses or instruction codes. Within the CPU, the instruction register can hold either the address in computer memory of the instruction that is being executed or, for efficiency, it can hold the instruction itself. This information is passed to the register through another register known as the program counter, which in most cases jumps forward to the next instruction to be executed after passing on the current instruction.
The types of instructions processed by the registers generally are low-level assembly language commands that are eventually translated into machine code, or byte code. These are distinctly different from instructions in higher-level programming languages, because the assembly instructions operate on a very small, direct scale. One example is a line of high-level code that adds two numbers together and stores the results in a variable, which takes only a single line of high-level code to express. When the code is compiled, a dozen or more instructions could be generated to complete the task, with each instruction being something simple, such as shuffling values between computer random access memory (RAM) and a utility register.
Once an instruction is referenced by the instruction register, it is passed to the instruction decoder so the instruction can be converted into machine code. References to memory locations that might hold variables or other information are resolved and that information is sometimes placed in other registers. Finally, the actual instruction will be executed. During this time, the program counter will be incremented by the CPU to point to the next instruction that will be held by the instruction register so the process can repeat until the entire program has executed.
Discuss this Article
Post your comments