From the software point of view of the CPU, it seems that the CPU is a series of instruction symbols. Therefore, we design a CPU, first of all to consider which instructions should be designed. The instruction system of the computer needs to be planned according to the requirement of the task, there will be arithmetic operation instruction, logic operation instruction, data transmitting instruction, access memory instruction, structure transfer instruction , etc.
We design a simple CPU, generally also have to add, subtract, multiply, in addition to these four arithmetic operations, so the CPU to add, subtract, multiply, divide the operation of the instructions . In fact, no CPU can lack the function of arithmetic operation, so the instruction of arithmetic operation is not a lack of instruction for each CPU.
If you are a software programmer, then you must be familiar with the basic structure of the program. Sequential structure, branch structure, loop structure and subroutine call structure, these are the basic structures that can not be lacked in program writing, it is certain that any simple or complex software program cannot be separated from these four structures, and will not exceed these four kinds of structures. In order to realize the programming of these four kinds of structures, we must design unconditional transfer instruction, conditional transfer instruction, subroutine call instruction, subroutine return instruction and so on . The cyclic structure and branching structure can be realized by the combination of unconditional transfer and conditional transfer. Subroutine call instruction and return instruction cooperate, can reuse various function program, can achieve deep nesting of program structure. In order to realize the loop and structure of the program, we must have at least a transfer instruction with a zero value and a negative number.
Since both the program and the data are placed in the memory, the memory must be accessed regardless of whether the instruction is taken or the memory is read or written, so the write memory instruction and the read memory instruction are necessary.
In addition to the instructions presented above, there are data transfer instructions between registers . Also, when programming, consider where the data is to be entered. There are two ways to input the CPU data, one is to receive the data from the outside in the program execution, and the other is to put the data into the instruction when programming. The latter way of data into the CPU is relatively simple, the previous data input method requires external equipment to cooperate, natural design is more complex.
The reason why computers can do mental work for us is to be able to interact with human-computer information. We tell the CPU what we think through the program, and the CPU must output the results to us. When the CPU tells us what information, it must also determine the corresponding data output instructions when designing the CPU.
What directives must be in the CPU design-->CPU