The processors do not hold a large memory inside them. Whatever storage is available to a processor, is in the form of a few registers. The registers in processor are limited in number and they often are used for some special purpose and some used for general purpose storage. Let's go through some kinds of registers used inside processors: Instruction Register The instruction fetched from the memory is held in the instruction register until it is completely executed. Program Counter This one is not exactly a register, but it has a pointer to the code memory indicating location of the instruction to be fetched. Accumulator This is a special register that - often holds one of the operands for ALU operation, - stores the result of ALU operation - often holds the data to be sent to output device or received from input device Accumulator is sometimes termed as A-register. Flags Register There are flags corresponding to current status of the program running on processor. These are often related to result of operations performed by ALU. All the flags are stored in a register and accessed to check some facts about last ALU operations e.g. whether carry was generated, or result was zero etc. Stack Pointer This is implemented in those processors which support a stack structure. Stack is a Last-In-First-Out type structure used to store data. Stack pointer register stores location of memory at which stack top data is present. General-purpose register This simply holds some data used in the computation process. There is no special purpose served by it. Which registers to implement, is a concern of any particular architecture. Let's go through examples of two different architectures to see what kind of registers are used in them. Example of 8085 microprocessor: The Intel 8085 microprocessor has following registers: A-register i.e. Accumulator Temp-register B-register C-register D-register E-register H-register L-register Program Counter Stack-pointer Instruction-register Flags flip-flops Increment/decrement address-latch A-register and Temp-register holds the two operands for ALU operation. Some 8-bit registers can be used in pair to hold a two-byte word as BC, DE and HL. All these six registers are general purpose registers i.e. used for computations. Following flags are contained in flags flip-flops : CY (carry) which indicates 9th bit of ALU result, if generated Z (Zero) indicates whether ALU operation yielded a zero result S (Sign) indicates MSB of ALU operation result P (Parity) indicates even/odd number of 1's in ALU operation result AC (Auxillary Carry) indicates carry from lower-nibble to upper-nibble of ALU operation result Increment/decrement address latch holds address to be put on the address bus to access the memory locations as needed. image reference : http://www.kollewin.com/EX/09-15-16/951_15_08_08_9_14_22.GIF Example of ARM processor: The ARM processor, very extensively used in embedded system applications is quite different in this aspect than the Intel processors. ARM provides much more general-purpose registers. There are 16 general purpose registers in ARM, each 32-bit wide. This is indeed the need of the ARM architecture because it supports instructions like ADD r0, r1, r3 ; here, the instruction is a 3-address instruction i.e. two operands and the destination is specified in instruction. In contrast, Intel processor assumes one operand to be always A-register. Thus, to facilitate the programmer to write effective programs, there is need of many registers, which ARM provides. The ARM general-purpose registers are named R0, R1, R2, . . . R15. Register R15 is the program-counter register of ARM, but can be used as general purpose under certain circumstances*. Register R14 is called 'link-register' which holds a copy of R15 content when a subroutine is called by program, and its content are copied back to R15 when program returns from subroutine to main-routine. Further, there are two more registers viz. CPSR and SPSR. CPSR (Current Program Status Register) folds program status in terms of four flags, interrupt status bits, and mode bits. And SPSR (Saved Program Status Register) is copy of CPSR when program routine is changed. More on registers in ARM, here image reference : http://www.yeralan.org/agen/images/arm_registers.gif So far we've discussed about the registers that are visible to an application programmer. The set of all registers viewable by programmer is called the 'Programmer's Model' of that processor. There are other registers in advanced processors, not accessible to application programmer but to operating system developer. We'll skip that discussion for now... In conclusion, registers are the only internal memory of processor, and they play vital role in the processor functioning. Connect with Digital Byte on facebook to get updates.
0 Comments
Leave a Reply. |
Like facebook page to get updates :
ArchivesCategories
All
|