Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Program Counter hold current address or the address of the next instruction?

Being a beginner and self-learner, I am learning assembly and currently reading the chapter 3 of the book, The C Companion by Allen Hollub. I can't understand the description of Program Counter or PC he describes in an imaginary demo machine with two byte word. Here is the description of PC in page 57.

"The PC always holds the address of the instruction currently being executed. It is automatically updated as each instruction executed to hold the address of the next instruction to be executed. ... ... The important concept here is that the PC holds the address of the next instruction, not the instruction itself. "

I fail to understand the difference between holding the current address and the address of the next instruction. Does PC hold the two addresses in two consecutive bytes at the same time?

like image 851
Bishnu Avatar asked Aug 25 '18 16:08

Bishnu


Video Answer


1 Answers

Initially, PC(register) holds the current value but as the clock signal changes it changes to PC(Previous address + value) and it will contain the same value till the next clock cycle and after the addition of value it will store the address in the register.

like image 150
Saad Ali Avatar answered Sep 22 '22 20:09

Saad Ali