We need some more instruction to work with the computer. Apart from the instruction needed to perform task inside CPU, we need some more instructions for data transfer from main memory to CPU and vice versa.
In our hypothetical machine, we use three signal lines to identify a particular instruction. If we want to include more instruction, we need additional signal lines.
With this additional signal line, we can go upto 16 instructions. When the signal of this new line is 0, it will indicate the ALU operation. For signal value equal to 1, it will indicate 8 new instructions. So, we can design 8 new memory access instructions.
We have added 6 new instructios. Still two codes are unused, which can be used for other purposes. We show it as NOP means No Operation.
We have seen that for ALU operation, instruction decoder generated the signal for appropriate ALU operation.
Apart from that we need many more signals for proper functioning of the computer. Therefore, we need a module, which is known as control unit, and it is a part of CPU. The control unit is responsible to generate the appropriate signa.
As for example, for LDAI instruction, control unit must generate a signal which enables the register A to store in data into register A.
One major task is to design the control unit to generate the appropriate signal at appropriate time for the proper functioning of the computer.
Consider a simple problem to add two numbers and store the result in memory, say we want to add 7 to 5.
To solve this problem in computer, we have to write a computer program. The program is machine specific, and it is related to the instruction set of the machine.
For our hypothetical machine, the program is as follows
Consider another example, say that the first number is stored in memory location 13 and the second data is stored in memory location 14. Write a program to Add the contents of memory location 13 and 14 and store the result in memory location 15.
One question still remain unanswerd: How to store the program or data to main memory. Once we put the program and data in main memory, then only CPU can execute the program. For that we need some more instructions.
We need some instructions to perform the input tasks. These instructions are responsible to provide the input data from input devices and store them in main memory. For example instructions are needed to take input from keyboard.
We need some other instructions to perform the output tasks. These instructions are responsible to provide the result to output devices. For example, instructions are needed to send the result to printer.
We have seen that number of instructions that can be provided in a computer depends on the signal lines that are used to provide the instruction, which is basically the size of the storage devices of the computer.
For uniformity, we use same size for all storage space, which are known as register. If we work with a 16-bit machine, total instructions that can be implemented is 216.
The model that we have described here is known as Von Neumann Stored Program Concept. First we have to store all the instruction of a program in main memory, and CPU can work with the contents that are stored in main memory. Instructions are executed one after another.
We have explained the concept of computer in very high level abstraction by omitting most of the details.