Digital

ALU (Arithmetic Logic Unit) by Using VHDL

ALU

Title: To Study the ALU (Arithmetic Logic Unit) by Using VHDL

Aim:  To design and verify the truth table of an ALU Arithmetic Logic Unit

 

Objectives:

 

  1. To study the VHDL programming language.
  2. To study the ALU.
  3. To draw the flow chart and algorithm.
  4. To write a code for ALU.

Software & Hardware Requirement:

  1. Minimum Pentium 4, 512 MB RAM & 40 HDD.
  2. Xilinx software version 9.1v.

 

Theory of VHDL:

VHDL is a Hardware Description Language. It describes the behaviour of an electronic circuit or system. VHDL stands for VHSIC Hardware Description Language. VHSIC is itself an abbreviation for Very High Speed Integrated Circuits, a founded by the United States Department of Defence in the 1980s the led to the creation of VHDL.VHDL is the first hardware description language to be standardized by the Institute of Electrical and Electronics Engineers, through the IEEE 1076 standard.

Fundamental Units of VHDL:

The figure below shows the standalone piece of VHDL code is composed of at least three fundamental sections.

Library Declarations: To declare a LIBRARY two lines of code are needed, one containing the name

Of the library and the other use a package.

Library Syntax:

LIBRARY library_name;

USE library_name. package_name. package_parts;

eg:  LIBRARY ieee;

USE  ieee. STD_LOGIC_1164.ALL;

Entity Declarations: An ENTITY is a list with specification of all input and output pins (PORTS) of

the circuit.

Entity Syntax:

 

ENTITY entity_name is

PORT (port_name: signal_mode signal_type;

port_name: signal_mode signal_type;

port_name: signal_mode signal_type;

 

port_name: signal_mode signal_type);

 

END entity_name;

 

Architecture: The architecture is a description of how the circuit should behave (function).

 

Architecture Syntax:

 

ARCHITECTURE architecture_name OF entity_name IS

[Declaration]

BEGIN

(Code)

 

END architecture_name;

Eg:

ARCHITECTURE My_Gate OF And_Gate IS

 

BEGIN

Y<= a AND b;

 

END My_Gate;

 

Theory of ALU:  An ALU is stands for Arithmetic Logic Unit are shown in figure below. It is a circuit capable of executing both kinds of operations, arithmetic as well as logical. Its operation is described in the truth table. The output (Arithmetic or logical) is selected by the MSB of select line named as (sel), while the specific operation is selected by sel’s other three bits. The two signals, arith and logic, are used to hold the results from the arithmetic and logic unit respectively. In computing, an arithmetic logic unit (ALU) is a digital circuit that performs arithmetic and logical operations. The ALU is a fundamental building block of the central processing unit of a computer, and even the simplest microprocessors contain one for purposes such as maintaining timers.

 

Truth Table for ALU:

sel Operation Function Unit
 

0000

0001

0010

0011

0100

0101

0110

0111

 

y <= a

y <= a+1

y <= a – 1

y <= b

y <= b+1

y <= b – 1

y <= a+b

y <= a+b+Cin

 

 

Transfer a

Increment a

Decrement a

Transfer b

Increment b

Decrement b

Add a and b

Add a and b with carry

 

 

 

 

Arithmetic

 

1000

1001

1010

1011

1100

1101

1110

1111

 

y <= NOT a

y <= NOT b

y <= a AND b

y <= a OR b

y <= a NAND b

y <= a NOR b

y <= a XOR b

y <= a XOR b

 

Complement a

Complement b

AND

OR

NAND

NOR

XOR

XNOR

 

 

 

 

Logic

 

Leave a Reply

Your email address will not be published. Required fields are marked *