Computer Fundamentals 简明教程

Computer - Arithmetic Logic Unit (ALU)

What is ALU?

ALU 是算术逻辑单元的简称。ALU 是执行算术和逻辑运算的部件。它每秒可以执行数十亿次运算。ALU 电路集成了四个关键部件,即输入、操作数、输出和存储。

ALU stands for Arithmetic Logic Unit. An ALU is a key component of the CPU which performs arithmetic and logical operations. It can perform billions of operations per second. An ALU circuit has the integration of four key components inputs, operands, outputs, and storage.

alu

为了存储二进制数字,计算机使用开或关的晶体管开关。数据还存储在指定用于存储输出的寄存器中。ALU 往往快速且准确。这些电路由行逻辑运算,例如按位运算,即对二进制数字串进行运算。CPU 处理器直接支持按位逻辑运算,这些运算速度快、简单,从基本到高级不等。ALU 执行按位移位,即根据按位运算符的特定指令移动位。

To store binary digits, computers use transistor switches that are either open or closed. Data is also stored in a register designated to store output. ALUs tend to be fast and accurate. These conduct logical operations such as bitwise operations, which are operations on a string of binary numbers. The CPU processor directly supports bitwise logical operations, which are fast, simple, and range from basic to higher-level. ALUs conduct bit shifting, which is the movement of bits in response to particular instructions from bit operators.

block diagram of alu

ALU 还可能进行多精度算术运算,这是当所需的精度级别超出了硬件容量时所需的软件运算。ALU 可以进行复杂的算术和逻辑运算,因为它们使现代计算机能够将困难的计算分解为大量的二进制过程。

ALUs may also do multiple-precision arithmetic, which is a software operation required when the desired level of accuracy exceeds the hardware’s capacity. ALUs can do complex arithmetic and logical operations because they enable modern computers to split difficult calculations into a large number of binary processes.

What does the ALU do?

ALU 执行算术和逻辑运算。在 CPU 中还存在控制单元或 CU。CU 指示 ALU 执行特定运算,ALU 负责执行这些运算。

ALUs carry out arithmetic and logical operations. Also found in the CPU are Control Units, or CUs. The CU directs the ALU in performing specific operations, with the ALU being responsible for carrying out these operations.

NOT 门由一个晶体管和一个输入逻辑门组成。它的功能是产生与输入相反的输出。例如,输入 1 将产生输出 0。

The NOT Gate consists of a single transistor and one input logic gate. Its function is to produce outputs that are the inverse of the input. For instance, an input of 1 would result in an output of 0.

OR 门中使用多个晶体管和两个输入。仅当第一个或第二个输入为 1 时,输出才为 1。相反,当两个输入都为 0 时,OR 门产生输出 0。

Multiple transistors and two inputs are used in the OR Gate. The output is only 1 if the first or second input is 1. Conversely, the OR gate produces an output of 0 when both inputs are 0.

AND 门使用多个晶体管和两个输入。仅当第一个和第二个输入都为 1 时,输出才为 1。

The AND Gate utilizes multiple transistors and two inputs. The output is 1 only if both the first and second inputs are 1.

Functions of ALU

ALU 是 CPU 的一个重要组成部分。它主要对输入数据执行算术和逻辑运算。ALU 具有不同的电气输入和输出连接,便于在 ALU 和外部电子设备之间传输数字信号。数据由外部电路提供给 ALU 输入,ALU 发送已处理的计算结果。ALU 的一些主要功能如下:

The ALU is an essential component of the CPU. It majorly performs arithmetic and logical operations on inputted data. The ALU has different electrical input and output connections that enable the transmission of digital signals between the ALU and external electronic devices. Data is provided to the ALU inputs by external circuits, and the ALU sends processed computational results. Some of the key functionalities of the ALU are as −

  1. Arithmetic Operations − It includes addition, subtraction, multiplication, and division.

  2. Logical Operations − It includes AND, OR, NOT, XOR (exclusive OR), and bit-shifting logical operations.

  3. Comparison Operations − The ALU also performs a comparison of numbers to determine greater than, less than, or equal to.

  4. Bitwise Operations − These include operations that change individual bits inside a data word, such as shifting them left or right and masking specific bits.

  5. Data flow into the ALU − ALU has direct access to the CPU controllers, primary memory, and input/output devices. ALU takes input data from memory using the bus-like electrical route.

  6. Applying functions − The internal components of the ALU are used to perform binary calculations for a variety of functions.

  7. Provides Temporary Storage − The ALU commonly includes memory blocks to store input operands, operands to be added, accumulated results, and shifted results.

ALU 从处理器的寄存器接收输入,并将结果返回到寄存器。它是 CPU 的一个关键组件,允许它执行计算机系统中各种任务和运算所需的计算。

The ALU takes input from the processor’s registers and gets back the results to the registers. It is a critical component of the CPU, allowing it to do the computations required for various tasks and operations in a computer system.