Program counter

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),[1] commonly called the instruction pointer (IP) in Intel x86 and Itanium microprocessors, and sometimes called the instruction address register (IAR),[2][1] the instruction counter,[3] or just part of the instruction sequencer,[4] is a processor register that indicates where a computer is in its program sequence.[5][nb 1]

Usually, the PC is incremented after fetching an instruction, and holds the memory address of ("points to") the next instruction that would be executed.[6][nb 2]

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.

Hardware implementation

In a simple central processing unit (CPU), the PC is a digital counter (which is the origin of the term "program counter") that may be one of several hardware registers. The instruction cycle[8] begins with a fetch, in which the CPU places the value of the PC on the address bus to send it to the memory. The memory responds by sending the contents of that memory location on the data bus. (This is the stored-program computer model, in which a single memory space contains both executable instructions and ordinary data.[9]) Following the fetch, the CPU proceeds to execution, taking some action based on the memory contents that it obtained. At some point in this cycle, the PC will be modified so that the next instruction executed is a different one (typically, incremented so that the next instruction is the one starting at the memory address immediately following the last memory location of the current instruction).

Like other processor registers, the PC may be a bank of binary latches, each one representing one bit of the value of the PC.[10] The number of bits (the width of the PC) relates to the processor architecture. For instance, a “32-bit” CPU may use 32 bits to be able to address 232 units of memory. On some processors, the width of the program counter instead depends on the addressable memory; for example, some AVR microcontrollers have a PC which wraps around after 12 bits.[11]

If the PC is a binary counter, it may increment when a pulse is applied to its COUNT UP input, or the CPU may compute some other value and load it into the PC by a pulse to its LOAD input.[12]

To identify the current instruction, the PC may be combined with other registers that identify a segment or page. This approach permits a PC with fewer bits by assuming that most memory units of interest are within the current vicinity.

Consequences in machine architecture

Use of a PC that normally increments assumes that what a computer does is execute a usually linear sequence of instructions. Such a PC is central to the von Neumann architecture. Thus programmers write a sequential control flow even for algorithms that do not have to be sequential. The resulting “von Neumann bottleneck” led to research into parallel computing,[13] including non-von Neumann or dataflow models that did not use a PC; for example, rather than specifying sequential steps, the high-level programmer might specify desired function and the low-level programmer might specify this using combinatory logic.

This research also led to ways to making conventional, PC-based, CPUs run faster, including:

  • Pipelining, in which different hardware in the CPU executes different phases of multiple instructions simultaneously.
  • The very long instruction word (VLIW) architecture, where a single instruction can achieve multiple effects.
  • Techniques to predict out-of-order execution and prepare subsequent instructions for execution outside the regular sequence.

Consequences in high-level programming

Modern high-level programming languages still follow the sequential-execution model and, indeed, a common way of identifying programming errors is with a “procedure execution” in which the programmer's finger identifies the point of execution as a PC would. The high-level language is essentially the machine language of a virtual machine,[14] too complex to be built as hardware but instead emulated or interpreted by software.

However, new programming models transcend sequential-execution programming:

  • When writing a multi-threaded program, the programmer may write each thread as a sequence of instructions without specifying the timing of any instruction relative to instructions in other threads.
  • In event-driven programming, the programmer may write sequences of instructions to respond to events without specifying an overall sequence for the program.
  • In dataflow programming, the programmer may write each section of a computing pipeline without specifying the timing relative to other sections.

See also

Notes

  1. ^ For modern processors, the concept of "where it is in its sequence" is too simplistic, as instruction-level parallelism and out-of-order execution may occur.
  2. ^ 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.[7]

References

  1. ^ a b Hayes, John P. (1978). Computer Architecture and Organization. McGraw-Hill. p. 245. ISBN 0-07-027363-4.
  2. ^ Mead, Carver; Conway, Lynn (1980). Introduction to VLSI Systems. Reading, USA: Addison-Wesley. ISBN 0-201-04358-0.
  3. ^ Principles of Operation, Type 701 and Associated Equipment (PDF). IBM. 1953.
  4. ^ Harry Katzan (1971), Computer Organization and the System/370, Van Nostrand Reinhold Company, New York, USA, LCCCN 72-153191
  5. ^ Bates, Martin (2011). "Microcontroller Operation". PIC Microcontrollers. Elsevier. p. 27–44. doi:10.1016/b978-0-08-096911-4.10002-3. ISBN 978-0-08-096911-4. 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.
  6. ^ Silberschatz, Abraham; Gagne, Greg; Galvin, Peter B. (April 2018). Operating System Concepts. United States: Wiley. pp. 27, G-29. ISBN 978-1-119-32091-3.
  7. ^ "ARM Developer Suite, Assembler Guide. Version 1.2". ARM Limited. 2001. Retrieved 2019-10-18.
  8. ^ John L. Hennessy and David A. Patterson (1990), Computer Architecture: a quantitative approach, Morgan Kaufmann Publishers, Palo Alto, USA, ISBN 1-55860-069-8
  9. ^ B. Randall (1982), The Origins of Digital Computers, Springer-Verlag, Berlin, D
  10. ^ C. Gordon Bell and Allen Newell (1971), Computer Structures: Readings and Examples, McGraw-Hill Book Company, New York, USA
  11. ^ Arnold, Alfred (2020) [1996, 1989]. "E. Predefined Symbols". Macro Assembler AS – User's Manual. V1.42. Translated by Arnold, Alfred; Hilse, Stefan; Kanthak, Stephan; Sellke, Oliver; De Tomasi, Vittorio. p. Table E.3: Predefined Symbols – Part 3. Archived from the original on 2020-02-28. Retrieved 2020-02-28. 3.2.12. WRAPMODE […] AS will assume that the processor's program counter does not have the full length of 16 bits given by the architecture, but instead a length that is exactly sufficient to address the internal ROM. For example, in case of the AT90S8515, this means 12 bits, corresponding to 4 Kwords or 8 Kbytes. This assumption allows relative branches from the ROM's beginning to the end and vice versa which would result in an out-of-branch error when using strict arithmetics. Here, they work because the carry bits resulting from the target address computation are discarded. […] In case of the abovementioned AT90S8515, this option is even necessary because it is the only way to perform a direct jump through the complete address space […]
  12. ^ Walker, B. S. (1967). Introduction to Computer Engineering. London, UK: University of London Press. ISBN 0-340-06831-0.
  13. ^ F. B. Chambers, D. A. Duce and G. P. Jones (1984), Distributed Computing, Academic Press, Orlando, USA, ISBN 0-12-167350-2
  14. ^ Douglas Hofstadter (1980), Gödel, Escher, Bach: an eternal golden braid, Penguin Books, Harmondsworth, UK, ISBN 0-14-005579-7

Read other articles:

Ne doit pas être confondu avec Plateau du Karst. Exemple de paysage karstique près de Minerve, Hérault, France : les falaises calcaires sont affectées par une érosion karstique caractéristique qui se fait principalement à la faveur de diaclases s'élargissant peu à peu et se colmatant avec des argiles ocres de décarbonatation et des restes organiques. Paysage de montagnes karstiques (Vang Vieng, Province de Vientiane, Laos). Carte de répartition mondiale des affleurements de r...

 

Yamato-Saidaiji大和西大寺Peron sebelum renovasi stasiun, Agustus 2007Lokasi1-1, Saidaiji Kunimichō Itchōme, Nara, Nara(奈良県奈良市西大寺国見町1丁目1-1)JapanKoordinat34°41′38″N 135°46′58″E / 34.69389°N 135.78278°E / 34.69389; 135.78278Koordinat: 34°41′38″N 135°46′58″E / 34.69389°N 135.78278°E / 34.69389; 135.78278OperatorKereta Api KintetsuJalur Jalur Nara Jalur Kyoto Jalur Kashihara Layanan Term...

 

Diagram UMLUnified Modeling Language (UML) adalah bahasa spesifikasi standar untuk mendokumentasikan, menspesifikasikan, dan membangun sistem perangkat lunak. Pendahuluan Unified Modeling Language (UML) adalah himpunan struktur dan teknik untuk pemodelan desain program berorientasi objek (OOP) serta aplikasinya.[1] UML adalah metodologi untuk mengembangkan sistem OOP dan sekelompok perangkat tool untuk mendukung pengembangan sistem tersebut.[1] UML mulai diperkenalkan oleh Ob...

Japanese video game publisher Entertainment Software Publishing, Inc.ESP's former headquarters in Shibuya, TokyoNative name株式会社エンターテインメント ソフトウェア パブリッシングRomanized nameKabushiki-gaisha Entāteinmento Sofutō~ea PaburisshinguCompany typeSubsidiaryIndustryVideo gamesFoundedNovember 1997; 26 years ago (1997-11)Defunct1 April 2010; 14 years ago (2010-04-01)FateMerged with D3 PublisherHeadquartersShibuya, ...

 

Səməd Vurğun is a village and municipality in the Shamkir Rayon of Azerbaijan. It has a population of 1,433.[citation needed] The village was named after Soviet writer Samad Vurgun. References vteShamkir DistrictCapital: Şəmkir Abbaslı Aşağı Çaykənd Aşağı Seyfəli Atabəy Badakənd Badakənd Barlıbağ Barsum Barum Bayramlı Çaparlı Çaylı Çənlibel (Çardaqlı) Çinarlı Dağ Cəyir Daşbulaq Dəllər Cəyir Dəllər Cırdaxan Dəllər Daşbulaq Dəllər Düyərli D...

 

86th annual meeting of NFL franchises to select newly eligible players 2021 NFL draftGeneral informationDate(s)April 29 – May 1, 2021LocationFirstEnergy StadiumCleveland, OhioNetwork(s)ESPN, ABC, NFL Network, ESPN Deportes, ESPN RadioOverview259 total selections in 7 roundsLeagueNational Football LeagueFirst selectionTrevor Lawrence, QB, Jacksonville JaguarsMr. IrrelevantGrant Stuard, LB, Tampa Bay BuccaneersMost selections (11)Carolina PanthersDallas CowboysMinnesota VikingsFewest sel...

Синелобый амазон Научная классификация Домен:ЭукариотыЦарство:ЖивотныеПодцарство:ЭуметазоиБез ранга:Двусторонне-симметричныеБез ранга:ВторичноротыеТип:ХордовыеПодтип:ПозвоночныеИнфратип:ЧелюстноротыеНадкласс:ЧетвероногиеКлада:АмниотыКлада:ЗавропсидыКласс:Пт�...

 

Disambiguazione – Se stai cercando altri significati, vedi Gandalf (disambigua). GandalfIan McKellen interpreta Gandalf il Grigio nell'adattamento cinematografico de Lo Hobbit di Peter Jackson UniversoArda Lingua orig.Inglese AutoreJ. R. R. Tolkien EditoreAllen & Unwin 1ª app. inLo Hobbit (1937) Ultima app. inRacconti incompiuti (1981) Editore it.Bompiani Interpretato daIan McKellen Voci orig.John Huston (versione animata de Lo Hobbit del 1977) William Squire (versione animat...

 

Upazila in Rajshahi Division, Bangladesh Upazila in Rajshahi, BangladeshShibganj Upazila শিবগঞ্জUpazilaDarashbari MosqueCoordinates: 24°41′N 88°10′E / 24.683°N 88.167°E / 24.683; 88.167Country BangladeshDivisionRajshahiDistrictChapai NawabganjArea • Total525.42 km2 (202.87 sq mi)Population (2011) • Total591,178 • Density1,100/km2 (2,900/sq mi)DemonymShibganjiTime zoneUTC+6 (BST)Webs...

French engineering College École polytech universitaire de Sorbonne UniversitéTypePublicEstablished1983LocationParis, FranceAffiliationsConférence des Grandes ÉcolesWebsitewww.polytech.sorbonne-universite.fr École polytech universitaire de Sorbonne Université (Polytech Sorbonne) a French engineering College in Paris, France, created in 1983.[1] The school trains engineers in high sectors : Agribusiness, Electronics and Computers, Applied Mathematics and Computers, Materials...

 

منطقة الجوف. هذه قائمة عن ثدييات منطقة الجوف، والتي تقع في شمال غرب المملكة العربية السعودية. آكلات الحشرات الاسم الشائع الاسم العلمي الفصيلة التفاصيل المصدر رتبة قنفذيات الشكل القنفذ الأثيوبي Paraechinus aethiopicus القنفذيات القنفذ الأثيوبي هو أحد ثلاثة أنواع منتشرة في شبه الجزي�...

 

American mechanical engineer Powtawche ValerinoValerino in 2017NationalityMississippi Choctaw, AmericanAlma materRice University Stanford UniversityOccupationEngineerEmployerNASA Powtawche N. Valerino is an American mechanical engineer at the NASA Jet Propulsion Laboratory. She worked as a navigation engineer for the Cassini mission. Early life and education Valerino was born to a Mississippi Choctaw mother and African-American father. She grew up on the Mississippi Choctaw reservation a...

Hamlet in West Yorkshire, England 53°42′25″N 2°04′01″W / 53.707°N 2.067°W / 53.707; -2.067 Mankinholes in 2016 Date stone for Mankinholes Methodist Church Mankinholes is a hamlet in the Metropolitan Borough of Calderdale, in West Yorkshire, England. It is situated in the Pennines and the nearest town is Todmorden. The hamlet is part of Calder Ward in Calderdale Parish Council. It has a YHA hostel, managed by the larger hostel at nearby Haworth. Mankinholes ...

 

Eduard SuessEduard Suess, 1869Lahir(1831-08-20)20 Agustus 1831London, InggrisMeninggal26 April 1914(1914-04-26) (umur 82)Vienna, AustriaMakamMarz, Austria47°43′6.991″N 16°24′57.932″E / 47.71860861°N 16.41609222°E / 47.71860861; 16.41609222KebangsaanAustriaAlmamaterUniversitas WinaDikenal atasBiosfer, Gondwana, Samudra Tethys, Das Antlitz der Erde, Teori Eustatik, Sima, sialSuami/istriHermine née StraussAnak5 putra, 1 putriPenghargaanHayden Memorial G...

 

2009 book by Thomas Sowell The Housing Boom and Bust Cover of the hardcover editionAuthorThomas SowellLanguageEnglishSubjectsUnited States housing bubble, Subprime mortgage crisisPublisherBasic BooksPublication dateApril 24, 2009 (1st edition)February 23, 2010 (revised edition)Publication placeUnited StatesMedia typePrint (Hardcover and Paperback)Pages192 (1st edition)233 (revised edition)ISBN978-0-465-01880-2Followed byIntellectuals and Society  The Housing Boom and Bust is a ...

1936 international arms control treaty The displacement of USS North Carolina, and the next and final two classes of U.S. battleships, was limited by the Second London Naval Treaty The Second London Naval Treaty was an international treaty signed as a result of the Second London Naval Disarmament Conference held in London, the United Kingdom. The conference started on 9 December 1935 and the treaty was signed by the participating nations on 25 March 1936. Treaty The signatories were Fran...

 

Inflation driven by a rise in the cost of goods and services Aggregate supply – aggregate demand model illustration of aggregate supply (AS) shifting to AS' and causing price level to increase while output shrinks Part of a series onMacroeconomics Basic concepts Aggregate demand Aggregate supply Business cycle CAGR Deflation Demand shock Disinflation Effective demand Expectations Adaptive Rational Financial crisis Growth Inflation Demand-pull Cost-push Interest rate Investment Liquidity tra...

 

Dieser Artikel oder nachfolgende Abschnitt ist nicht hinreichend mit Belegen (beispielsweise Einzelnachweisen) ausgestattet. Angaben ohne ausreichenden Beleg könnten demnächst entfernt werden. Bitte hilf Wikipedia, indem du die Angaben recherchierst und gute Belege einfügst. Restaurationsbrot aus der Gaststätte „Zum Einhorn“ in Frankfurt-Bonames Restaurationsbrot ist ein üppig belegtes Brot der deutschen Küche, mit mehreren Lagen Wurst, Käse, Salat, Eiern oder Fisch, das vor allem...

Give In to MeLagu oleh Michael Jackson featuring Slashdari album DangerousDirilis15 Februari 1993FormatCD single, 7, cassetteDirekamMei 1990GenreHard rock, heavy metal[1]Durasi5:28 (album version)4:42 (vocal version)LabelEpicPenciptaMichael JacksonBill BottrellProduserMichael JacksonBill Bottrell Give In To Me adalah sebuah singel lagu dari Michael Jackson yang dirilis pada 15 Februari 1993 untuk album studionya yaitu Dangerous.dalam singel ini ia berduet dengan gitaris dari Guns N' R...

 

نادي كيوتو سانغا الاسم الكامل نادي كيوتو سانغا لكرة القدم اللقب سانغا تأسس عام 1922 الملعب ملعب نيشيكيوغو أتلتيك أوكيو-كو , كيوتو ، اليابان(السعة: 20,588) البلد اليابان  الدوري دوري الدرجة الثانية الياباني المدرب تاكيش أوكي (2011–2013)إيتشيزو ناكاتا (2019–)فالدير فييرا (2014–2014)هيت�...