You are on page 1of 30

Unit 7- Arithmetic Logic Unit

Dr.L.Premalatha
Professor/SELECT
VIT,Chennai
ALU
• Bus Organization - ALU - Design of ALU - Status Register - Design of
Shifter - Processor Unit - Design of specific Arithmetic Circuits
Accumulator - Design of Accumulator
Computer architecture
• Computer architecture is the organization of the components making up a computer system
• The basic architecture has the CPU at the core with a main memory and input/output system on either side of
the CPU

• The CPU (Central Processing Unit) is the part of a computer system that is commonly referred to as the "brains"
of a computer. The CPU is also known as the processor or microprocessor.
• The CPU is responsible for executing a sequence of stored instructions called a program. This program will
take inputs from an input device, process the input in some way and output the results to an output device.
• CPU's aren’t only found in desktop or laptop computers, many electronic devices now rely on them for their
operation. Mobile phones, DVD players and washing machines are examples of equipment that have a CPU.
Bus organisation in CA
• Bus is a group of wires that connects different components of the computer. It is used for transmitting data,
control signal and memory address from one component to another. A bus can be 8 bit, 16 bit, 32 bit and 64
bit. A 32 bit bus can transmit 32 bit information at a time. A bus can be internal or external.
• Types of bus:
• Data bus- carries data from one component to another. It is uni-directional for input and output devices and
bi-directional for memory and CPU.
• Control bus- carries control signal. CU of CPU uses control signal for controlling all the components. It is uni-
directional from CPU to all other components.
• Address bus- carries memory address. A memory address is a numerical value used for identifying a
memory location. Computer performs all its task through the memory address.
ALU
• Inside a computer, there is an Arithmetic Logic Unit (ALU).
• ALU is a major component of the central processing unit of the a computer system.
• ALU is capable of performing logical operations (e.g. AND, OR, Ex-OR, Invert etc.) in addition to
the arithmetic operations (e.g. Addition, Subtraction etc.).
• The control unit supplies the data required by the ALU from memory, or from input devices, and
directs the ALU to perform a specific operation based on the instruction fetched from the
memory.
• ALU is the “calculator” portion of the computer.
• The ALU is a digital circuit capable of performing arithmetic and logical operations and is a
fundamental building block of any sort of computational device. Simple microprocessors such as
those found in home appliances often contain only one ALU, while the modern Central Processing
Units (CPUs) and Graphics Processing Units (GPUs) found in today’s desktops and mobile devices
contain many very powerful ALUs.
• The symbol typically used to represent an ALU is shown in Figure.

• A and B represent the n-bit input buses, while Result represents the output bus, which can be n-
bits in size or greater. In this simple drawing the control and status signals are not shown.
• One way to create a simple ALU is to build several computational blocks and multiplex the output
buses
1.Design of Arithmetic Unit
• An arithmetic unit performs several arithmetic micro-operations such as addition, subtraction,
complementation, incrementation, decrementation etc.
• The basic component of the arithmetic section of a simplest ALU is a full adder.
• Figure illustrate the block diagram of an arithmetic unit with full adder.
• All the basic operations given in the table can be performed in an Arithmetic unit. Looking at the
table, we can realize that by selecting proper B and Cin inputs, we can implement all the operations.
• Though there are eight input patterns, this arithmetic circuit performs only seven distinct micro-
operations.
• Cases 5 and 8 perform the same micro-operation: transfer inputA to . Any one of these two
combinations can be chosen in the design.
• Figure is the logic diagram of a 1 bit Arithmetic unit
Circuit for 2 bit Arithmetic unit
Design of Logic Unit
• Using a 4-to-1 MUX to each bit position, a logical unit can be designed by giving appropriate input
to the four inputs of the MUX. Figure shows the design of one bit position which performs four
logic operations: AND, OR, XOR and complement.
• Table shows the input combinations and corresponding output and logical operation performed
on the operands A and B.
ALU function table
Complete ALU diagram
Status register
• Design of ALU involves the design of status register also. This register indicates certain conditions of the result such as
• Result is zero
• Result is negative/positive
• Result with carry
• Result with overflow

• These conditions are indicated by certain bit conditions.


• The bits which indicate conditions of the results are also called as flag bits.
• The different flag bits are
1. C bit : Carry bit – It is set when the output carry of ALU is 1; otherwise it is 0.
2.S bit : Sign bit – It indicates the sign of the result. When S bit is 1, result is negative; otherwise result is positive.
3. Z bit: Zero bit – It is set (1) when the result is zero; otherwise it is 0.
4. V bit : Overflow bit – It is set if the result of a signed operation is too large to fit in the number of bits available
to represent it.
Design of Shifter
• The shift register or shifter is a part of processor unit which accepts output of ALU as a data input and
may or may not shift this data according to the control inputs SH0 and SH1.
• Table shows operations that shifter performs according to SH inputs. It may transfer data directly without
a shift, or it may shift the data to the right or left or it may give output zero.
Design of Processor unit
Control unit requirements

Control word Control word encoding


Accumulator design
• The ALU perform the computing function of microprocessor. It includes the accumulator, temporary register,
arithmetic & logic circuit & and five flags. Result is stored in accumulator & flags.

• Accumulator
• It is an 8-bit register that is part of ALU. This register is used to store 8-bit data & in performing arithmetic &
logic operation. The result of operation is stored in accumulator.
Design of accumulator
• An accumulator is a register for short-term, intermediate storage of arithmetic and logic data in a computer's
CPU (central processing unit).
• It holds data or the results of an operation during the processing cycles. The accumulator can hold one of the
two operands during any ALU operation.
• If we want to add two bytes together, this would just be an example here; one byte would go to the
accumulator, and the other in memory or general purpose register.
• Computers that have a single-processor register usually assign to it the name accumulator (AC) and label it AC.
Registers in a basic computer
• The computer needs processor registers for manipulating data and a register for holding a memory address.
• These requirements dictate the register configuration shown in Figure.

• The data register (DR) holds the operand read from memory.
• The accumulator (AC) register is a general purpose processing register.
• The instruction read from memory is placed in the instruction register (IR).
• The temporary register (TR) is used for holding temporary data during the processing.
• The memory address register (AR) has 12 bits.
• The program counter (PC) also has 12 bits and it holds the address of the next instruction to be read from memory after the
current instruction is executed.
• Two registers are used for input and output. The input register (INPR) receives an 8-bit character from an input device. The
output register (OUTR) holds an 8-bit character for an output device.
Circuits associated with Accumulator

• The circuits associated with the AC register are shown in


Figure.

• The adder and logic circuit (ALU) has three sets of inputs.
One set of 16 inputs comes from the outputs of AC. Another
set of 16 inputs comes from the data register DR. A third set
of eight inputs comes from the input register INPR.
• The outputs ofthe adder and logic circuit provide the data
inputs for the register.
• In addition, it is necessary to include logic gates for
controlling the LD, INR, and CLR in register and for
controlling the operation of the adder and logic circuit.
• (LD- Load the input, INR-Increment the input and CLR- clear
the input)
• In order to design the logic associated with AC, it is
necessary to go over the register transfer statements in
Table and extract all the statements that change the content
of AC.
Sample design problem 1
• Design a logic circuit that performs the four logic operations of exclusive-OR, exclusive-NOR, NOR,
and NAND. Use two selection variables. Show the logic diagram of one typical stage.
Solution for sample problem 1
Sample design problem in arithmetic circuit.
• Design a combinational circuit that adds one to a 4-bit binary number. For example, if the input of the
circuit is 1101, the output is 1110. The circuit can be designed using four half-adders.
• Solution:
Solution for problem2
• Let A3A2A1A0 + 1 = S4S3S2S1S0

You might also like