0% found this document useful (0 votes)
23 views50 pages

ALU Design and Operations Overview

The document discusses the design and functionality of an Arithmetic Logic Unit (ALU) within a processor, detailing its ability to perform arithmetic and logical operations. It covers various components such as adders, multiplexers, and the implementation of logic circuits, along with examples of designing adder/subtractor circuits. Additionally, it addresses the status register and its role in comparing numbers and detecting overflow conditions.

Uploaded by

শতক দে
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)
23 views50 pages

ALU Design and Operations Overview

The document discusses the design and functionality of an Arithmetic Logic Unit (ALU) within a processor, detailing its ability to perform arithmetic and logical operations. It covers various components such as adders, multiplexers, and the implementation of logic circuits, along with examples of designing adder/subtractor circuits. Additionally, it addresses the status register and its role in comparing numbers and detecting overflow conditions.

Uploaded by

শতক দে
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

CSE 209

Computer Architecture

Design of an ALU
Saem Hasan
Lecturer
CSE, BUET
ALU and the Processor
 ALU stands for Arithmetic Logic Unit
 A part of the processor or CPU
Some Terminologies Revisiting
 Decoder, Encoder

2X4 4X2
Decoder Encoder

E E
Some Terminologies Revisiting
 DeMUX, MUX

1X4 4X1
DeMUX MUX
A Simplified
Processor in
Operation

0000 0001 0010 0011


Simplified Processor
with Scratchpad
Memory
Simplified Processor
with Scratchpad
Memory
Simplified Processor
with Accumulator
An ALU Unit
 Can perform both Arithmetic and Logic Operations

Arithmetic/Logical Operation

Which Operation/Function
Helps Function-select to add
more variants
Parallel Adder
 Parallel adder
 A number of full-adder circuits connected in cascade
1-bit Half Adder



1-bit Full Adder



Parallel Adders
 number of 1-bit full-adders are connected in cascade to form a -bit parallel adder
Arithmetic Operations by ALU
Arithmetic Operations by ALU
What are we doing?
 Keeping A fixed and changing B to generate different operations
 Changes in B
 Keeping B as it is
 Inverting all bits of B
 Changing each bit of B to 0
 Changing each bit of B to 1
 Let’s assume represents modified representation of and thus represents
 So, following 4 combinations can be obtained
 Keeping B as it is ( )
 Inverting all bits of B ( )
 Changing each bit of B to 0 ( )
 Changing each bit of B to 1 ( )
What are we doing?
 So Following 4 combinations can be obtained
 Keeping B as it is ( )
 Inverting all bits of B ( )
 Changing each bit of B to 0 ( )
 Changing each bit of B to 1 ( )

 +
Function Table
Here it is clearly visible that, Y has no dependency on Cin
Modified
Function Table: Designer’s perspective
Modified
Function Table
Modified

GIVEN

GIVEN
Logic Diagram of an
independent
Arithmetic Circuit
Selection
Variables

Combinati 𝑛 − 𝑏𝑖𝑡
onal Parallel
Circuit adder
Design Example
 Design an adder/subtractor circuit with one selection variable s and two
inputs A and B. When s=0, the circuit performs A+B. When s=1, the circuit
performs A-B by taking the 2’s complement of B.
 Functions Selection
Variables

Combinati 𝑛 − 𝑏𝑖𝑡
onal Parallel
Circuit adder
s 𝒀𝒊 s 𝑪𝒊𝒏
0 𝐵 0 0
1 𝐵 1 1
Design Example
Designing a Logic Circuit
 We shall implement three basic logical operations (AND, OR and NOT)
and an XOR operation
Designing a Logic Circuit
 Let’s combine it with arithmetic operations
More Efficient Design
 Use already available arithmetic circuit and incorporate logical operations
 Procedure
 Design the arithmetic section independently
 Take the circuit, consider and determine which logic operations are
automatically generated from the arithmetic circuit
 Modify the circuit to incorporate required but not automatically generated logic
operations
More Efficient Design
 Use already available arithmetic circuit and incorporate logical operations
More Efficient Design
 Use already available arithmetic circuit and incorporate logical operations
Incorporating remaining functions
 Unresolved cases

𝑠 𝑠 𝑠 𝑋 𝑌 Automatically Obtained Required 𝐹


𝐹
1 0 0 𝐴 0 𝐹 =𝐴 𝐹 =𝐴 +𝐵

1 1 0 𝐴 𝐵 𝐹 =𝐴 ⨀𝐵 𝐹 =𝐴𝐵
Incorporating remaining functions

(A + K)
Final Boolean Functions
 Combining the arithmetic and logical cases, we get the final form of the
Boolean function as:

No Matter what Cin is, always zero must be passed, otherwise the final value will be wrong. (due to the
hardware of full adder)
Let’s See Another Example
 Derive the input equations (Xi, Yi and Zi) for the parallel adders to be used
in the ALU which satisfies the following functional design specification.

s2 s1 cin Required Functions


0 0 0 F = AB + C
0 0 1 F = AB + C + 1
0 1 0 F = AB
0 1 1 F = AB + 1
1 0 x F = (AB)’
1 1 x F = AB
Solution
s2 s1 cin X Y Z Required
Functions
0 0 0 AB C 0 F= AB + C
0 0 1 AB C 1 F = AB + C +1
0 1 0 AB 0 0 F = AB
0 1 1 AB 0 1 F = AB + 1
1 0 x AB 1 x F = (AB)’
1 1 x AB 0 x F = AB
Solution
 X = AB
 Y = s1’ C
 Z = s2’ cin

 Then for logical operations,


 X = AB
 Y = s1’ C + s2 s1’
 Z = s2’ cin
Status Register
 Four bits represents four status bits
 C: Contains the output carry of the operation
 S: Contains the sign of the result of the operation
 Z: Indicates whether the -bit of the result is 0 or not
 V: Indicates any overflow has occurred due to the operation

 Status bits help to determine relationships among inputs


 Example:
 Compare the value of A with the value of B
 Determine the value of bit of an input
Status Register
Comparing two unsigned numbers
 Compare the value of A with the value of B
 Check the status bits (mainly C and Z) after the performing the following operation
= A + B’ + 1
Comparing two signed numbers
 Compare the value of A with the value of B
 Check the status bits (mainly Z, V and S) after the performing the following operation
Effect of Output Carry
Subtraction er through te transfer korle output carry 1 howyar chances thake/

Overflow Flag
References
 Digital Logic and Computer Design by M. Morris Mano
 Chapter 9 (9.1-9.7)
Thank You 

Common questions

Powered by AI

The status register helps compare two unsigned numbers by checking specific status bits after performing an operation. Specifically, the output carry (C) and zero (Z) bits are crucial. When A is added to the 2's complement of B (A + B' + 1), the C bit indicates whether a borrow is needed. If C is 1, A is greater than B, and if Z is 1, A equals B. This mechanism allows implicit comparisons to occur through addition operations .

Altering the bits of input B in various combinations can change the resultant arithmetic operation within an ALU. For instance, keeping B unchanged allows normal addition, inverting B results in a bitwise NOT operation, setting all bits of B to zero effectively allows operations that ignore B, and setting all bits to one can trigger operations considering B as -1 in 2's complement. These variations enable a wide range of operations by manipulating B's representation .

The automatically generated functions in an ALU, like sums or basic logical operations resulting from the existing arithmetic design, guide the need for modifications. By analyzing these native capabilities, designers can identify additional logic operations necessary but not inherently supported. Such identification allows for strategic circuit modifications to integrate needed functions without excessive redundancy or complexity, enhancing the efficiency and capability of the ALU .

A parallel adder in an ALU connects a number of full-adder circuits in cascade to perform arithmetic operations on multi-bit binary numbers. This setup allows the simultaneous addition of each bit pair from two numbers, plus an incoming carry bit from previous less significant bits. The efficiency of a parallel adder improves the performance of the ALU by enabling faster computations, as multiple bits are processed simultaneously rather than sequentially .

In an adder/subtractor circuit, selection variables determine whether the circuit performs addition or subtraction. For instance, if the selection variable 's' equals 0, the circuit adds inputs A and B. If 's' equals 1, it performs subtraction by adding A to the 2's complement of B, thus effectively performing A-B. The ability to switch between these operations with a selection variable allows flexibility within a single circuit design .

Efficient ALU design incorporates logical operations into existing arithmetic circuits, minimizing component redundancy. Initially, the arithmetic section of the ALU is designed independently. Logical operations such as AND, OR, NOT, and XOR are then identified in terms of arithmetic functions. The circuit is modified to execute the required logic functions not automatically generated by the arithmetic section, thus improving efficiency by reducing the need for separate circuits for logical operations .

2's complement is used in digital circuits to facilitate subtraction by representing negative numbers effectively. When subtracting, the circuit takes the 2's complement of the number to be subtracted and adds it to the other operand. This method ensures that subtraction can be transformed into an addition operation, simplifying circuit design and allowing for consistent handling of both addition and subtraction using the same arithmetic circuitry .

Selection variables like s1 and s2 determine the function output of an ALU by selecting among multiple possible operations. Different combinations of these variables can configure the ALU to execute various arithmetic or logic operations. For example, by manipulating s1 and s2, the ALU can switch between functions such as F = AB + C or F = AB, dictated by a combination table that aligns these variable states with corresponding functional outputs .

Functions such as F = AB + C in ALU design are achieved by configuring parallel adders with specific inputs. The configuration involves assigning values such as X = AB, Y = s1' C, and Z = s2' cin, where F’s outcome depends on these settings. The clever configuration of inputs like s1 and s2 enables the targeted operation by aligning inputs with desired outputs, demonstrating optimized use of circuit configurations for specific computing tasks .

A processor's status register typically contains four major bits: C (carry), S (sign), Z (zero), and V (overflow). Each bit provides specific information about the results of arithmetic operations. The C bit indicates an overflow out of the most significant bit, S denotes the sign of the result, Z indicates whether the result is zero, and V represents overflow from signed operations. These status bits help determine relationships between inputs and monitor the success or failure of operations .

You might also like