You are on page 1of 14

HANOI UNIVERSITY OF SICENCE AND TECHNOLOGY

SCHOOL OF ELECTRONIC AND TELECOMUNICATION


----------

REPORT
DIGITAL DESIGN USING VHDL
Topic : Huffman Decoder using verilog
Instructor : Prof. Dr. Ngo Vu Duc
Group : 9
Members : Vu Tung Lam - 20176648
Tran Duc Dung - 20176638
Table of Contents
INTRODUCTION.................................................................................................3
CHAPTER1:METHODOLOGY.........................................................................4
1.1.Xilinx ISE.....................................................................................................4
1.2.Huffman coding................................................................................................5
1.2.1.Definition...................................................................................................5
1.2.2.Huffman Tree.............................................................................................5
1.3.Lookup Table...............................................................................................6
CHAPTER2:ALGORITHM.................................................................................7
2.1Block Diagram..............................................................................................7
2.2 Input...............................................................................................................7
2.3 Lookup Table (LUT)..................................................................................9
2.4 FSM ( Finite state machine ).................................................................10
CHAPTER3:SIMULATION RESULT...........................................................12
CONCLUSION....................................................................................................13
REFERENCES.....................................................................................................14
INTRODUCTION
Compression is a necessity in the current world of technology, which is
centered on speed and efficiency. Consequently, large and bulky pieces of
information are abandoned for smaller bits of data, which can be shared between
peers at faster rates. Data can be broken into smaller pieces or forcefully
compressed by programs that are powered by algorithms. The two major types of
compression In algorithms are lossless compression and lossy compression.
Lossless compression is used for applications that require an exact reconstruction
of the original data, while lossy compression is used when the user can tolerate
some differences between the original and reconstructed representations of the
data. Lossy compression techniques involve some loss of information and data are
compressed usinglossy techniques generally cannot be recovered or reconstructed
exactly return for accepting this distortion in the reconstruction, we can generally
obtain much higher compression ratios than is possible with lossless compression.
Various lossless data compression algorithms have been proposed and used.
Huffman Coding, Arithmetic Coding, Shannon Fano Algorithm, Run Length
Encoding Algorithm are some of the techniques in use. Huffman codes are prefix
codes and are optimum for a set of probabilities. The Huffman code is based on
two observations. First, in an optimum code, symbols that occur more frequently
(have a higher probability of occurrence) have shorter codewords than symbols
that occur less frequently. Second, in an optimum code, the two symbols that occur
least frequently have the same length. The Huffman procedure is obtained by
adding a simple requirement to these two observations. This requirement is that the
codewords corresponding to the two lowest probability symbols differ only in the
last bit.
CHAPTER1:METHODOLOGY
1.1.Xilinx ISE
Xilinx ISE (Integrated Synthesis Environment) is a discontinued software tool
from Xilinx for synthesis and analysis of HDL designs, which primarily targets
development of embedded firmware for Xilinx FPGA and CPLD integrated circuit
(IC) product families. Use of the last released edition from October 2013 continues
for in-system programming of legacy hardware designs containing older FPGAs
and CPLDs otherwise orphaned by the replacement design tool, Vivado Design
Suite.
ISE enables the developer to synthesize ("compile") their designs, perform timing
analysis, examine RTL diagrams, simulate a design's reaction to different stimuli,
and configure the target device with the programmer. Other components shipped
with the Xilinx ISE include the Embedded Development Kit (EDK), a Software
Development Kit (SDK) and ChipScope Pro. The Xilinx ISE is primarily used for
circuit synthesis and design, while ISIM or the ModelSim logic simulator is used
for system-level testing.
The primary user interface of the ISE is the Project Navigator, which includes the
design hierarchy (Sources), a source code editor (Workplace), an output console
(Transcript), and a processes tree (Processes).
The Design hierarchy consists of design files (modules), whose dependencies are
interpreted by the ISE and displayed as a tree structure. For single-chip designs
there may be one main module, with other modules included by the main module,
similar to the main() subroutine in C++ programs. Design constraints are specified
in modules, which include pin configuration and mapping.
The Processes hierarchy describes the operations that the ISE will perform on the
currently active module. The hierarchy includes compilation functions, their
dependency functions, and other utilities. The window also denotes issues or errors
that arise with each function.
The Transcript window provides status of currently running operations, and
informs engineers on design issues. Such issues may be filtered to show Warnings,
Errors, or both.
In this project we use Xilinx ISE 14.7 for coding and simulating
1.2.Huffman coding
1.2.1.Definition
Huffman coding is a lossless data encoding algorithm. The process behind its
scheme includes sorting numerical values from a set in order of their frequency.
The least frequent numbers are gradually eliminated via the Huffman tree, which
adds the two lowest frequencies from the sorted list in every new “branch.” The
sum is then positioned above the two eliminated lower frequency values, and
replaces them in the new sorted list. Each time a new branch is created, it moves
the general direction of the tree either to the right (for higher values) or the left (for
lower values). When the sorted list is exhausted and the tree is complete, the final
value is zero if the tree ended on a left number, or it is one if it ended on the right.
This is a method of reducing complex code into simpler sequences
1.2.2.Huffman Tree
Huffman tree or Huffman coding tree defines as a full binary tree in which each
leaf of the tree corresponds to a letter in the given alphabet.
The Huffman tree is treated as the binary tree associated with minimum external
path weight that means, the one associated with the minimum sum of weighted
path lengths for the given set of leaves. So the goal is to construct a tree with the
minimum external path weight.

Fig1.1:example of Huffman Tree


1.3.Lookup Table
In computer science, a lookup table is a data structure, usually
an array or associative array, used to replace a runtime computation with a simpler
lookup operation. The speed gain can be significant, since retrieving a value from
memory is often faster than undergoing an expensive computation.
A classic example is a trigonometry table. Calculating the sine of a value every
time such a sine is needed can be prohibitively slow in some applications. To avoid
this, the application can take a few seconds when it first starts to precalculate
the sine of a number of values, for example for each whole number of degrees.
Later, when the program wants the sine of a value, it uses the lookup table to
retrieve the sine of a nearby value from a memory address instead of calculating it
using a mathematical formula.
There are intermediate solutions that use tables in combination with a small
amount of computation, often using interpolation. This allows better accuracy for
values falling between two precomputed values. This requires slightly more time
but can greatly enhance accuracy in applications that require it. Depending on the
values being precomputed, this technique can also be used to shrink the lookup
table size while retaining about the same accuracy.
In image processing, lookup tables are often called LUTs, and they link index
numbers to output values. One common LUT, called the colormap, is used to
determine the colors and intensity values with which a particular image will be
displayed.
It's important to note that, while often effective, lookup tables can result in a severe
penalty if the computation it replaces is relatively simple, not only because
retrieving the result from memory may require more time, but also because it may
increase memory requirements and pollute the cache. This is increasingly
becoming an issue as microprocessors outrace memory. A similar issue appears
in rematerialization, a compiler optimization.
CHAPTER2:ALGORITHM
2.1Block Diagram
In this project we want to design a Huffman decoder and this is our
block diagram that we supposed.

Fig2.1 : Huffman Decoder block diagram

The fig 2.1 shows the block diagram for the decoder in which the inputdata is first
loaded into the register which is then compared with codes stored in the LUT and
finally the decoded data.
We use the Finite state machine ( FSM ) because It is an abstract machine that can
be in exactly one of a finite number of states at any given time. The FSM can
change from one state to another in response to some inputs
2.2 Input
Fig2.2: Huffman tree

Fig2.3 : Encoded data table


The fig2.3 show the encoded data of 32 symbols from the Huffman
tree which is our input data.The maximum length of the encoded data
is 10 bit
When the input data come in it will be loaded into the lower register
and after that if there is a new data come in it will be loaded into the
lower register when the old data will be load into the upper register
Both of the register is 10-bit register because the maximum length of
the encoded data is 10 bit
2.3 Lookup Table (LUT)

Fig2.3 : Lookup table


From the table we can see that there are 32 symbols with 32 Decoded Data
represented as decinal number .
When the encoded data come in it will be converted into symbol then it will look
into the LUT to see the decoded data of that symbol , the final output is the
decoded data
Fig2.4 : Schematic of LUT
2.4 FSM ( Finite state machine )
CHAPTER3:SIMULATION RESULT
CONCLUSION
After our group finished this project, we gained a lot of amazing experiences
as well as some difficulties when our project was being made. Firstly, it help
us become more skillful in how to programming in reality. Notwithstanding,
we have also gradually completed the project with certain efforts along with
the knowledge improvement that has great meaning to us. The most essential
point is that we have chances to extend our knowledge in this field and
deeply know how to work on the project. Secondly, one of the most
important additions when making our project is “teamwork”. This has
brought us great efficiencies in the implementation process as well as saving
time. Moreover, all of that skills we achieved and supplemented have positive
impacts on our prospective occupations.
In short, we are pleased to sincerely thank Dr.Ngo Vu Duc for helping us
whenever needed in this semester. Our project may not be as good as
expectation, but we will do our best on the other projects in the future.
REFERENCES

https://academickids.com/encyclopedia/index.php/L
ookup_table
https://www.techopedia.com/definition/7627/huffm
an-coding
https://github.com
https://inpressco.com/wp-
content/uploads/2015/06/Paper962032-2035.pdf

You might also like