The main function of the operator is to complete arithmetic and logical operations. The arithmetic unit is a functional component in the computer that processes data. Data processing mainly includes arithmetic operations on data and logical operations on logical data; therefore, the core function of the arithmetic unit is to implement arithmetic and logical operations on data. The basic function of the arithmetic unit is to complete the processing of various data, such as the four arithmetic operations, logical operations such as AND, OR, and negation, arithmetic and logical shift operations, comparing values, changing symbols, calculating main memory addresses, etc.
The operating environment of this tutorial: Windows 7 system, Dell G3 computer.
The main function of the operator is to complete: arithmetic operations and logical operations.
Arithmetic unit: arithmetic unit, a component in a computer that performs various arithmetic and logical operations.
The arithmetic unit consists of an arithmetic logic unit (ALU), an accumulator, a status register, a general-purpose register group, etc. The basic functions of the Arithmetic Logic Operation Unit (ALU) are the four arithmetic operations of addition, subtraction, multiplication, and division, logical operations such as AND, OR, NOT, and XOR, as well as operations such as shift and complement. When the computer is running, the operations and types of operations of the arithmetic units are determined by the controller. The data processed by the operator comes from the memory; the processed result data is usually sent back to the memory or temporarily stored in the operator. Together with the Control Unit, it forms the core part of the CPU.
The calculator is a functional component in the computer that processes data. Data processing mainly includes arithmetic operations on data and logical operations on logical data. Therefore, implementing arithmetic and logical operations on data is the core function of the arithmetic unit.
The basic function of the arithmetic unit is to complete the processing of various data, such as the four arithmetic operations, logical operations such as AND, OR, and negation, arithmetic and logical shift operations, comparison of values, change symbols, calculate main memory addresses, etc.
The registers in the operator are used to temporarily save the data participating in the operation and the intermediate results of the operation. Corresponding components should also be set up in the operator to record the characteristics of an operation result, such as whether it overflows, the sign bit of the result, whether the result is zero, etc.
Types of operators
There are many types of operators used in computers. From different perspectives, there are different classification methods.
The decimal point representation can be divided into fixed-point arithmetic and floating-point arithmetic.
The fixed-point arithmetic unit can only perform fixed-point number operations. Its characteristic is that the range represented by machine numbers is smaller, but the structure is simpler.
The floating-point arithmetic unit has a strong function and can operate on both floating-point numbers and fixed-point numbers. Its number representation range is large, but its structure is quite complex.
#In terms of the carry system, it is divided into binary operators and decimal operators.
Generally, computers use binary arithmetic units. As computers are widely used in business and data processing, more and more machines are expanding the function of decimal arithmetic, so that the arithmetic units can complete both Binary operations can also be completed with decimal operations.
The arithmetic unit in the computer needs to have the function of completing a variety of computing operations, so various algorithms must be integrated to design a complete computing component.
Operation methods of the arithmetic unit
To implement the operation of the arithmetic unit, especially the four arithmetic operations, a reasonable operation method must be selected. It directly affects the performance of the arithmetic unit, and is also related to the structure and cost of the arithmetic unit. In addition, when performing numerical calculations, the significant digits of the result may be longer, and a certain number of significant digits must be intercepted, resulting in the rounding problem of the least significant digit. The rounding rule chosen also affects the accuracy of the calculation results. When choosing a computer representation method for numbers, the following factors should be fully considered: The type of number to be represented (decimal, integer, real number, and complex number): Determine the representation method, the range of values that may be encountered: Determine storage and processing capabilities . Numerical accuracy: related to processing power; hardware cost required for data storage and processing: cost.
Two commonly used formats: fixed-point format: the fixed-point format allows a limited range of values, but requires relatively simple processing hardware; floating-point format: allows a large range of values, but requires relatively complex processing hardware.
1. Fixed-point number representation: Fixed-point means that the position of the decimal point is fixed. For convenience of processing, it is generally divided into fixed-point pure integers and pure decimals.
2. Floating-point number representation: Since the range of values required to be represented is very different, which brings a lot of inconvenience to storage and calculation, floating-point arithmetic appears.
Floating point representation, that is, the position of the decimal point is floating. The idea comes from scientific notation. Standardization of IEEE754 floating-point numbers (more special) floating-point numbers: mainly solves the problem of non-uniqueness of the same floating-point number representation. Specifies , otherwise the mantissa must be shifted left or right.
The concept of machine zero: the mantissa is 0 or the exponent value is less than the smallest number that can be represented.
3. Representation method of decimal number string: Since people are familiar with the decimal system, it is necessary to add support for decimal operations in the computer. Two methods: convert decimal numbers into binary numbers for operation, and then convert binary numbers into decimal numbers when outputting. Direct decimal arithmetic. Representation method of direct operation: string form: used in non-numeric calculation fields, compressed decimal string: divided into two types: fixed length and variable length. Requires corresponding decimal operator and instruction support.
4. Customized data representation: identifier data representation, descriptor data representation. Difference: The identifier is connected to each data, and the two are stored together in a storage unit, while the descriptor must be stored separately from the data; in descriptor representation, the descriptor is accessed first, and then the data is accessed, at least one additional memory access is added; description Symbols are part of the program, not part of the data. Original code: a more natural representation, the highest bit represents the symbol, 0 is positive, 1 is negative. Advantages: Simple and easy to understand. Disadvantages: Addition and subtraction operations are complex. Complement code: Addition and subtraction operations are convenient, and subtraction can be converted into addition. Fixed point decimal's complement. The complement and complement of fixed-point integers: introduced for the convenience of calculating the complement. Find the complement code from the complement code: the sign position is 1, invert each bit, and add 1 to the last bit. Frame code: used to represent order codes. Two frame codes are easy to compare in size and are convenient for order matching.
ASCII code input code: used for Chinese character input; Chinese character storage; font code: used for Chinese character display. There are two methods of remainder processing: Restoring the remainder method: The operation steps are uncertain, the control is complex, and it is not suitable for computer operations. Alternating addition and subtraction method: no remainder is recovered, the operation steps are determined, and it is suitable for computer operation. Logical number concept: unsigned binary numbers. Four logical operations: logical negation, logical addition, logical multiplication, and logical exclusive. Multifunctional arithmetic/logical operation unit (ALU) Parallel carry, traveling wave carry adder/subtractor has two problems: long operation time, traveling wave carry adder/subtractor can only complete addition and subtraction, but cannot complete logical operations, The control terminal M is used to control arithmetic operations or logical operations. The difference between the two operations is whether to process carry. When M=0, there is no effect on the carry, and it is an arithmetic operation; when M=1, the carry is blocked, and it is a logical operation. In positive logic, "1" is represented by a high level and "0" is represented by a low level, while negative logic is just the opposite. The relationship between logic and negative logic is that "and" in positive logic becomes "or" in negative logic, that is, interchangeable.
Internal bus, bus classification: internal bus, external bus (system bus), communication bus. The bus can be divided into one-way bus and two-way bus. The bus with latches can realize bus multiplexing. The arithmetic unit includes ALU, array multiplication and division devices, registers, multiplexers, three-state buffers, data buses and other logic components. The design of the arithmetic unit mainly revolves around how to transmit operands and operation results between the ALU and registers and the data bus. There are three structural forms of the arithmetic unit: Single bus structure arithmetic unit: The main disadvantage of this structure is that the operation progress is slow, but the control circuit is relatively simple. Arithmetic unit with dual bus structure. Three-bus structure arithmetic unit: The three-bus structure arithmetic unit is characterized by fast operation time.
Performance indicators
1. Machine word length
The machine word length refers to the basic number of digits of data involved in the operation. It determines the number of registers, operators and data buses, thus directly affecting the price of the hardware. The word length indicates the calculation precision. In order to coordinate accuracy and cost, and to meet various requirements, many computers allow variable word length calculations, such as half word length, full word length, double word length, etc. Since both numbers and instruction codes are placed in the main memory, there is often a corresponding relationship between the word length and the instruction code length. The word length also affects the strength of the instruction system function. Computer word sizes vary from 4, 8, 16, 32 to 64 bits. The machine word length can consist of one or more bytes. Machines used for scientific computing require a longer word length to ensure accuracy; for machines used for data processing and industrial control, a word length of 16 bits or 32 bits can meet the requirements.
2., Operation speed
It is one of the main indicators of the computer. The time required for computers to perform different calculations and operations may be different, so there are different calculation methods for calculation speed. The average speed is generally expressed as the average number of instructions that can be executed per unit time. For example, a computer's operating speed is 1 million times/second, which means that the computer can execute an average of 1 million instructions in one second (i.e. 1MIPS). Sometimes the weighted average method is also used (that is, calculated based on the execution time of each instruction and the percentage of the instruction to all operations) to obtain the equivalent speed representation
For more related knowledge, please visit
Common QuestionThe above is the detailed content of What is the main function of the operator?. For more information, please follow other related articles on the PHP Chinese website!