Home >Common Problem >What are the basic functions of a controller in a microcomputer?
In a microcomputer, the basic function of the controller is to "control the various components of the machine to work in a coordinated manner." The controller is a component that directs the various components of the computer to work in coordination according to the functional requirements of the instructions. It is the nerve center and command center of the computer and can coordinate and direct the operations of the entire computer system.
The operating environment of this tutorial: Windows 7 system, Dell G3 computer.
In a microcomputer, the basic function of the controller is to "control the various components of the machine to work in a coordinated manner."
Controller (controller) refers to the master command that changes the wiring of the main circuit or control circuit and changes the resistance value in the circuit in a predetermined sequence to control the starting, speed regulation, braking and reverse of the motor. device. Composed of program counter, instruction register, instruction decoder, timing generator and operation controller, it is the "decision-making mechanism" that issues commands, that is, it completes the coordination and command of the operation of the entire computer system.
The controller is a component that directs the various components of the computer to work in coordination according to the functional requirements of the instructions. It is the nerve center and command center of the computer. It is controlled by the instruction register IR (InstructionRegister), the program counter PC (ProgramCounter) and the operation control It consists of three components: OC (Operation Controller), which is extremely important for coordinating the orderly work of the entire computer.
Instruction register: A register used to save the currently executed or upcoming instructions. The instruction contains an opcode that determines the type of operation and an address that indicates the source or destination of the operand. Instruction length varies from computer to computer, as does the length of the instruction register. All computer operations are performed by analyzing the instructions stored in the instruction register. The input end of the instruction register receives instructions from the memory, and the output end of the instruction register is divided into two parts. The opcode part is sent to the decoding circuit for analysis to indicate what type of operation this instruction should perform; the address part is sent to the address adder to generate an effective address and then sent to the memory as an address for fetching or storing numbers.
Memory can refer to main memory, cache or register stack, etc. used to save an instruction currently being executed. When an instruction is executed, it is first fetched from memory into the data register (DR) and then transferred to the IR. Instructions are divided into opcode and address code fields, which consist of binary digits. In order to execute any given instruction, the opcode must be tested to identify the required operation. This is what the instruction decoder does. The output of the opcode field in the instruction register is the input to the instruction decoder. Once the operation code is decoded, it can send specific signals for specific operations to the operation controller.
Program counter: A counter that indicates the address of the next instruction to be executed in the program, also called an instruction counter. It functions as both an instruction address register and a counter. When an instruction is executed, the program counter serves as the instruction address register, and its content must have been changed to the address of the next instruction, so that the program can continue to run.
The following two methods can be adopted for this purpose:
The first method is to include the address of the next instruction in the instruction. During the execution of the instruction, sending this address to the instruction address register can achieve the purpose of continuous running of the program. This method was suitable for early computers that used serial devices such as drums and delay lines as main memory. Properly determining the address of the next instruction based on the execution time of this instruction can shorten the waiting time for reading the next instruction, thereby improving the program running speed.
The second method is to execute instructions sequentially. A program consists of several program segments. The instructions of each program segment can be designed to be stored in the memory sequentially. Therefore, as long as the instruction address register also has a counting function, it will be counted during the execution of the instruction and an increment will be automatically added. , the address of the next instruction can be formed, thereby achieving the purpose of sequential execution of instructions. This method is suitable for computers with random access memory as the main memory. When the program needs to move from one program segment to another, transfer instructions can be used to achieve this. The transfer instruction contains the address of the entry instruction of the program segment to be transferred to. When executing the transfer instruction, this address is sent to the program counter (only used as the instruction address register at this time, not counting) as the address of the next instruction, thereby achieving the purpose of transferring the program segment. Similar methods are used for subroutine calling, interrupt and trap handling, etc. After the popularity of random access memory, the overall operating effect of the second method is greatly better than the first method. Therefore, sequential execution of instructions has become a commonly used method in mainstream computers, and the program counter has become an indispensable part of the central processor. Control parts.
Each functional component within the CPU completes a certain specific function. The implementation of information transmission between components and data flow control components. The path that transmits information between many digital components is usually called a "data path." Where the information starts, which register or multiplexer it passes through, and which register it is finally transmitted to, must be controlled. The task of establishing a data path between registers is completed by a component called the "operation controller".
The function of the operation controller is to generate various operation control signals based on the instruction opcode and timing signals in order to correctly establish the data path, thereby completing the control of fetching and executing instructions.
There are two controllers with different structures due to different design methods. Micro-operations refer to operations that cannot be decomposed. Corresponding control signals (called micro-operation control signals or micro-operation commands) are always required to perform micro-operations. A digital computer can basically be divided into two parts---the control component and the execution component. The controller is the control component, and the arithmetic unit, memory, and peripheral devices are the execution components relative to the controller. One connection between the control component and the execution component is through the control line. The control component issues various control commands to the execution component through the control line. Usually, this control command is called a micro-command, and the operation performed by the execution component after receiving the micro-command is called a micro-operation. Another connection between control components and execution components is feedback information. The execution component reflects the operation status to the control component through the feedback line, so that the control component issues new micro-commands based on the status of the execution component. This is also called "status testing". Micro-operations are groups of basic operations in the execution component. Due to the structural relationship of the data path, micro-operations can be divided into two types: compatibility and mutual exclusion. In one CPU cycle of the machine, a combination of micro-commands that implement certain operating functions constitutes a micro-instruction. The general microinstruction format consists of two parts: operation control and sequence control. The operation control part is used to send control signals to manage and direct the work of the entire machine. Its sequence control part is used to determine the address to generate the next microinstruction. In fact, the function of a machine instruction is implemented by a sequence of many microinstructions. This sequence of microinstructions is often called a microprogram. Since microprograms are composed of microinstructions, when the current microinstruction is executed. The address of the subsequent microinstruction must be pointed out so that after the execution of the current microinstruction is completed, the next microinstruction can be fetched and executed.
For more related knowledge, please visit the
FAQThe above is the detailed content of What are the basic functions of a controller in a microcomputer?. For more information, please follow other related articles on the PHP Chinese website!