Home >Common Problem >What is stored in the program counter pc
#What is stored in the program counter pc?
The program counter pc stores the "instruction address".
The program counter PC is used to store the address of the next instruction to be executed. It controls the execution order of the program.
Related introduction:
The program counter is used to store the address of the unit where the next instruction is located.
When executing an instruction, the instruction first needs to be fetched from the memory to the instruction register according to the instruction address stored in the PC. This process is called "instruction fetching". At the same time, the address in the PC is either automatically incremented by 1 or the address of the next instruction is given by the branch pointer. After that, the instructions are analyzed and executed. Complete the execution of the first instruction, and then fetch the address of the second instruction according to the PC, and so on, executing each instruction.
The program counter is a register in a computer processor that contains the address (location) of the instruction currently being executed. As each instruction is fetched, the program counter's memory address is incremented by one. After each instruction is fetched, the program counter points to the next instruction in the sequence. When the computer is restarted or reset, the program counter usually returns to zero.
The above is the detailed content of What is stored in the program counter pc. For more information, please follow other related articles on the PHP Chinese website!