Tutorial: Learn by Example
Tutorial: Learn by Example
Table of Contents
Foreword
Basic Logic Gates Latch and Flip-Flops
Combinational Logic Design Sequential Logic Design
Typical Combinatinal Logic Typical Sequential Logic
Components Components
Custom Single-Purpose Processor Design
General-Purpose Processor Design
Appendix: Modeling an industry core
library ieee;
use ieee.std_logic_1164.all;
----------------------------------------
entity Driver is
port( x: in std_logic;
F: out std_logic
);
end Driver;
----------------------------------------
process(x)
begin
-- compare to truth table
if (x='1') then
F <= '1';
else
F <= '0';
end if;
end process;
end behv1;
end behv2;
Siganls are used to connect the design components and must carry the information
between current statements of the design. On the other hand, variables are used within
process to compute certain values. The following example shows their difference:
RTL stands for Register-Transfer Level. It is an essential part of top-down digital design
process. Logic synthesis offers an automated route from an RTL design to a Gate-Level
design. In RTL design a circuit is described as a set of registers and a set of transfer
functions describing the flow of data between the registers, (ie. FSM + Datapath). As an
important part of a complex design, this division is the main objective of the hardware
designer using synthesis. The Synopsys Synthesis Example illustrates that the RTL
synthesis is more efficient than the behavior synthesis, although the simulation of previous
one requires a few clock cycles.
Data-flow (looks more like an Algorithm) modeling is presented in the fourth example. The
FIR digital filter algorithm is simulated and synthesized using VHDL. A comparison of the
coding styles between the RTL modeling and Algorithm level modeling highlights the
different techniques.
FSM +
RTL Test RTL Code Gate-level Synthesis Gate-level
Datapath
Code Bench Simulation Implementation Schematic Simulation
Modeling
o FIR Digital Filter (DSP Example)
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.
Sythesis Script
Counter Behavior Code Timing Report
File
Discussion V: Relationship between Area and Timing
During Synopsys synthesis, ordinary combinational logic will go through several of what
are known as mapping optimizations. In a normal optimization, the synthesis tool will
optimize in relation to the set constrains. It is usual to talk about moving along a "banana
curve" on the area and time axes. This means that the tougher the timing constrains, the
larger the design will be, and vice versa. The results from two different synthesis constrains
applied on the same design are shown below.
For test purposes, a short program (sequential instructions) is loaded into the memory.
After execution, this program will obtain 10 Fabonacci Numbers, and store the results into
specific memory address. The design was implemented using Active-HDL and Synopsys
Design Compiler. (Please note that PC.vhd need a little modify to get correct synthesis
result. Just a practice for the reader.)
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.