zoukankan      html  css  js  c++  java
  • 指令计数器--Program counter

    别名:指令指针、指令地址寄存器、程序计数器;

    操作:顺序操作(计数器加一)、分支操作(计数器修改);

    The program counter (PC), commonly called the instruction pointer (IP) in Intel x86 and Itanium microprocessors, and sometimes called the instruction address register (IAR),[1] the instruction counter,[2] or just part of the instruction sequencer,[3] is a processor register that indicates where a computer is in its program sequence.[note 1]

    In most processors, the PC is incremented after fetching an instruction, and holds the memory address of ("points to") the next instruction that would be executed.

    Processors usually fetch instructions sequentially from memory, but control transfer instructions change the sequence by placing a new value in the PC. These include branches (sometimes called jumps), subroutine calls, and returns. A transfer that is conditional on the truth of some assertion lets the computer follow a different sequence under different conditions.

    A branch provides that the next instruction is fetched from elsewhere in memory. A subroutine call not only branches but saves the preceding contents of the PC somewhere. A return retrieves the saved contents of the PC and places it back in the PC, resuming sequential execution with the instruction following the subroutine call.

    https://en.wikipedia.org/wiki/Program_counter

    Branch (computer science)

    Mechanically, a branch instruction can change the program counter (PC) of a CPU. The program counter stores the memory address of the next instruction to be executed. Therefore, a branch can cause the CPU to begin fetching its instructions from a different sequence of memory cells.

    When a branch is taken, the CPU's program counter is set to the argument of the jump instruction. So, the next instruction becomes the instruction at that address in memory. Therefore, the flow of control changes.

    When a branch is not taken, the CPU's program counter is unchanged. Therefore, the next instruction executed is the instruction after the branch instruction. Therefore, the flow of control is unchanged.

    https://en.wikipedia.org/wiki/Branch_(computer_science)

  • 相关阅读:
    HHHOJ #153. 「NOI模拟 #2」Kotomi
    HHHOJ #151. 「NOI模拟 #2」Nagisa
    Luogu P5298 [PKUWC2018]Minimax
    Luogu P5368 [PKUSC2018]真实排名
    Luogu P5408 【模板】第一类斯特林数·行
    Codechef December Challenge 2019 Division 1
    AtCoder Grand Contest 040
    CSP2019游记(翻车记)
    Codeforces Round #594 (Div. 1)
    AtCoder Grand Contest 039
  • 原文地址:https://www.cnblogs.com/feng9exe/p/10552307.html
Copyright © 2011-2022 走看看