Memory Operations and Instructions in Computer System
In memory, we store both the instructions of the programs and the data operands. There are different memory locations and addresses of a computer system. For the execution of an instruction to take place, the word should be there in the processor control circuits. The word or the words contains the set of instructions which are to be transferred from the memory to the processor. In addition to the words, there should be a movement of the operands and the results in between the processor and the memory. Due to this, we come across the two important and the basic operations which involve the memory for the movement. These are
1. Load (Fetch or Read)
2. Store (or Write)
FUNCTIONING OF THE LOAD OPERATION
The duty of transferring the content and its copy from a memory location to the processor is with load operation. The contents of the memory are left unchanged. For the beginning of the processing of the load operation, the address of the location is sent to the memory by the processor. After this, it requests to read the content. Then the memory does its part of reading the content and then sending it to the processor.
FUNCTIONING OF THE STORE OPERATION
The operation begins its process by transferring the informative item to a specific location of memory from the processor. It does by destroying the contents already stored in that location. Then the address of the desired location is sent by the processor to the memory in addition to the data which is written on that location of memory.
There is a transfer of the item information from the processor to the single operation in the memory location. The length of the item can be either from one word to one byte. We know that the processor stores a small amount of information and number of registers is also low. Every register is capable of holding a word, not more than this. The registers can be either used as the source or the destination of the transfer. They can take the item information which has come from the memory or the one which is going to it. The byte when is being transferred is stored in the rightmost or the low-order registers’ byte position.
INSTRUCTIONS AND INSTRUCTION SEQUENCING
There are small steps of the tasks which the computer system carries out. The examples can be the addition of the two numbers, reading of a character from the keyboard, testing the memory for a particular condition in the system. Sending a character for displaying on the computer screen is also a task, or you can say output of the input processed by the computer system. The basic and the most important instructions which every computer system must perform are the following-
- Transfer of the input and output
- Operations, i.e. being the arithmetic or the logical are performed on data
- Control and the sequencing of the program
- Transfer of the data from the memory and the processor registers
1. Notation of the Register Transfer
Here, the transfer takes place from one computer location to the other. The locations which are possible to be involved in the transfer part are-
- Processor registers
- Registers involved in the subsystem of I/O
- Memory locations
The identification of the location involved in this system is usually detected by the symbolic name which is standing for the binary addresses of the hardware.
The denotation of the contents of the location is by placing a square bracket around the location name.
2. Notation of Assembly Language
For the representation of the programs and the machine instructions, we need one more type of notation. As the name suggests, we use the format based on the assembly language.
For example, if we need to transfer the data from the memory location which is named as LOC to the register of the processor, R1, then it is specified as follows
MOV LOC, R1
No, the contents of the location of the memory are not changed by the process of execution. But the contents of the registers already stored in them are overwritten. For another example, add the contents of the registers R1, R2, and R3. It can be classified as
Add R1, R2, R3
3. Basic Instruction Types
The fundamental capability of any of the computer system is to operate on adding two numbers. For instance, C=A+B
The command of the program of any of the operation is the statement. Adding the computer values called A and B, and the result of the addition is stored to a third variable, i.e. C. When the program compilation of these two variables takes place, then the memory is assigned to the distinct memory locations.
The name is given to the variables for referencing the corresponding addresses of the memory locations. Why does the statement of the high-level language require action to take place in the computer? It is because the locations represent the values of the three variables.
C [A]+ [B]
For the action to be performed, the fetching of the memory locations takes place. It means the sum is calculated. The resultant is given back and then stored in the memory location of C. C is the destination operand, and the other A and B are the source operands. The generalized case can be represented as - Operation Source1, Source2, Destination.
ENCODED FORM OF DATA
If we need m bits for specifying the memory address of each operand, then there must be 3m bits in the encoded form of data for addition.
The data in the 32-bits address space have the problem that not all the data can be fit in one word for a normal word length. Thus, we need a format which contains multiple words for representation of the type of instruction.