The function of the controller is to direct and coordinate the work of various computer components. The controller consists of program counter, instruction register, instruction decoder, timing generator and operation controller.
#The operating environment of this article: windows10 system, thinkpad t480 computer.
The function of the controller is to direct and coordinate the work of various computer components.
What is a controller?
The controller refers to a master device that changes the wiring of the main circuit or control circuit in a predetermined sequence and changes the resistance value in the circuit to control the starting, speed regulation, braking and reverse direction of the motor. 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.
Basic functions:
Data buffering: Since the speed of the I/O device is low but the speed of the CPU and memory is high, a buffer must be set up in the controller. During output, this buffer is used to temporarily store data transmitted from the host at high speed, and then the data in the buffer is transmitted to the I/O device at the rate of the I/O device; during input, the buffer is used It temporarily stores the data sent from the I/O device, and then transmits the data in the buffer to the host at high speed after receiving a batch of data.
Error control: The device controller is also responsible for error detection of data transmitted by the I/O device. If an error occurs during transmission, the error detection code is usually set and reported to the CPU, so the CPU invalidates the data transmitted this time and retransmits it. This ensures the correctness of data entry.
Data exchange: This refers to the data exchange between the CPU and the controller, and between the controller and the device. For the former, the CPU writes data to the controller in parallel through the data bus, or reads data from the controller in parallel; for the latter, the device inputs data to the controller, or transmits data from the controller to the device. . For this purpose, data registers must be set in the controller.
Status description: The controller that identifies and reports the status of a device should note the status of the device for the CPU to understand. For example, the CPU can start the controller to read data from the device only when the device is in a ready-to-send state. To this end, a status register should be set up in the controller, and each bit in it should be used to reflect a certain status of the device. When the CPU reads the contents of this register, it can understand the status of the device.
Receive and recognize commands: The CPU can send a variety of different commands to the controller, and the device controller should be able to receive and recognize these commands. To this end, there should be corresponding control registers in the controller to store received commands and parameters, and to decode the received commands. For example, the disk controller can receive 15 different commands such as Read, Write, and Format from the CPU, and some commands also have parameters; accordingly, there are multiple registers and command decoders in the disk controller.
Address identification: Just like every unit in the memory has an address, every device in the system also has an address, and the device controller must be able to identify each device it controls. the address of. In addition, in order for the CPU to write (or read) data to (or from) registers, these registers should have unique addresses.
Free learning video sharing: Programming video
The above is the detailed content of What is the function of the controller. For more information, please follow other related articles on the PHP Chinese website!