0% found this document useful (0 votes)
13 views

CALD-assignment 1

The document discusses the components and workings of an arithmetic logic unit (ALU). An ALU performs arithmetic and logical operations on input data and includes adders, subtractors, multiplexers, and logic gates. It describes the role of each component and provides truth tables for common operations like addition, subtraction, and comparison.

Uploaded by

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

CALD-assignment 1

The document discusses the components and workings of an arithmetic logic unit (ALU). An ALU performs arithmetic and logical operations on input data and includes adders, subtractors, multiplexers, and logic gates. It describes the role of each component and provides truth tables for common operations like addition, subtraction, and comparison.

Uploaded by

Ali mirza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Computer architecture and logic design

Assignment NO#1.

Department of Software Engineering


Session: 22-26
Section: B
Subject: CALD
Date: 17feb-24
Submitted by:
Name: Nabeel Hussain
Roll No: F22-BSE-048
Submitted to:
Dr.Nouman ALI

Mirpur university of science and technology (MUST),Mirpur Azad


Kashmir.
Arithmetic Logic Unit (ALU)

Main Concepts:
An Arithmetic Logic Unit (ALU) is a crucial element inside a CPU accountable for performing
mathematics and logical operations on enter information. It normally includes diverse sub-
components inclusive of adders, subtractors, comparators, multiplexers, and good judgment
gates.

Working Concept:
Input Registers:
• Input registers store the operands (binary numbers) that are to be operated
upon.
• They hold the input data temporarily before it's processed by the ALU.
• Registers are sequential storage elements capable of storing binary data.
Control Unit:
• The control unit decodes instructions fetched from memory and generates
control signals based on the opcode.
• These control signals determine which operation the ALU should perform
(addition, subtraction, logical operations, etc.).
• Control signals are sent to various components within the ALU to coordinate
their actions.
Multiplexers (MUX):
• Multiplexers select one of several input data sources and route it to the output
based on control signals.
• In the context of an ALU, multiplexers choose between different data inputs
(operands) based on the operation selected by the control unit.
• They play a crucial role in directing the flow of data within the ALU.
Adders/Subtractors:
• Adders perform addition of binary numbers, while subtractors perform
subtraction.
• They consist of logic gates (such as XOR, AND, OR) arranged in a way to
compute the sum or difference of two binary numbers.
• For addition, the sum of corresponding bits of the two numbers is calculated
along with any carry from the previous bit.
• For subtraction, two's complement arithmetic is often used, where the
subtraction operation is converted to an addition operation by taking the two's
complement of the subtrahend and adding it to the minuend.
Comparators:
• Comparators compare two binary numbers and produce output signals
indicating the relationship between them (e.g., greater than, less than, equal).
• They typically consist of combinational logic circuits that compare
corresponding bits of the two numbers.
• Output signals from comparators are used for conditional operations, such as
branching in a program based on the result of a comparison.
Logic Gates:
• Logic gates perform basic logical operations such as AND, OR, NOT, XOR.
• They are used for bitwise logical operations in the ALU, such as bitwise AND,
bitwise OR, and bitwise XOR.
• These operations are essential for performing logical calculations and
manipulating binary data.
Output Registers:
• Output registers store the result of the ALU operation temporarily before it's
written back to memory or registers.
• They hold the output data until it's needed for further processing or until it's
transferred to another component within the CPU.
Adder:
• Inputs: A (Operand 1), B (Operand 2), Cin (Carry-in)
• Outputs: Sum (Result), Cout (Carry-out)
Truth Table:
A B Cin Sum Cout
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
Subtractor:
• Inputs: A (Minuend), B (Subtrahend), Bin (Borrow-in)
• Outputs: Difference (Result), Bout (Borrow-out)
Truth Table:
A B Bin Difference Bout
0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
0 1 1 0 0
1 0 0 1 0
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1
Multiplexer:
• Inputs: Data inputs, Control signals
• Output: Selected data input
Truth Table: (Example for 2:1 MUX)
Control Input A Input B Output
0 ... ... ...
1 ... ... ...
Comparator:
• Inputs: A, B
• Outputs: A>B, A<B, A=B
Truth Table:
A B A>B A<B A=B
0 0 0 0 1
0 1 0 1 0
1 0 1 0 0
1 1 0 0 1
D-Flip Flop:
• Inputs: D (Data input), CLK (Clock)
• Outputs: Q(t) (Output at time t), Q(t+1) (Output at time t+1)
Truth Table:
D CLK Q(t) Q(t+1)
0 0 0 0
0 1 0 0
1 0 0 0
1 1 0 1

Diagram
TRUTH TABLE OF ALU:

Operand A Operand B Control Signal Operation Result


0000 0000 00 Addition .
0000 0000 01 Subtraction .
0000 0000 10 Bitwise AND .
0000 0000 11 Bitwise OR .
... ... ... ... .
This table represents the ALU's operation with inputs Operand A and Operand B based on the
control signal. The "Operation" column indicates the selected operation, and the "Result"
column represents the outcome of the operation.
Each row corresponds to a specific combination of Operand A, Operand B, and Control Signal,
showing the resulting operation and its outcome. The ellipses (...) indicate the possible
outcomes, which would be filled in with the actual results obtained from the truth tables of the
individual components.

Application:
• ALUs find applications in various fields, including:
• Mathematical calculations in scientific computations and financial modeling.
• Data processing in digital signal processing (DSP) and image processing.
• Control flow in microcontrollers, embedded systems, and CPUs.
• Cryptography for encryption and decryption algorithms.
• Graphics processing in gaming consoles, GPUs, and rendering engines.

You might also like