workexample luz.orlando.ramirez comparchprojectreport main

11
UNIVERSITY OF HOUSTON – CLEAR LAKE Design of a 4 – bit ALU using VHDL Luz Orlando Ramirez and Alfredo Nava CENG 3511, Section 2, Saurin Ganatra 4 bit ALU designed using behavioral VHDL coding techniques. The 4bit ALU using the aforementioned coding techniques successfully performed arithmetic, logical, and shifting operations. The ALU performs a limited number of arithmetic, logical, and shifting operations dependent on the user defined input.

Upload: honda-element

Post on 13-Nov-2014

4 views

Category:

Documents


1 download

DESCRIPTION

good for design in vhdl

TRANSCRIPT

Page 1: Workexample Luz.orlando.ramirez Comparchprojectreport Main

UNIVERSITYOFHOUSTON–CLEARLAKE 

 

 

   

Designofa4– bitALUusingVHDL

LuzOrlandoRamirezandAlfredoNava

CENG3511,Section2,SaurinGanatra 

 

 

 

 

 

   

   4 ‐bit ALU designed using behavioral VHDL coding techniques.  The 4‐bit ALU using the aforementioned coding techniques successfully performed arithmetic, logical, and shifting operations.  The ALU performs a limited number of arithmetic, logical, and shifting operations dependent on the user defined input. 

Page 2: Workexample Luz.orlando.ramirez Comparchprojectreport Main

   CENG 3511    1 

 

ContentsI.  Background ..................................................................................................................................................................... 2 

II.  Project Overview......................................................................................................................................................... 2 

a.  Objective ..................................................................................................................................................................... 2 

b.  Method ........................................................................................................................................................................ 2 

c.  Procedure .................................................................................................................................................................... 2 

III.  Observations ............................................................................................................................................................... 3 

IV.  RTL (Register Transfer Level) schematic and Waveform of ALU ............................................................................ 3 

a.  Top level ..................................................................................................................................................................... 3 

b.  Detailed RTL schematic .............................................................................................................................................. 3 

c.  Waveforms .................................................................................................................................................................. 4 

V.  Conclusion ...................................................................................................................................................................... 4 

VI.  Recommendation ........................................................................................................................................................ 4 

Works Cited ............................................................................................................................................................................. 5 

Appendix ................................................................................................................................................................................. 6 

VHDL Code for ALU ......................................................................................................................................................... 6 

VHDL Code for 4-bit Full Adder ....................................................................................................................................... 9 

VHDL Code for a 1-bit Full Adder ..................................................................................................................................... 9 

Detailed RTL Schematic of designed ALU ...................................................................................................................... 10 

 

Page 3: Workexample Luz.orlando.ramirez Comparchprojectreport Main

   CENG 3511    2 

 

Introduction

The main goal of this experiment is to design a 4-bit ALU using one main VHDL coding technique using XILINX. The 4-bit ALU was implemented using a VHDL coding techniques that model a four bit full adder and numerous MUXes. VHDL coding was primarily done using a student version of XILINX software.

I. Background

ALU’s (Arithmetic Logic Units) are significant in that they primarily perform nearly all arithmetic and logical operations. “The arithmetic logic unit (ALU) is the brawn of the computer, the device that performs the arithmetic operations like addition and subtraction or logical operations like AND and OR” (Patterson, Hennessy C-26). More detailed information about MUXes, Adders, and other devices can be found in the textbook Fundamentals of Logic Design (2010) by Charles H. Roth, JR. and Larry L. Kinney. Also a complete description of ALU’s is provided by the text Computer Organization and Design (2009) by David A. Patterson and John L. Hennessy.

The primary goal and results of the experiment will be discussed in the following sections.

II. Project Overview a. Objective

Build a 4-bit ALU that performs basic arithmetic, logic, increment/decrement and shifting operations using only one VHDL coding technique. The 4-bit ALU will have: 4-bit input, output and operation select lines and 1-bit carry in and carry out lines. In addition, the 4-bit ALU will perform eleven distinct operations.

b. Method

To enter different inputs into the 4-bit ALU to determine if the outputs of the ALU correspond to the predicted function and result. A pre-defined set of Operation Select of 4-bit inputs will aid in the identification in the case that the ALU produces an output that does not agree with the predicted function or outcome.

c. Procedure

Since the ALU is composed of numerous internal components the operation select inputs are a significant role in determining what output the ALU produces. Specifically, there are only two cases in which the carry in line is not treated as a don’t care and does not affect the ALU output, these occur when 4-bit input A needs to be transferred directly onto the 4-bit output G. Although, the design of the 4-bit ALU includes a four-bit full adder the output of the ALU is significantly affected by the numerous MUXes used in the design as defined per the use of “WHEN-ELSE” VHDL statements in main VHDL source file. In respect to the carry out output of the ALU, the ALU was designed so that the carry out retains the previous carry in of a past operation where in the carry in is not in use.

Page 4: Workexample Luz.orlando.ramirez Comparchprojectreport Main

  

 

I

I

III. Obsea. T

siwon

b. Tpr

c. Mth

d. Mar

IV. RTLa. T

b. D

ervations The design imignal to be m

where used tonly a single

The heavy uroduce its ow

MUXes reduhat a signal w

MUXes haverithmetic com

(Register TTop level

Detailed RTL

mplementedmodified ano increase thadder. se of MUXwn internal sce errors in will never gie minimal pmponents.

Transfer Le

L schematic

CENG 351

d effective und reused acche efficiency

Xes helped insignals for othe design o

ive an “Unidpropagation

vel) schema

FIThAL(3pe

FIA senoad

11

use of multipcording to tof the desig

ncrease the operations whof the ALU

dentified” oudelay, and a

atic and Wa

IGURE 1.1 The schematic dLU with its res:0) is what de

erform.

IGURE 1.2 Alarger version

ction of the repotice the prefedders.

plexers for athe operationgn, and imple

stability sighere the Cinis that all c

utput or errorare a much

aveform of A

Top Level RTdepicts a top lspective input etermines wha

ALU with intn of FIGURE port. On furth

ferred use of

all the signan the ALU nement four a

gnificantly bn was not neccases are covr. better impl

ALU

TL Schematilevel representand outputs. N

at operation th

ternal compo1.2 is availabl

her inspection oMUXes over

als. This alloneeds to perarithmetic fu

by allowing cessary. vered for ea

lementation

ic of ALU tation of the Note that Op he ALU will

onents le in the Appeof the ALU one

multiple fou

ows for eachrform. Theseunctions with

the ALU to

ach signal, so

than severa

endix e can

ur bit

h e h

o

o

al

Page 5: Workexample Luz.orlando.ramirez Comparchprojectreport Main

  

 

V

ciMp

V

o

c. W

d.

V. Conc

For somecode containnternal MU

MUXes are performance

VI. Reco

Incluof an ALU a

FIGThesecotrachav

Waveforms

clusion

e ALU operans numerou

UXes. The inused the m

– cost trade

ommendatio

uding a cost-nd vice vers

GURE 1.3 Ae above wavefoond test case dk of since if ae a significant

ations the vaus “WHEN-Enternal use

more probabeoff in the de

on

performancesa.

ALU Waveform representsdoes not have an arithmetic ooutcome on th

CENG 351

alue of carryELSE” stateof MUXes

ble that the esign of the 4

e analysis in

form of ALUs two test casesoverflow. Th

operation occurhe calculated pr

11

y in is not neements the in the 4-bit cost of the

4-bit ALU.

n the project

U s. The first te

he values of cars for thousandroduct.

eeded. AlsoRTL SchemALU impro

e design cou

to illustrate

est case happenarry in and cards of times a m

o, since the 4matic in XIoves performuld increase

e how cost ca

ns to have overry out are immissing value

4-bit ALU VILINX dispmance but the. Thus, th

an limit the

erflow while thmportant to kee

of carry in ca

VHDL sourceplays variouhe more thahere exists a

performance

he ep an

e s

at a

e

Page 6: Workexample Luz.orlando.ramirez Comparchprojectreport Main

   CENG 3511    5 

 

Works Cited 

Roth, Charles H., and Larry L. Kinney. Fundamentals of Logic Design. Stamford, CT: Cengage Learning,  

    2010.   Print. 

  Patterson, David A., and John L. Hennessy. Computer Organization and Design. Boston: Morgan Kaufmann,  

    2009. Print. 

 

Page 7: Workexample Luz.orlando.ramirez Comparchprojectreport Main

  

 

 

CENG 351

Ap

VHDL

11

ppendix

Code for AALU

Page 8: Workexample Luz.orlando.ramirez Comparchprojectreport Main

  

 

CENG 35111 7 

Page 9: Workexample Luz.orlando.ramirez Comparchprojectreport Main

  

 

CENG 35111 8 

Page 10: Workexample Luz.orlando.ramirez Comparchprojectreport Main

  

 

 

V

VH

CENG 351

VHDL Code

HDL Code f

11

for 4-bit Fu

for a 1-bit F

ull Adder

Full Adder

 

Page 11: Workexample Luz.orlando.ramirez Comparchprojectreport Main

  

 

Detail

CENG 351

led RTL Sch

11

hematic of ddesigned ALLU

10