Skip to main content

PROCESSOR REGISTERS

 The processor contains a set of registers that provide faster and smaller memory than the main memory. It provides two functions

User-visible registers:

Enable the machine or assembly language programmer to minimize main memory references by optimizing register use. For high-level languages, an optimizing compiler will attempt to make intelligent choices of which variables to assign to registers and which to main memory locations. Some high-level languages, such as C,allow the programmer to suggest to the compiler which variables should be held in registers.

Control and status registers:

It is used by the processor to control the operation of the processor and by privileged OS routines to control the execution of the program.

    There is no clean division of registers in these two categories. For example, on some processors, the program counter is visible to the user, but for the most part it is not. For the purpose of the following discussion, however, it is convenient to use these categories

User-Visible Registers

A user visible register may be referenced by means of the machine language that the processor executes and is generally available to all programs, including application programs as well as system programs. Types of registers that are typically available are data, address and condition code registers.

    Data registers:    

            Can be assigned to the variety of functions by the programmer. In some cases they are general purpose in nature and can be used with any machine instruction that performs operations on data. Often, however, there are restrictions. For example, there may be dedicated registers for floating-point operations and others for integer operations.

    Address registers:

            It contain main memory address of data and instructions, or they contain portion of address that is used in the calculation of the complete or effective address. These registers may themselves be general purpose, or may be devoted to a particular way, or mode, of addressing memory. Examples include the following:

  • Index register:

           Indexed addressing is a common mode of addressing that involves adding an index to a base value to get the effective address.

  • Segment pointer:
            With segmented addressing, memory is divided into segments, which are variable-length blocks of words. A memory reference consists of a reference to a particular segment and an offset within the segment; this mode of addressing is important in our discussion of memory management. In this mode of addressing, a register is used to hold the base address of the segment. There may be multiple registers; for example, one for the OS i.e., when OS code is executing on the processor and one for the currently executing applications 

  • Stack pointer:
            If there is user-visible stack addressing, then there is a dedicated register that points to the top of the stack. This allows the use of instructions that contain no address field, such as push and pop.


            For some processor, a procedure call will result in automatic saving of all user-visible registers, to be restored on return. Saving and restoring is performed by the processor as part of the execution of the execution of the call and return instruction. This allows each procedure to use these registers  independently. On other processor, the programmer must save the contents of the relevant user-visible registers prior to a procedure call, by including instructions for this purpose in the program. Thus, the saving and restoring functions may be performed in either hardware or software, depending on the processor.


Control and Status Registers

A variety of processor registers are employed to control the operation of the processor. On most processors, most of these are not visible to the user. Some of them may be accessible by machine instructions executed in what is referred to as a control or kernel mode.

    Of course, different processors will have different register organizations and use different terminology. We provide here a reasonably complete list of register types, with a brief description. In addition to the MAR, MBR, I/OAR, and I/OBR registers mentioned earlier figure, the following are essential to instruction execution:

  • Program counter(PC):

            Contains the address of the next instruction to be fetched.

  • Instruction registers(IR):

            Contains the instruction most recently fetched 

All processor designs also include a register or set of registers, often known as the program status word (PSW), that contains status information. The PSW typically contains condition codes plus other status information, such as an interrupt enable/disable bit and a kernel/user mode bit.

    Condition codes 

    These are bits typically typically set by the processor hardware as the result of operations. For example, an arithmetic may produce a positive, negative,zero, or overflow result. In addition to the result itself being stored in a register or memory, a condition code is also set following the execution of the arithmetic instruction. The condition code may subsequently be tested as part of conditional branch operation. Condition code bits are collected into one or more registers. Usually, they form a part of a control register. Generally, machine instructions allow these bits to be read by implicit reference, but they cannot be altered by explicit reference because they are intended for feedback regarding the results of instruction execution.
      In processors with multiple types of interrupts, a set of interrupts registers may be provided with one pointer to each interrupt- handling routine. If a stack is used to implement certain functions then a stack pointer is needed. Finally registers may be used in the control of I/O operations.
       A number of factors go into the designs of the control and status register organization. One key issue is OS support. certain types of control information are of specific utility to the OS. If the processor designer has a functional understanding of the os to be used, then the register organization can be designed to provide hardware support for particular features such as memory protection and switching between user programs.
        Another key design decision is the allocation of control information between registers and memory. It is common to dedicate the first few hundred or thousand words of memory for control purposes. The designer must decide how much control information should be in more expensive, faster registers and how much in less expensive, slower main memory.


Read also basic elements of computer

Comments

Popular posts from this blog

Types of Operating System

 Types of Operating System Batch Operating system Time sharing Operating system Distributed Operating system Network Operating system Real Time Operating system Multi programming/Processing/Tasking Operating system Mobile Operating System Batch Operating System               In a Batch operating system the similar jobs are grouped together into batches with the help of some operators and these batches are executed one by one. For example, suppose we have ten programs, some are written in c++ programming language, Some are written in c programming language and the rest are written java programming language. Now, every time we run these programs one by one, we have to load the compiler of that particular language and then run the code. But if we do a batch of these ten programs, The advantage with this approach is that for the c++ batch, you only need to load the compiler once. Similarly, for Java and C , the compiler only needs to load once and the entire batch is executed. The followin

Python Variables

variables,the name itself implies that a variable is something which can change.  Variables are like containers for storing  our data values in memory. we can change the data in variables, in python everything is an object and variables are like names given to the object, by labeling them we can easily access them. In other high level languages like C programming language, c++ programming language, and java programming language. etc.,   we need to declare the datatype of the variable , but in python it will automatically recognize the type of data you are storing in a variable. ** Remember that a variable is a name which is given to a value not to the memory. Declaring a variable is very easy you need to assign a value or a string using '=' operator. >>> p=9 >>> print(p) 9 Assigning a single value to multiple variables We can assign a single value to multiple variables.  >>> a=b=c=56 >>> a 56 >>> b 56 >>> c 56 Assigning diff

DATA TYPES IN PYTHON | (Numeric,Boolean, Dictionary)

Previous Variables in Python  In python programming language everything is an object and data type tells us which types of value the object is. Data types are classified into five types in Python programming language, they are:- Best Laptop for Web Development  in 2021. NUMERIC DATATYPES BOOLEAN DATATYPES DICTIONARY SEQUENCE DATATYPE SET type() method  Type method is used to know what type of data we are using. Numeric Data Types Numeric type consists of numerical value data types for example whenever we assign a decimal value or numbers to variables then it comes under numeric data types. It contains : int float complex type Int or Integer It is a data type where the value given by the user can be positive or negative and can be of any length that means it can be a big integer or small integer but it should not be a fraction or a decimal value. #Python Program to # demonstrate int value p= 5556677 print ( type (p)) q=- 45 print ( type (q)) #output < class 'int' > <

Even or Odd Number and Factorial of a Number in Python Programming

1. To Check if the given number is even or odd If a number is completely divided by 2 then it is even number. When the number is divided by 2, we use the remainder operator %  to calculate the remainder. If the remainder is not zero, the number is odd. SOURCE CODE:- n= int ( input ( "enter any number:- " )) if (n% 2 == 0 ): print (n , 'is even number' ) else : print (n , 'is odd number' ) OUTPUT 1st Run enter any number:- 2 2 is even number 2nd Run enter any number:- 3 3 is odd number In the above code we use "Simple if" statement.  In the above program, we ask the user for input and check if the number is odd or even. 2.Factorial number Factorial of a number defined as the product of all numbers from 1 to given number. For example  5!(5 factorial)=5*4*3*2*1 is 120. Note = factorial of 0 is 1 SOURCE CODE n= int ( input ( "Enter any number:- " )) fact= 1 for i in range ( 1 , n+ 1 ): fact=fact*i print ( 'factorial of' ,

Functions of Operating System

 Operating System is an interface between the user and the hardware and enables the interaction of a computer's hardware and software.          Also, an operating system is software that performs all the basic functions of file management, storage management, process management, managing input and output, and controlling peripherals such as disk, drivers and printers. Functions of Operating System Device Management  File Management Memory Management Process Management Mastermind Storage Management Handling input/output operations Security Functions of Operating System Device Management          Operating system manages device communication via their respective drivers. It does the following activities for device management: Keeps tracks of all devices, input/output controller is responsible for this task. Decides which process gets the device when and for how much time Allocates the device in an efficient way. De-allocates devices. File Management           The operating system al

Computer System Architecture

 Based on number of general purpose processors computer systems are classified into three types.They are: Single Processor Systems. Multiprocessor Systems. Clustered Systems. Single Processor Systems From the name it is very clear that it has only single processor. A major central processing unit that can execute a set of general utility instructions, including user process instructions. There are some other special purpose processors present that performs device specific task. In the single processor system apart from the main central processing unit(CPU) there are also other processors which are present which does not do the general purpose task but it performs some device specific task. It means that we have a certain devices in our computers like keyboard, disk, etc. for all this they may be some microprocessor  which is specified to do a specific task related to that device like for example keyboard, when we press a key on our keyboard the keystroke has to be converted to some kin

Contact form

Name

Email *

Message *