Computer Instructions and Register Instructions
A register is a convenient, fast-access place on your computer for the CPU to find input or output. Some registers may be single-valued, which means it only stores a value and is read/write-able, and multi-valued, which means it stores more than one value and is read-only. The CPU’s instruction pointer is located in the register for reading or writing a specific value. Register files may contain instructions that load a program from the hard disk, or they may load a specific program from a floppy disk.
The CPU maintains two types of registers: data register and address registers. A data register is an alphanumeric register used to store instructions. Instructions are executed in a particular instruction context. In a 64-bit computer, data registers use a full word address for each bit of storage. They are referred to as EDX or EDXA.
An address register holds memory addresses and refers to the memory locations that a CPU can refer to for execution purposes. The use of an address register makes it possible to perform floating point arithmetic. A memory address register also saves instructions that translate between a lower and upper memory address. The instruction pointer and stack pointer are saved in this register.
Data registers are used to store data. A register can hold numbers, words, or other forms of data. General-purpose registers include ADD, DAT, and BCD. Instructions to add, subtract, or divide are stored in these registers.
A microprocessor maintains control. A register may execute a trap instruction, translate a machine instruction, store data into a register, or execute a subroutine, among other things. The main function of any register is to store a machine code for execution.
A register file contains machine instructions that are executed by the central processing unit or CPU. The number of registers that a processor has is determined by the size of the computer. Instructions stored in a register are translated by the CPU into a series of memory addresses. The target machine reads these memory addresses and executes the machine instructions that are resident in the register file. In a multi-core processor, multiple threads execute the same instructions in parallel, executing the instructions one after the other in a manner similar to how a CPU would compile its execution result into one or more virtual machines.
A two-cycle register has a memory location that contains only a single value for each cycle of execution. The value of this register is set to be zero for the first cycle, and becomes the accumulated result of the previous instruction. The second cycle adds one to the value and then adds the accumulated result from the previous instructions to the value that was set to be the result of the next instruction. A two-cycle register has no scope for storing a third value that would make the instruction multiple-threaded.
The P register is a special register that holds a constant address that can be used to refer to an instruction within a program, an index that identifies a particular instruction within a program, or a constant expression that evaluates to a particular value. A programmer can use the P register to write a label, or store a constant value as an index into this register. A P register instruction is a memory address instruction.