What Is an Instruction Register?
The instruction register (IR, Instruction Register) is a register that temporarily stores program instructions obtained from the memory, and is used to store a currently executing instruction read from the main memory.
- The computer controller stores the instructions to be executed
- The task completed in the instruction fetch phase is to fetch the current instruction from the main memory and send it to the instruction register [2]
- The instruction register is used to store the computer operation instructions read from the memory of the current computer state. For example, when we performed a right mouse button operation on the desktop of the computer at this time, this mouse hardware operation instruction will be instructed. Registers are read and stored before execution.
- The specific working mode of the instruction register is that when the computer is executing an instruction, the computer first transfers data to the memory, and then the data memory reads the instruction data from the memory and transfers the instruction data to the instruction register. Generally speaking, a piece of instruction is composed of operation code and address code fields. The basic structure is the most essential of a computer.
- Difference from instruction pointer register
- The instruction pointer register is abbreviated as IP in English. Although it is also an instruction register, it is strictly different from the traditional instruction register in the strict sense. For example, the instruction pointer register does not contain an instruction, but a memory address. This memory address points from one instruction to another. It is described in computer science language, which is a pointer. When the computer is working, the CPU will obtain the relevant memory address of the instruction from the IP, then fetch the instruction in the correct way, and place the instruction in the original instruction register. After completing this task, the instruction pointer register will add one to itself, that is, the work will point to the next operation to complete the effect of its own pointer.
- Therefore, the instruction register is a register for storing computer operation instructions. In computer science, especially when using assembly language, the instruction register and various other registers are often used. They are an intuitive expression of the computer's work and transmit signals. Also basically binary or hexadecimal.