0% found this document useful (0 votes)
6 views2 pages

CPU Functions and ALU Operations Explained

Uploaded by

Trinh Hung
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

CPU Functions and ALU Operations Explained

Uploaded by

Trinh Hung
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1) The main functions of CPU:

· Fetching: The CPU retrieves instructions from the computer's memory (RAM).
This is the first step in executing any task or program.

· · Decoding: Once an instruction is fetched, the CPU decodes it to understand what


action is required. This involves interpreting the instruction's binary code to determine
which operation to perform.

· · Executing: After decoding the instruction, the CPU executes it. This could
involve performing arithmetic or logical operations, moving data from one location to
another, or interacting with other hardware components.

· · Storing: After executing an instruction, the CPU may need to store the results
back into memory or a register for future use. This ensures that data is saved and can
be accessed or used in subsequent operations.

· · Controlling: The CPU manages the flow of data between the computer's other
components, such as the memory, input/output devices, and storage. It ensures that
these components work together efficiently and in the correct sequence.

2)

Relationship to the CPU

 Integration: The ALU is integrated into the CPU, making it an essential part
of the CPU's architecture. The CPU relies on the ALU to execute operations
that are fundamental to running programs and performing tasks.
 Operation: When the CPU processes instructions, the ALU handles the
execution of arithmetic and logical operations as directed by the Control Unit
(CU). The CU sends instructions to the ALU and coordinates the overall
execution process.

· Arithmetic Operations:

 · Addition: Performing basic addition of binary numbers.


 Subtraction: Subtracting one binary number from another.
 Multiplication: Multiplying binary numbers (though multiplication may also
be handled by more complex circuitry in modern CPUs).
 Division: Dividing binary numbers (similar to multiplication, division may
involve more sophisticated methods).

Main function:

· Logical Operations:

 · AND: Performing the logical AND operation, which results in a 1 only if


both input bits are 1.
 OR: Performing the logical OR operation, which results in a 1 if at least one
of the input bits is 1.
 NOT: Performing the logical NOT operation, which inverts the bits (changing
0s to 1s and vice versa).
 XOR: Performing the logical XOR (exclusive OR) operation, which results in
a 1 only if the input bits are different.

· Bit Shifting:

 · Shift Left: Moving bits to the left, which effectively multiplies the number
by 2 for each shift.
 Shift Right: Moving bits to the right, which effectively divides the number by
2 for each shift.

· Comparisons:

 · Equality: Checking if two values are equal.


 Greater than/Less than: Comparing values to determine their relative
magnitude.

You might also like