Well this is a really general query that has been troubling me. I just read about the processor registers and learned that there are basically twp broad classes of them – User visible registers: to minimize memory references and speed up the functioning and Control and Status Registers – used by the processor for operation of the processor itself. Can anybody explain, or probably refer me to some link that could enhance my understanding of this concept. What exactly does one mean by a user visible register? and i also read that the PC is sometimes user visible. Now, what does that mean?
Thanks in advance.
Processors generally have a small number of User visible registers, which are, as you said, registers used to minimize memory use. For example, a compiler might assign a control variable in a for loop to a register. Register read times are generally orders of magnitude faster than read times from RAM. In fact, registers are even faster than the cache. Therefore, when your code is very frequently reading and/or modifying a variable, User Visible registers can help speed those computations. Generally, compilers use the available user registers very effectively.
On the other hand, Control and Status registers are generally very privileged and may be impossible to access for the normal user. For example, there are often hundreds or even thousands of registers on processors which hold information like core temperatures or processor model-numbers. They are often used by processor manufacturers during debug.
When people are saying that the PC may be visible to the user, they are referring to the Program Counter, which is a register that holds a pointer (address) to the instruction that is to be executed next. The address in the PC is used to load an Instruction Register (IR) with the instruction from memory, which is then decoded and executed.