VHDL Tutorial
VHDL Tutorial
VHDL Tutorial
Example
-- by Weijun Zhang
Table of Contents
Foreword
Basic Logic Gates Latch and Flip-Flops
Combinational Logic Sequential Logic Design
Design
Typical Combinatinal Typical Sequential
Logic Components Logic Components
Custom Single-Purpose Processor Design
General-Purpose Processor Design
Appendix: Modeling an industry core
Following section illustrates the RTL (FSM+Datapath) method further using several
design examples.
Custom Single-Purpose Processor Design
(ESD Chapter 2, Chapter 4)
The first three examples illustrate the difference between RTL FSMD model (Finite
State Machine with Datapath buildin) and RTL FSM + DataPath model. From view
of RT level design, each digital design consists of a Control Unit (FSM) and a
Datapath. The datapath consists of storage units such as registers and memories,
and combinational units such as ALUs, adders, multipliers, shifters, and
comparators. The datapath takes the operands from storage units, performs the
computation in the combinatorial units, and returns the results to the storage
units during each state. This process typically takes one or two clock cycles.
FSM +
RTL Test RTL Code Gate-level Synthesis Gate-level
Datapath
Code Bench Simulation Implementation Schematic Simulation
Modeling
Data-
Behavior Test Behavior Gate-level Synthesis Gate-level
Flow
Code Bench Simulation(1,2) Implementation Schematic Simulation
Modeling
Synopsys tools can be used to perform Power Analysis for all the VHDL designs.
Generally, the better design has smaller power consumption. On the other hand,
improve the power always means sacrificing other design metrics such as
performance, area size or NRE cost. Therefore, a designer need to balance these
metrics to find the best implementation for the given application and constraints.
Please check out the power analysis results of Adder, Counter, ISA controller,
Bridge controller and FIR Filter. As we expected, FIR digital filter has the biggest
power consumption because it has a more complex circuit doing DSP computation.
Synopsys power analysis tutorial can be found here.
When we design and simulate the high-level (either behavior or RTL) code, we
only care about design functionality. However, in VHDL synthesis, the timing and
the functionality of a design must always be considered together. Therefore, once
the design has been synthesized, the second goal of simulation is to quickly verify
that the gate-level implementation meets timing requirements. We use this idea
(coding -> simulation -> synthesis -> simulation) to test all of the examples in this
tutorial.
Another common way is to apply the timing constrains on the design during
synthesis. then the timing report is checked to see if the slack, which is the
required delay minus the actual delay, is MET or VIOLATED. If VIOLATED, we
should go back to the VHDL code and re-write it to improve timing. The whole
design will be compiled and tested again.
There are now two industry standard hardware description languages, VHDL and
Verilog. It is important that a designer knows both of them although we are using
only VHDL in class. Verilog is easier to understand and use. For several years it
has been the language of choice for industrial applications that required both
simulation and synthesis. It lacks, however, constructs needed for system level
specifications. VHDL is more complex, thus difficult to learn and use. However it
offers a lot more flexibility of the coding styles and is suitable for handling very
complex designs. Here is a great article to explain their difference and tradeoffs.
I. Specification of HD 6402