Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualKing Mir

Posted 12 November 2013 - 12:45 PM

1) Does that mean it can only hold one of the two at one time? If so, why is this?
 
I also read an instruction needs to get fetched, is the program counter doing the fetching too? I thought it was its job is to hold address of an instruction. blink.png

It's 1 register, so it holds one value. When exactly it point to the next or current instruction depends on the architecture. Ostensibly it needs to point to the right instruction when that instruction is fetched, however.
 
2) When an instruction gets fetched: what does it mean for a program counter to increased its stored value by 1? Is it as easy as adding the number 1 to this value?
Yes, assuming that all instructions are the same size for a particular architecture. You can also look at it as increasing the PC by the size of an instruction, where the least significant bits are always 0 and therefore not represented in hardware.
 
3) Is the address of the instruction binary or hexadecimal? Is it encoded beforehand before the program counter fetches it?
There's no difference. binary and hexadecimal are details of how numbers are displayed, not how they are encoded, in this context. Binary can also be considered an encoding, but hexadecimal never is. Binary encoding might be contrasted with Binary coded decimals, but you probably won't need to know that.

4) If the program counter is holding the address of the next instruction, is the instruction register holding the address of the current instruction?
The instruction register would hold the value of the current instruction, like if it's an add or a load or whatever.
 
5) Who does the decoding of any of the two addresses of the instructions?
A block of transistors probably named for their role.
 

Also keep in mind that unless you're looking at a specific microprocessor, these concepts are pretty abstract, and may not exist physically in the same way. But they do model the behavior correctly.

#1King Mir

Posted 11 November 2013 - 10:19 PM

1) Does that mean it can only hold one of the two at one time? If so, why is this?
 
I also read an instruction needs to get fetched, is the program counter doing the fetching too? I thought it was its job is to hold address of an instruction. blink.png

It's 1 register, so it holds one value. When exactly it point to the next or current instruction depends on the architecture. Ostensibly it needs to point to the right instruction when that instruction is fetched, however.
 
2) When an instruction gets fetched: what does it mean for a program counter to increased its stored value by 1? Is it as easy as adding the number 1 to this value?
Yes, assuming that all instructions are the same size for a particular architecture. You can also look at it as increasing the IP by the size of an instruction, where the least significant bits are always 0 and therefore not represented in hardware.
 
3) Is the address of the instruction binary or hexadecimal? Is it encoded beforehand before the program counter fetches it?
There's no difference. binary and hexadecimal are details of how numbers are displayed, not how they are encoded, in this context. Binary can also be considered an encoding, but hexadecimal never is. Binary encoding might be contrasted with Binary coded decimals, but you probably won't need to know that.

4) If the program counter is holding the address of the next instruction, is the instruction register holding the address of the current instruction?
The instruction register would hold the value of the current instruction, like if it's an add or a load or whatever.
 
5) Who does the decoding of any of the two addresses of the instructions?
A block of transistors probably named for their role.
 

Also keep in mind that unless you're looking at a specific microprocessor, these concepts are pretty abstract, and may not exist physically in the same way. But they do model the behavior correctly.

PARTNERS