Professional Documents
Culture Documents
April 2008
Copyright
Copyright © 2008 Lattice Semiconductor Corporation.
This document may not, in whole or part, be copied, photocopied,
reproduced, translated, or reduced to any electronic medium or machine-
readable form without prior written consent from Lattice Semiconductor
Corporation.
Trademarks
Lattice Semiconductor Corporation, L Lattice Semiconductor Corporation
(logo), L (stylized), L (design), Lattice (design), LSC, E2CMOS, Extreme
Performance, FlashBAK, flexiFlash, flexiMAC, flexiPCS, FreedomChip, GAL,
GDX, Generic Array Logic, HDL Explorer, IPexpress, ISP, ispATE, ispClock,
ispDOWNLOAD, ispGAL, ispGDS, ispGDX, ispGDXV, ispGDX2,
ispGENERATOR, ispJTAG, ispLEVER, ispLeverCORE, ispLSI, ispMACH,
ispPAC, ispTRACY, ispTURBO, ispVIRTUAL MACHINE, ispVM, ispXP,
ispXPGA, ispXPLD, LatticeEC, LatticeECP, LatticeECP-DSP, LatticeECP2,
LatticeECP2M, LatticeMico8, LatticeMico32, LatticeSC, LatticeSCM,
LatticeXP, LatticeXP2, MACH, MachXO, MACO, ORCA, PAC, PAC-Designer,
PAL, Performance Analyst, PURESPEED, Reveal, Silicon Forest,
Speedlocked, Speed Locking, SuperBIG, SuperCOOL, SuperFAST,
SuperWIDE, sysCLOCK, sysCONFIG, sysDSP, sysHSI, sysI/O, sysMEM, The
Simple Machine for Complex Design, TransFR, UltraMOS, and specific
product designations are either registered trademarks or trademarks of
Lattice Semiconductor Corporation or its subsidiaries in the United States
and/or other countries. ISP, Bringing the Best Together, and More of the Best
are service marks of Lattice Semiconductor Corporation.
HyperTransport is a licensed trademark of the HyperTransport Technology
Consortium in the U.S. and other jurisdictions.
Other product names used in this publication are for identification purposes
only and may be trademarks of their respective companies.
Disclaimers
NO WARRANTIES: THE INFORMATION PROVIDED IN THIS DOCUMENT
IS “AS IS” WITHOUT ANY EXPRESS OR IMPLIED WARRANTY OF ANY
KIND INCLUDING WARRANTIES OF ACCURACY, COMPLETENESS,
MERCHANTABILITY, NONINFRINGEMENT OF INTELLECTUAL
PROPERTY, OR FITNESS FOR ANY PARTICULAR PURPOSE. IN NO
EVENT WILL LATTICE SEMICONDUCTOR CORPORATION (LSC) OR ITS
SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER (WHETHER
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL,
INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS,
BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT
OF THE USE OF OR INABILITY TO USE THE INFORMATION PROVIDED
IN THIS DOCUMENT, EVEN IF LSC HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES. BECAUSE SOME JURISDICTIONS
PROHIBIT THE EXCLUSION OR LIMITATION OF CERTAIN LIABILITY,
SOME OF THE ABOVE LIMITATIONS MAY NOT APPLY TO YOU.
LSC may make changes to these materials, specifications, or information, or
to the products described herein, at any time without notice. LSC makes no
commitment to update this documentation. LSC reserves the right to
discontinue any product or service without notice and assumes no obligation
Active-HDL LE Tutorial ii
to correct any errors contained herein or to advise any user of this document
of any correction if such be made. LSC recommends its customers obtain the
latest version of the relevant information to establish, before ordering, that the
information being relied upon is current.
Bold Items in the user interface that you select or click. Text that you type
into the user interface.
Courier Code examples. Messages, reports, and prompts from the software.
Active-HDL LE Tutorial 1
Learning Objectives 1
Time to Complete This Tutorial 2
System Requirements 2
Accessing Online Help 3
About the Tutorial Design 3
About Lattice Edition (LE) 3
Task 1: Setting Up Project Navigator to Start Active-HDL 4
Task 2: Create a New Project 6
Task 3: Functional Simulation 8
Task 4: Browsing the Design 11
Task 5: Source-Level Debugging 12
Controlling the Simulation with a Code Breakpoint 12
Controlling the Simulation with a Signal Breakpoint 14
Viewing Instantaneous States 16
Task 6: Waveform Analysis 17
Adding Port and Signal Objects 17
Adjusting the Waveform View 18
Measuring the Time Between Waveform Events 20
Task 7: Scripting a Simulation 22
Task 8: Interactive Simulation 24
Running Active-HDL LE in Interactive Mode 24
Examining HDL Compiler Options 29
Compiling Design Source Files 30
Summary 32
Glossary 33
Recommended References 33
Active-HDL LE Tutorial 1
Contents
Active-HDL LE Tutorial 2
Active-HDL LE Tutorial
This tutorial leads you through a typical simulation scenario using Active-HDL
Lattice Edition (Active-HDL LE) as the simulation environment for ispLEVER.
The tutorial design models a project using both VHDL and Verilog HDL
blocks. It shows you how to set up ispLEVER and Active-HDL LE so you can
use them interactively to manage a simulation run, use basic simulation and
HDL debugging features, perform waveform analysis, and write scripts.
Although this tutorial emphasizes the feature set provided with Active-HDL
LE, you can use all procedures described with more advanced versions of the
Aldec Active-HDL product line.
Learning Objectives
When you have completed this tutorial, you should be able to do the following:
Configure the ispLEVER Project Navigator to use Active-HDL LE as the
default simulator.
Execute simulation and perform HDL debugging tasks.
Perform waveform analysis.
Create scripts to automate simulation tasks.
Use Active-HDL LE in both batch or interactive simulation scenarios.
Active-HDL LE Tutorial 1
Active-HDL LE Tutorial Time to Complete This Tutorial
System Requirements
The following software configuration is required to complete the tutorial:
Active-HDL Lattice Edition 7.3 or later
ispLEVER-Starter (7.1 or later): FPGA Module and Precision RTL
Synthesis Module
or
Note
Synplify for Lattice does not support concurrent synthesis of Verilog HDL and
VHDL source.
Active-HDL LE Tutorial 2
Active-HDL LE Tutorial Accessing Online Help
Active-HDL LE Tutorial 3
Active-HDL LE Tutorial Task 1: Setting Up Project Navigator to Start Active-HDL
Active-HDL LE Tutorial 4
Active-HDL LE Tutorial Task 1: Setting Up Project Navigator to Start Active-HDL
5. Click OK.
The Active-HDL LE button appears in the Project Navigator toolbar.
9. Click OK.
Active-HDL LE Tutorial 5
Active-HDL LE Tutorial Task 2: Create a New Project
Note
If you want to preserve the original tutorial design files, save the active_hdl_tutor
directory to another location on your computer before proceeding.
Active-HDL LE Tutorial 6
Active-HDL LE Tutorial Task 2: Create a New Project
gt.vhd
lt.vhd
tb_top.vhd
top.vhd
9. Click Open.
In the Import Source Type dialog box, choose the following source type
using the following pattern:
The file source types tell the Project Navigator how to construct file lists
for logic synthesis and simulation. In this case, the VHDL Test Bench,
tb_top.vhd, is included in the file list for simulation but is ignored during
the synthesis process.
10. Click Next.
11. In the The Project Wizard – Project Information dialog box, click Finish.
12. In the Associated VHDL Test Bench dialog box, shown in Figure 5,
choose LFE2-6E-5T144C and click OK.
The Project Navigator analyzes all HDL source files and creates a list of
modules in the Modules tab of the Sources in Project window, as shown in
Figure 6. The VHDL test bench file, tb_top.vhd, appears with a special icon
above top.vhd.
Active-HDL LE Tutorial 7
Active-HDL LE Tutorial Task 3: Functional Simulation
You can access functional simulation in one of two ways from the Project
Navigator:
Batch interface, which starts Active-HDL LE using a Tcl script that
references the project file list, libraries for the target FPGA, and a default
waveform display and run time. No simulation project is created. The
batch interface is preferred when the file list is not yet stable and when
Active-HDL LE Tutorial 8
Active-HDL LE Tutorial Task 3: Functional Simulation
This task demonstrates the batch simulation interface. For more information
on using Active-HDL LE interactively, see the Active-HDL online help and
tutorials.
The tutorial project could have used a Verilog test fixture for stimulus as
well. You can use any combination of HDL types within the project, as long
as your simulator and synthesis tool is licensed to support mixed HDL.
Active-HDL LE Tutorial 9
Active-HDL LE Tutorial Task 3: Functional Simulation
4. Scroll up through the Console tab, noting the Tcl commands issued by the
batch interface.
tb_top.fado:
# NOTE: Do not edit this file.
# Auto generated by VHDL Functional Simulation Models
#
design create work ./work
design open work/work
do -tcl compare.vfd
Active-HDL LE Tutorial 10
Active-HDL LE Tutorial Task 4: Browsing the Design
vcom tb_top.vhd
vsim TB_TOP -L pmi_work
do tb_top_vhdf.udo TB_TOP
# End
compare.vfd:
# NOTE: Do not edit this file.
# Auto-generated by All VHDL Functional Simulation Models
#
source {C:/ispTOOLS7_1/ispcpld/bin/chipsim_cmd.tcl}
set sty_file compare.sty
if {![info exists HasProc(LS_Vcom)]} { source {chipsim_cmd.tcl}
}
set vcom_opt ""
set src_files {comp_eq.v lt.vhd gt.vhd top.vhd}
LS_Vcom sty_file src_files vcom_opt
# End
tb_top_vhdlf.udo:
-- ispLEVER VHDL Functional Simulation Template:
tb_top_vhdf.udo.
-- You may edit this file to control your simulation.
-- You may specify your design unit. - 1
-- You may specify your waveforms.
add wave *
-- You may specify your simulation run time.
run 1000 ns
The details of all the scripts are not important to understand; however, the
tb_top_vhdlf.udo script provides a means to specify the signals to be traced in
the waveform window and default simulation run time. This is a popular file to
modify for your project.
The Structure tab of the Design Browser provides a browser that presents the
hierarchical organization of the model. Different icons are used to indicate
component instances, signal drivers, and processes. Icons are color-coded to
indicate the source format as VHDL or Verilog HDL. As you select objects of
the structure, a list of ports, signals, and variable appears below the tree.
Selections that you make in the Design Browser are used to populate a
variety of visualization features, such as the Waveform, Watch, and List
displays.
Active-HDL LE Tutorial 11
Active-HDL LE Tutorial Task 5: Source-Level Debugging
The details of the instance appear, and the port and signal contents
appear in the list below, as shown in Figure 9.
The VHDL objects of the model are colored blue, and the Verilog objects
are colored green.
Active-HDL LE Tutorial 12
Active-HDL LE Tutorial Task 5: Source-Level Debugging
Active-HDL LE Tutorial 13
Active-HDL LE Tutorial Task 5: Source-Level Debugging
Active-HDL LE Tutorial 14
Active-HDL LE Tutorial Task 5: Source-Level Debugging
3. Choose Root: tb_top (tb) from the hierarchy browser, then select the
COMPDAT signal, as shown in Figure 11.
Figure 11: Choosing the COMPDAT Signal in the Add Signals Dialog Box
Active-HDL LE Tutorial 15
Active-HDL LE Tutorial Task 5: Source-Level Debugging
c. Click OK.
8. Click OK in the Breakpoints dialog box.
9. Choose Simulation > Restart Simulation to re-initialize the simulator.
10. Press Alt+F5 or the Run button on the toolbar.
The simulator runs until the COMPDAT signal breakpoint occurs around
time 680 ns, as shown in Figure 13 (you may need to click on the
Waveform Editor 1 tab to view it).
Active-HDL LE Tutorial 16
Active-HDL LE Tutorial Task 6: Waveform Analysis
Details about the object and current value appear in the display, as shown
in Figure 14.
Active-HDL LE Tutorial 17
Active-HDL LE Tutorial Task 6: Waveform Analysis
The ports are added to the Waveform Editor. You can also drag and drop
simulation objects between many other windows and panes.
3. Right-click the Name column header of the waveform view and select
Columns > Hierarchy.
A new column appears to indicate the hierarchical path (UUT/EQ_1) to
the new ports.
4. In the Design Browser, select the LT_1 instance, then drag and drop it
onto the waveform window.
Three LT_1 ports appear in the waveform window.
In the following final steps, you will add signals using an Active-HDL Tcl
command.
5. In the Design Browser, select instance UUT.
The UUT signals and ports appear in the list below the hierarchy.
6. In the Console window, type wave * at the command prompt and press
Enter.
All UUT ports and signals appear in the waveform window.
7. In the Console window, type run and press Enter.
The simulator advances, and the waveform display shows the state
history of all ports and signals traced, as shown in Figure 16.
Active-HDL LE Tutorial 18
Active-HDL LE Tutorial Task 6: Waveform Analysis
Active-HDL LE Tutorial 19
Active-HDL LE Tutorial Task 6: Waveform Analysis
Active-HDL LE Tutorial 20
Active-HDL LE Tutorial Task 6: Waveform Analysis
The second cursor snaps to the falling transition of GT_O. The pulse
period is displayed as 10 ns, as shown in Figure 18.
Active-HDL LE Tutorial 21
Active-HDL LE Tutorial Task 7: Scripting a Simulation
Note
Advanced versions of Active-HDL provide a stand-alone simulation environment,
VSimSA, that is designed for long simulation runs and batch processing from the
Windows command line. The Lattice Design Edition Lite license does not support
VSimSA.
# Create a library
alib work
# Compile the simulation file list
vlog -v2k comp_eq.v
vcom -2002 lt.vhd gt.vhd top.vhd tb_top.vhd
# Initialize
vsim TB_TOP -L pmi_work
# Save simulation data to a VCD text file
vcd file wave.vcd
vcd add -r TB_TOP *
# List all signals in decimal format
list *
wave *
# Advance the simulator 700 ns
run 700 ns
# Quit the simulation
endsim
# End
Active-HDL LE Tutorial 22
Active-HDL LE Tutorial Task 7: Scripting a Simulation
Active-HDL LE Tutorial 23
Active-HDL LE Tutorial Task 8: Interactive Simulation
Figure 20: Selecting the Workspace Folder in the New Workspace Dialog
Box
Active-HDL LE Tutorial 24
Active-HDL LE Tutorial Task 8: Interactive Simulation
5. In the New Design Wizard dialog box, select Create an Empty Design,
as shown in Figure 21, and click the Next button.
Figure 21: Creating an Empty Design in the New Design Wizard Dialog
Box
Active-HDL LE Tutorial 25
Active-HDL LE Tutorial Task 8: Interactive Simulation
The Property Page dialog box should now resemble the illustration in
Figure 22.
Active-HDL LE Tutorial 26
Active-HDL LE Tutorial Task 8: Interactive Simulation
7. In the New Design Wizard dialog box, enter compare_inter as the design
name, as shown in Figure 23.
Figure 23: Entering the Design Name in the New Design Wizard Dialog
Box
Active-HDL LE Tutorial 27
Active-HDL LE Tutorial Task 8: Interactive Simulation
The design units compiled into ecp2 appear in the list panel to the right, as
shown in Figure 24.
Active-HDL LE Tutorial 28
Active-HDL LE Tutorial Task 8: Interactive Simulation
comp_eq.v
gt.vhd
lt.vhd
tb_top.vhd
top.vhd
4. Click Add.
The files are listed below the compare_inter design in the Design Browser.
The numbers in the left-hand margin of the file list indicate the order in
which the files will be compiled by the simulator (1 first, 2 second, and so
on.). The file list order is important to ensure that objects referenced by
one model are defined before they are used. For this project, top.vhd must
be in position 4, and tb_top.vhd must be in position 5.
5. Organize the file list by dragging and dropping to put top.vhd in position 4
and tb_top.vhd in position 5.
Note
Options in the Design Setting dialog boxes apply to the current workspace or design
only. If you want to apply default settings for future workspaces, see the Tools >
Preferences dialog boxes.
Active-HDL LE Tutorial 29
Active-HDL LE Tutorial Task 8: Interactive Simulation
Active-HDL LE Tutorial 30
Active-HDL LE Tutorial Task 8: Interactive Simulation
Active-HDL LE Tutorial 31
Active-HDL LE Tutorial Summary
The signals appear in the Name list of the Waveform Editor, as shown in
Figure 28.
Summary
You have completed the Active-HDL Lattice Edition Tutorial. In this tutorial,
you have learned how to do the following:
Set up Project Navigator to launch Active-HDL LE as the default simulator.
Examine interface scripts issued by Project Navigator.
Active-HDL LE Tutorial 32
Active-HDL LE Tutorial Glossary
Glossary
Following are the terms and concepts that you should understand to use this
tutorial effectively.
Recommended References
You can find additional information on the subjects covered by this tutorial
from the following recommended sources:
Active-HDL Lattice Edition online documentation and tutorials
support.aldec.com
ispLEVER online documentation
Active-HDL LE Tutorial 33
Active-HDL LE Tutorial Recommended References
Active-HDL LE Tutorial 34