Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Program counter
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Processor register that indicates where a computer is in its program sequence}} {{More citations needed|date=February 2025}} {{Use dmy dates|date=February 2020|cs1-dates=y}} [[File:IBM 701console.jpg|thumb|Front panel of an [[IBM 701]] computer introduced in 1952. Lights in the middle display the contents of various registers. The '''instruction counter''' is at the lower left.]] The '''program counter''' ('''PC'''),<ref name="CompArchOrg">{{cite book |title=Computer Architecture and Organization |last=Hayes |first=John P. |isbn=0-07-027363-4 |year=1978 |page=245|publisher=McGraw-Hill }}</ref> commonly called the '''instruction pointer''' ('''IP''') in [[Intel]] [[x86]] and [[Itanium]] [[microprocessor]]s, and sometimes called the '''instruction address register''' ('''IAR'''),<ref name="Mead_1980" /><ref name="CompArchOrg"/> the '''instruction counter''',<ref name="IBM_1953" /> or just part of the instruction sequencer,<ref name="Katzan_1971" /> is a [[processor register]] that indicates where a [[computer]] is in its [[computer program|program]] sequence.<ref name="a238">{{cite book | last=Bates | first=Martin | title=PIC Microcontrollers | chapter=Microcontroller Operation | publisher=Elsevier | date=2011 | isbn=978-0-08-096911-4 | doi=10.1016/b978-0-08-096911-4.10002-3 | pages=27β44|quote=Program Counter (PC) is a register that keeps track of the program sequence, by storing the address of the instruction currently being executed. It is automatically loaded with zero when the chip is powered up or reset. As each instruction is executed, PC is incremented (increased by one) to point to the next instruction. }}</ref><ref group="nb" name="NB1" /> Usually, the PC is incremented after fetching an [[instruction (computer science)|instruction]], and holds the [[memory address]] of ("[[Pointer (computer programming)|points]] to") the next instruction that would be executed.<ref name="Silberschatz_2018" />{{refn|group="nb"|name="NB2"|In a processor where the incrementation precedes the fetch, the PC points to the current instruction being executed. In some processors, the PC points some distance beyond the current instruction; for instance, in the [[ARM7]], the value of PC visible to the programmer points beyond the current instruction and beyond the [[delay slot]].<ref name="ARM_AG12" />}} Processors usually fetch instructions sequentially from [[Computer memory|memory]], but ''control transfer'' instructions change the sequence by placing a new value in the PC. These include [[branch (computer science)|branches]] (sometimes called jumps), [[subroutine]] calls, and [[return statement|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.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)