Xilinx ISE Simulator (ISim) In-Depth Tutorial
Xilinx ISE Simulator (ISim) In-Depth Tutorial
Xilinx ISE Simulator (ISim) In-Depth Tutorial
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>)<br />
<strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
<strong>Xilinx</strong> is disclosing this user guide, manual, release note, and/or specification (the "Documentation") to you solely for use in the development<br />
of designs to operate with <strong>Xilinx</strong> hardware devices. You may not reproduce, distribute, republish, download, display, post, or transmit the<br />
Documentation in any form or by any means including, but not limited to, electronic, mechanical, photocopying, recording, or otherwise,<br />
without the prior written consent of <strong>Xilinx</strong>. <strong>Xilinx</strong> expressly disclaims any liability arising out of your use of the Documentation. <strong>Xilinx</strong> reserves<br />
the right, at its sole discretion, to change the Documentation without notice at any time. <strong>Xilinx</strong> assumes no obligation to correct any errors<br />
contained in the Documentation, or to advise you of any corrections or updates. <strong>Xilinx</strong> expressly disclaims any liability in connection with<br />
technical support or assistance that may be provided to you in connection with the <strong>In</strong>formation.<br />
THE DOCUMENTATION IS DISCLOSED TO YOU “AS-IS” WITH NO WARRANTY OF ANY KIND. XILINX MAKES NO OTHER<br />
WARRANTIES, WHETHER EXPRESS, IMPLIED, OR STATUTORY, REGARDING THE DOCUMENTATION, INCLUDING ANY<br />
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NONINFRINGEMENT OF THIRD-PARTY<br />
RIGHTS. IN NO EVENT WILL XILINX BE LIABLE FOR ANY CONSEQUENTIAL, INDIRECT, EXEMPLARY, SPECIAL, OR INCIDENTAL<br />
DAMAGES, INCLUDING ANY LOSS OF DATA OR LOST PROFITS, ARISING FROM YOUR USE OF THE DOCUMENTATION.<br />
© 2010 <strong>Xilinx</strong>, <strong>In</strong>c. XILINX, the <strong>Xilinx</strong> logo, Virtex, Spartan, <strong>ISE</strong>, and other designated brands included herein are trademarks of <strong>Xilinx</strong> in the<br />
United States and other countries. All other trademarks are the property of their respective owners.<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com UG682 (v 12.3) September 21, 2010
Table of Contents<br />
Preface: About This <strong>Tutorial</strong><br />
About the <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>) <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7<br />
<strong>Tutorial</strong> Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7<br />
<strong>Tutorial</strong> Flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7<br />
Using <strong>ISim</strong> from <strong>ISE</strong> Project Navigator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7<br />
Using <strong>ISim</strong> Standalone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8<br />
Additional Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8<br />
Chapter 1: Overview of the <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>)<br />
Overview of <strong>ISim</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9<br />
vhpcomp, vlogcomp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9<br />
fuse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9<br />
Simulation Executable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9<br />
isimgui.exe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10<br />
Chapter 2: Running <strong>ISim</strong> from <strong>ISE</strong> Project Navigator<br />
Overview of <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>)-Project Navigator <strong>In</strong>tegrated Flow . . . . . . . . 11<br />
Getting Started. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11<br />
Software Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11<br />
<strong>In</strong>stalling the <strong>Tutorial</strong> Design Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11<br />
Design Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12<br />
Functional Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12<br />
drp_dcm (drp_dcm.vhd) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12<br />
drp_stmach (drp_stmach.vhd) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12<br />
drp_demo (drp_demo.vhd) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13<br />
drp_demo_tb (drp_demo_tb.vhd) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13<br />
Design Self-Checking Test Bench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13<br />
Simulating the Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14<br />
Creating a Project in <strong>ISE</strong> Project Navigator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14<br />
Launching Project Navigator and Using New Project Wizard . . . . . . . . . . . . . . . . . . . . 14<br />
Adding <strong>Tutorial</strong> Source Files to the Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17<br />
Creating VHDL Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19<br />
Moving VHDL files to a Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20<br />
Launching a Behavioral Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22<br />
Setting Behavioral Simulation Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22<br />
Launching Behavioral Simulation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24<br />
What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24<br />
Chapter 3: Running <strong>ISim</strong> Standalone<br />
Overview of <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>) Standalone Flow. . . . . . . . . . . . . . . . . . . . . . . . . . 25<br />
Getting Started. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25<br />
Software Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25<br />
<strong>In</strong>stalling the <strong>Tutorial</strong> Design Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com iii<br />
UG682 (v 12.3) September 21, 2010
Design Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26<br />
Functional Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26<br />
drp_dcm (drp_dcm.vhd) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26<br />
drp_stmach (drp_stmach.vhd) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26<br />
drp_demo (drp_demo.vhd) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27<br />
drp_demo_tb (drp_demo_tb.vhd) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27<br />
Design Self-Checking Test Bench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27<br />
Preparing the Simulation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27<br />
Creating an <strong>ISim</strong> Project File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28<br />
Building the Simulation Executable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28<br />
Using fuse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28<br />
Simulating the Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29<br />
Running the Simulation Executable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29<br />
What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30<br />
Chapter 4: Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
Overview of the <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>) Graphical User <strong>In</strong>terface . . . . . . . . . . . . . . 31<br />
Exploring the User <strong>In</strong>terface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32<br />
Main Toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32<br />
<strong>In</strong>stances and Processes Panel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32<br />
Source Files Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33<br />
Objects Panel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33<br />
Wave Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34<br />
Text Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35<br />
Breakpoints Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35<br />
Console Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36<br />
Examining the Design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36<br />
Adding Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36<br />
Running the Simulation for a Specified Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38<br />
Restarting the Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39<br />
Adding Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40<br />
Adding Dividers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41<br />
Adding Signals from Sub-Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42<br />
Changing Signal and Wave Window Properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45<br />
Changing the Signal Name Format. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46<br />
Changing the Signal Radix Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46<br />
Changing the Signal Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46<br />
Floating the Wave Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47<br />
Saving the Wave Window Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48<br />
Simulation the Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49<br />
Using Markers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49<br />
Using Cursors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51<br />
Zooming <strong>In</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52<br />
Measuring Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53<br />
Using Multiple Wave Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55<br />
Debugging the Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57<br />
Viewing Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57<br />
Using Breakpoints and Stepping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58<br />
Setting Breakpoints. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58<br />
Stepping through Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60<br />
Fixing Bugs in the Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61<br />
Verifying Bug Fix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62<br />
iv www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
What’s Next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com v<br />
UG682 (v 12.3) September 21, 2010
vi www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
About This <strong>Tutorial</strong><br />
About the <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>) <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
<strong>Tutorial</strong> Contents<br />
<strong>Tutorial</strong> Flows<br />
Preface<br />
The <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> provides <strong>Xilinx</strong> PLD designers with a detailed introduction of<br />
the <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>) software. After you have completed the tutorial, you will have a<br />
thorough understanding of how to analyze and debug your design via HDL simulation<br />
using <strong>ISim</strong>.<br />
This tutorial is designed for running the <strong>ISim</strong> software on a Windows environment. Some<br />
modifications may be required to run certain steps successfully in other operating systems.<br />
This tutorial covers the following topics:<br />
Chapter 1, Overview of the <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>), introduces the <strong>ISim</strong> software<br />
environment, including the <strong>ISim</strong> compilers, linker, simulation executable and Graphical<br />
User <strong>In</strong>terface (GUI).<br />
Chapter 2, Running <strong>ISim</strong> from <strong>ISE</strong> Project Navigator, explains how to launch a functional<br />
simulation through the <strong>ISE</strong> Project Navigator software.<br />
Chapter 3, Running <strong>ISim</strong> Standalone, guides you through a typical procedure for<br />
launching a functional simulation using the <strong>ISim</strong> compiler, linker and simulation<br />
executable outside of the <strong>ISE</strong> Project Navigator environment.<br />
Chapter 4, Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface, introduces you to the <strong>ISim</strong> GUI by<br />
examining, debugging, and verifying a functional simulation.<br />
This tutorial presents two flows in which <strong>ISim</strong> can be used for performing a functional<br />
(behavioral) simulation.<br />
Using <strong>ISim</strong> from <strong>ISE</strong> Project Navigator<br />
<strong>In</strong> this flow, you will launch <strong>ISim</strong> via one of the simulation processes available in <strong>ISE</strong><br />
Project Navigator. This flow works best when an <strong>ISE</strong> Project Navigator project is created in<br />
order to implement the design in a <strong>Xilinx</strong>® FPGA or CPLD. This flow is intended for<br />
designs that contain sources that are not HDL, such as schematics and cores, which require<br />
Project Navigator to properly convert these sources to HDL source files which <strong>ISim</strong> can<br />
compile.<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 7<br />
UG682 (v 12.3) September 21, 2010
Preface: About This <strong>Tutorial</strong><br />
Follow these chapters if you are interested in this flow:<br />
Chapter 1, Overview of the <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>)<br />
Chapter 2, Running <strong>ISim</strong> from <strong>ISE</strong> Project Navigator<br />
Chapter 4, Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
Using <strong>ISim</strong> Standalone<br />
Additional Resources<br />
<strong>In</strong> this mode, you will simulate your design by creating your own <strong>ISim</strong> project files and<br />
running the HDL linker and simulation executable in a command line or batch file mode.<br />
This flow is intended for users who do not need to use Project Navigator for HDL design<br />
management.<br />
The following chapters will help you understand this flow:<br />
Chapter 1, Overview of the <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>)<br />
Chapter 3, Running <strong>ISim</strong> Standalone<br />
Chapter 4, Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
To find more detailed information and discussions on <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>) topics covered<br />
in this tutorial, refer to the following documents:<br />
<strong>ISim</strong> User Guide, accessible from the Software Manuals page on the <strong>Xilinx</strong> website:<br />
http://www.xilinx.com/support/documentation/sw_manuals/xilinx12_3/<br />
plugin_ism.pdf<br />
Note: <strong>ISim</strong> Help is available from the <strong>ISim</strong> software by pressing F1 or from the Help menu.<br />
Software Manuals - To find additional documentation, see the <strong>Xilinx</strong> website at:<br />
http://www.xilinx.com/support/documentation/index.htm<br />
<strong>Tutorial</strong>s Page - To find the <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> design files and other <strong>ISE</strong> Design Suite<br />
tutorials, see the <strong>Xilinx</strong> website at:<br />
http://www.xilinx.com/support/documentation/dt_ise12-3_tutorials.htm<br />
Answer Records - To search the Answer Database of silicon, software, and IP questions<br />
and answers, or to create a technical support WebCase, see the <strong>Xilinx</strong> website at:<br />
http://www.xilinx.com/support/<br />
<strong>Xilinx</strong> Forums - To discuss topics of interest with other <strong>Xilinx</strong> users, see the <strong>Xilinx</strong> User<br />
Community Forum at:<br />
http://forums.xilinx.com/xlnx/<br />
8 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
Chapter 1<br />
Overview of the <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>)<br />
Overview of <strong>ISim</strong><br />
The <strong>Xilinx</strong>® <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>) is a Hardware Description Language (HDL) simulator<br />
that enables you to perform functional (behavioral) and timing simulations for VHDL,<br />
Verilog and mixed-language designs.<br />
This <strong>ISE</strong> <strong>Simulator</strong> environment is comprised of the following key elements:<br />
Vhpcomp (VHDL compiler)<br />
Vlogcomp (Verilog compiler)<br />
fuse (HDL elaborator and linker)<br />
Simulation Executable<br />
isimgui (<strong>ISim</strong> Graphical User <strong>In</strong>terface)<br />
Note: More information about <strong>ISim</strong> is available in the <strong>ISim</strong> User Guide.<br />
vhpcomp, vlogcomp<br />
fuse<br />
vhpcomp and vlogcomp parse and compile VHDL and Verilog source files respectively.<br />
The object code generated by the compilers is used by HDL linker (fuse) to create a<br />
simulation executable.<br />
The fuse command is the Hardware Description Language (HDL) elaborator and linker<br />
used by <strong>ISim</strong>. fuse effects static elaboration on the design given the top design units and<br />
then compiles the design units to object code. The design unit object files are then linked<br />
together to create a simulation executable.<br />
fuse can link design units compiled previously with vhpcomp or vlogcomp. Alternatively,<br />
fuse can automatically invoke vlogcomp and vhpcomp for each VHDL or Verilog source<br />
code listed in a project file (.prj). This method allows for compilation of sources<br />
“on-the-fly”.<br />
Simulation Executable<br />
The Simulation Executable is generated by the fuse command. To run the simulation of a<br />
design in <strong>ISim</strong>, the generated simulation executable needs to be invoked. When <strong>ISim</strong> is run<br />
inside the <strong>ISE</strong> Project Navigator interface, <strong>ISE</strong> takes care of invoking the generated<br />
simulation executable. A command-line user needs to explicitly invoke the generated<br />
simulation executable to effect simulation. The simulation executable effects event-driven<br />
simulation and has rich support for driving and probing simulation using Tcl.<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 9<br />
UG682 (v 12.3) September 21, 2010
Chapter 1: Overview of the <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>)<br />
isimgui.exe<br />
Note: The <strong>ISE</strong> Simulation Executable has a .exe extension in both Linux and Windows. The default<br />
executable naming format is x.exe.<br />
isimgui.exe (isimgui on Linux) is the <strong>ISim</strong> Graphical User <strong>In</strong>terface. It contains the wave<br />
window, toolbars, panels, and the status bar. <strong>In</strong> the main window, you can view the<br />
simulation-visible parts of the design, add and view signals in the wave window, utilize<br />
<strong>ISim</strong> commands to run simulation, examine the design, and debug as necessary.<br />
10 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
Running <strong>ISim</strong> from <strong>ISE</strong> Project<br />
Navigator<br />
Chapter 2<br />
Overview of <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>)-Project Navigator <strong>In</strong>tegrated Flow<br />
Getting Started<br />
The <strong>Xilinx</strong>® <strong>ISE</strong> Design Suite provides an integrated flow with the <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>)<br />
that allows simulations to be launched directly from the Project Navigator (<strong>ISE</strong>). All<br />
simulation commands that prepare the <strong>ISim</strong> simulation are generated by <strong>ISE</strong> Project<br />
Navigator and automatically run in the background when simulating a design using this<br />
flow.<br />
Software Requirements<br />
To use this tutorial, you must install one of the following software:<br />
<strong>ISE</strong> WebPACK 12.3<br />
One of the <strong>ISE</strong> Design Suite 12.3 Editions (Logic, DSP, Embedded, System)<br />
For more information about installing <strong>Xilinx</strong> software, see the <strong>Xilinx</strong> <strong>ISE</strong> Design Suite:<br />
<strong>In</strong>stallation, Licensing, and Release Notes.<br />
<strong>In</strong>stalling the <strong>Tutorial</strong> Design Files<br />
Design files for this tutorial are available from the <strong>Tutorial</strong>s page on the <strong>Xilinx</strong> Website.<br />
Download the tutorial design zip file from the website.<br />
Unzip the design files into an easily accessible directory with full read and write<br />
permissions.<br />
The contents of the tutorial design files are as follows:<br />
Table 2-1: <strong>Tutorial</strong> Design Files<br />
Folder Description<br />
sources<br />
Contains all the HDL files necessary for a functional<br />
simulation of the design.<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 11<br />
UG682 (v 12.3) September 21, 2010
Chapter 2: Running <strong>ISim</strong> from <strong>ISE</strong> Project Navigator<br />
Design Description<br />
Functional Blocks<br />
Table 2-1: <strong>Tutorial</strong> Design Files<br />
Folder Description<br />
scripts<br />
completed<br />
The tutorial design is a simple demonstration of the Dynamic Reconfiguration feature of<br />
the Virtex®-5 Digital Clock Manager (DCM).<br />
Using the Virtex-5 DCM, the design generates an output clock using the following<br />
relationship:<br />
Output Clock = <strong>In</strong>put Clock * (Multiplier / Divider)<br />
Using the Dynamic Reconfiguration Ports (DRP) in the DCM, the design allows you to<br />
re-define the Multiplier and Divider parameters to generate different output frequencies.<br />
The tutorial design consists of the following functional blocks.<br />
drp_dcm (drp_dcm.vhd)<br />
Virtex-5 DCM macro with internal feedback, frequency controlled output, duty-cycle<br />
correction, and Dynamic Reconfiguration ability.<br />
The CLKFX_OUT output provides a clock that is defined by the following relationship:<br />
CLKFX_OUT = CLKIN_IN * (Multiplier/Divider)<br />
For example, using a 100 MHz input clock, setting the Multiplier factor to 6, and Divider<br />
factor to 5, produces a 120 MHz CLKFX_OUT output clock.<br />
Using the DRP ports of the DCM, the Multiplier (M) and Divider (D) parameters can be<br />
dynamically redefined to produce different CLKFX_OUT frequencies. For the purposes of<br />
this tutorial, it suffices to show how the Multiply and Divide parameters are provided to<br />
the DCM via the 16-bit wide DI_IN port:<br />
DI_IN[15:8] = M – 1<br />
DI_IN[7:0] = D – 1<br />
For example, for an M/D factor of 6 / 5, DI_IN = 0504h.<br />
drp_stmach (drp_stmach.vhd)<br />
Contains incomplete script files to run the simulation.<br />
These script files will be completed as you go through the<br />
tutorial.<br />
Contains completed script, simulation and wave<br />
configuration files, as well as a completed <strong>ISE</strong> 12 project of<br />
the tutorial design, for comparison purposes.<br />
This module describes a Dynamic Reconfiguration Controller. The DRP controller asserts<br />
and monitors the DCM DRP signals in order to perform a dynamic reconfiguration cycle.<br />
A dynamic reconfiguration cycle is started by asserting the drp_start signal. Following this<br />
step, the DRP Controller asserts the appropriate DCM DRP pins in order to complete a full<br />
Dynamic Reconfiguration cycle.<br />
12 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
Design Description<br />
Signal drp_done indicates a successful completion of a dynamic reconfiguration cycle.<br />
drp_demo (drp_demo.vhd)<br />
This is the top module of the tutorial design which connects the DCM macro and the DRP<br />
controller modules to the external I/O ports.<br />
drp_demo_tb (drp_demo_tb.vhd)<br />
Self-checking HDL test bench. Refer to Design Self-Checking Test Bench for more<br />
information.<br />
Design Self-Checking Test Bench<br />
To test the functionality of this design, a self-checking test bench has been provided. (Refer<br />
to source file drp_demo_tb.vhd in the sources/ folder.) A self-checking test bench<br />
contains a validation routine or function that compares sampled values from the<br />
simulation against expected results. The self-checking test bench provided for this design<br />
performs the following functions.<br />
Generates a 100 MHz input clock for the design system clock (clk_in).<br />
Performs four different tests in order to dynamically change the output frequency of<br />
the design. <strong>In</strong> each test, a DRP cycle is started (using the drp_start signal) to set the<br />
output clock to a different frequency. The following table shows the desired output<br />
frequency and Multiplier/Divider parameters used for each test.<br />
Table 2-1: Desired Output Frequency and Multiplier/Divider Parameters Used For<br />
Each Test<br />
Test Freq. (MHz) Period (ps) Multiplier (M) Divider (D)<br />
1 75 13,332 3 4<br />
2 120 8,332 6 5<br />
3 250 4000 5 2<br />
4 400 2,500 4 1<br />
<strong>In</strong> each test, the test bench compares the expected clock period and the clock period<br />
measured during simulation. Based on the comparison results, messages are written<br />
to the simulator indicating success or failure.<br />
Upon completion of the simulation, a summary report provides a list of tests, both<br />
passed or failed.<br />
For more details on the functionality of this design, refer to the in-line comments included<br />
in the sources of the design.<br />
Tip: To create an HDL test bench in Project Navigator, select Project > Create New Sources and<br />
select VHDL Testbench or Verilog Text Fixture.<br />
Note: To learn more about designing HDL test benches, check out Application Note XAPP199<br />
“Writing Effective Testbenches.”<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 13<br />
UG682 (v 12.3) September 21, 2010
Chapter 2: Running <strong>ISim</strong> from <strong>ISE</strong> Project Navigator<br />
Simulating the Design<br />
The <strong>ISE</strong>-<strong>ISim</strong> integrated flow enables you to perform behavioral and timing simulations of<br />
your design in the <strong>ISE</strong> Project Navigator software quickly.<br />
<strong>In</strong> this tutorial flow, in the <strong>ISE</strong> Project Navigator you will create an <strong>ISE</strong> project for the<br />
tutorial design first. You will then set some behavioral simulation properties and launch<br />
the <strong>ISim</strong> simulator to perform a behavioral simulation of the design.<br />
Creating a Project in <strong>ISE</strong> Project Navigator<br />
We will use the New Project Wizard in <strong>ISE</strong> Project Navigator to quickly create an <strong>ISE</strong><br />
project for the tutorial design.<br />
Note: Read <strong>In</strong>stalling the <strong>Tutorial</strong> Design Files to obtain the files required for this design.<br />
Launching Project Navigator and Using New Project Wizard<br />
Follow these steps to launch Project Navigator software and create an <strong>ISE</strong> project.<br />
1. Double-click on the <strong>Xilinx</strong> <strong>ISE</strong> 12.3 desktop icon to launch the <strong>ISE</strong> Project Navigator.<br />
X-Ref Target - Figure 2-1<br />
Figure 2-1: <strong>Xilinx</strong> <strong>ISE</strong> 12.3 Desktop Icon<br />
2. Click the New Project button to launch the New Project Wizard.<br />
3. Provide a name and an appropriate location for the project (Refer to Figure 2-2).<br />
4. Click Next to continue.<br />
14 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
X-Ref Target - Figure 2-2<br />
Figure 2-2: New Project Wizard: Create New Project Page<br />
5. <strong>In</strong> the window, select the device and project properties.<br />
6. Change the settings to match the settings shown in Figure 2-3.<br />
7. Click Next to continue.<br />
Simulating the Design<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 15<br />
UG682 (v 12.3) September 21, 2010
Chapter 2: Running <strong>ISim</strong> from <strong>ISE</strong> Project Navigator<br />
X-Ref Target - Figure 2-3<br />
Figure 2-3: New Project Wizard: Project Settings<br />
8. Review the Project Summary page and make sure that the settings match those shown<br />
in Figure 2-4.<br />
9. Click Finish to continue.<br />
16 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
X-Ref Target - Figure 2-4<br />
Figure 2-4: Project Summary<br />
Adding <strong>Tutorial</strong> Source Files to the Project<br />
Simulating the Design<br />
1. Click the Add Source button in the Design Panel toolbar to select the sources provided<br />
for this tutorial.<br />
2. <strong>In</strong> the next window, make sure that the association and libraries have been properly<br />
specified for the tutorial sources. Compare your settings with those in Figure 2-5.<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 17<br />
UG682 (v 12.3) September 21, 2010
Chapter 2: Running <strong>ISim</strong> from <strong>ISE</strong> Project Navigator<br />
X-Ref Target - Figure 2-5<br />
Figure 2-5: Status of Source Files and Associations<br />
3. Click OK.<br />
The source files are added to the project.<br />
18 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
X-Ref Target - Figure 2-6<br />
Figure 2-6: <strong>ISE</strong> Project Navigator Design Summary<br />
Creating VHDL Library<br />
Simulating the Design<br />
Next, you need to create a user VHDL library for a VHDL package (drp_tb_pkg.vhd)<br />
that will be used by the test bench of this design. The VHDL package contains VHDL<br />
functions used by the test bench to perform verification routines. Once the VHDL library is<br />
created, you will move the VHDL package file from the work library to the newly-created<br />
VHDL library.<br />
Follow these steps to create a VHDL library.<br />
1. <strong>In</strong> Project Navigator, select Project > New Source. The New Source Wizard opens.<br />
2. Select VHDL Library as a source type.<br />
3. Type drp_tb_lib for the VHDL library name. (Refer to Figure 2-7).<br />
4. Click Next to continue.<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 19<br />
UG682 (v 12.3) September 21, 2010
Chapter 2: Running <strong>ISim</strong> from <strong>ISE</strong> Project Navigator<br />
X-Ref Target - Figure 2-7<br />
5. <strong>In</strong> the Summary page, click Finish to complete the New Source Wizard.<br />
Moving VHDL files to a Library<br />
Figure 2-7: Select Source Type<br />
Follow these steps to move the VHDL package file to the drp_tb_lib VHDL library.<br />
1. <strong>In</strong> the Sources Panel, click the Libraries tab to switch to the Libraries Panel. (Refer to<br />
Figure 2-8.)<br />
20 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
X-Ref Target - Figure 2-8<br />
Simulating the Design<br />
2. Expand the work library by clicking once on the hierarchy separator. (Refer to<br />
Figure 2-8.)<br />
3. Right-click the drp_tb_pkg.vhd file, and select Move to Library.<br />
4. <strong>In</strong> the Move to Library dialog box, select drp_tb_lib as the library into which you<br />
will move drp_tb_pkg.vhd, the VHDL package file.<br />
5. Click OK. (Refer to Figure 2-9.)<br />
X-Ref Target - Figure 2-9<br />
Figure 2-8: Select the Libraries Tab<br />
Figure 2-9: Move to Library Window<br />
You can now observe that a new VHDL library, drp_tb_lib, contains the VHDL package<br />
file drp_tb_pkg.vhd. (Refer to Figure 2-10.)<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 21<br />
UG682 (v 12.3) September 21, 2010
Chapter 2: Running <strong>ISim</strong> from <strong>ISE</strong> Project Navigator<br />
X-Ref Target - Figure 2-10<br />
Launching a Behavioral Simulation<br />
Now that the <strong>ISE</strong> project has been created for the tutorial design, we can proceed to set up<br />
and launch a behavioral simulation using <strong>ISim</strong>.<br />
Setting Behavioral Simulation Properties<br />
Figure 2-10: Source Libraries<br />
Follow these steps to set behavioral simulation properties in <strong>ISE</strong>:<br />
1. <strong>In</strong> the Design Panel, select Behavioral Simulation from the dropdown list.<br />
2. Select the tutorial design test bench file, drp_demo_tb.<br />
You should now see the simulation processes available for the design in the Processes<br />
pane. (Refer to Figure 2-11)<br />
22 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
X-Ref Target - Figure 2-11<br />
Simulating the Design<br />
3. Right-click Simulate Behavioral Model under the <strong>ISim</strong> <strong>Simulator</strong> process and select<br />
Properties. The <strong>ISim</strong> Properties dialog box displays (Refer to Figure 2-12).<br />
<strong>In</strong> this window you can set different simulation properties, such as simulation<br />
runtime, waveform database file location, and even a user-defined simulation<br />
command file to launch the simulation.<br />
For the purposes of this tutorial, we will disable the feature that runs the simulation for<br />
a specified amount of time.<br />
4. <strong>In</strong> the <strong>ISim</strong> Properties dialog box, uncheck the property Run for Specified Time, and<br />
click OK. (Refer to Figure 2-12.)<br />
X-Ref Target - Figure 2-12<br />
Figure 2-11: Process Pane<br />
Figure 2-12: <strong>ISim</strong> Properties Dialog Box<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 23<br />
UG682 (v 12.3) September 21, 2010
Chapter 2: Running <strong>ISim</strong> from <strong>ISE</strong> Project Navigator<br />
X-Ref Target - Figure 2-13<br />
Launching Behavioral Simulation<br />
What’s Next?<br />
You are now ready to launch the <strong>ISE</strong> <strong>Simulator</strong> to perform a behavioral simulation of the<br />
tutorial design. To launch the simulator:<br />
<strong>In</strong> the Processes panel, double-click Simulate Behavioral Model.<br />
The <strong>ISim</strong> Graphical User <strong>In</strong>terface (GUI) (Figure 2-13) will appear shortly after the design<br />
is successfully parsed and compiled.<br />
Figure 2-13: <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
Continue on to Chapter 4, Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface to learn more about the<br />
<strong>ISim</strong> GUI features, and tools for analyzing and debugging HDL designs.<br />
24 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
Running <strong>ISim</strong> Standalone<br />
Overview of <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>) Standalone Flow<br />
Getting Started<br />
Chapter 3<br />
You can use the <strong>ISim</strong> standalone flow to simulate your design without setting up a project<br />
in <strong>ISE</strong>® Project Navigator. <strong>In</strong> this flow, you:<br />
Prepare the simulation project by manually creating an <strong>ISim</strong> project file in order to<br />
create a simulation executable using fuse.<br />
Start the <strong>ISim</strong> Graphical User <strong>In</strong>terface (GUI) by running the simulation executable<br />
generated by fuse.<br />
Software Requirements<br />
To use this tutorial, you must install one of the following software:<br />
<strong>ISE</strong> WebPACK 12.3<br />
One of the <strong>ISE</strong> Design Suite 12.3 Editions (Logic, DSP, Embedded, System)<br />
For more information about installing <strong>Xilinx</strong> software, see the <strong>Xilinx</strong> <strong>ISE</strong> Design Suite:<br />
<strong>In</strong>stallation, Licensing, and Release Notes.<br />
<strong>In</strong>stalling the <strong>Tutorial</strong> Design Files<br />
Design files for this tutorial are available from the <strong>Tutorial</strong>s page on the <strong>Xilinx</strong> Website.<br />
Download the tutorial design zip file from the website.<br />
Unzip the design files into an easily accessible directory with full read and write<br />
permissions.<br />
The contents of the tutorial design files are as follows:<br />
Table 3-1: <strong>Tutorial</strong> Design Files<br />
Folder Description<br />
sources<br />
Contains all the HDL files necessary for a functional<br />
simulation of the design.<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 25<br />
UG682 (v 12.3) September 21, 2010
Chapter 3: Running <strong>ISim</strong> Standalone<br />
Design Description<br />
Functional Blocks<br />
Table 3-1: <strong>Tutorial</strong> Design Files<br />
Folder Description<br />
scripts<br />
completed<br />
The tutorial design is a simple demonstration of the Dynamic Reconfiguration feature of<br />
the Virtex®-5 Digital Clock Manager (DCM).<br />
Using the Virtex-5 DCM, the design generates an output clock using the following<br />
relationship:<br />
Output Clock = <strong>In</strong>put Clock * (Multiplier / Divider)<br />
Using the Dynamic Reconfiguration Ports (DRP) in the DCM, the design allows you to<br />
re-define the Multiplier and Divider parameters to generate different output frequencies.<br />
The tutorial design consists of the following functional blocks.<br />
drp_dcm (drp_dcm.vhd)<br />
Virtex-5 DCM macro with internal feedback, frequency controlled output, duty-cycle<br />
correction, and Dynamic Reconfiguration ability.<br />
The CLKFX_OUT output provides a clock that is defined by the following relationship:<br />
CLKFX_OUT = CLKIN_IN * (Multiplier/Divider)<br />
For example, using a 100 MHz input clock, setting the Multiplier factor to 6, and Divider<br />
factor to 5, produces a 120 MHz CLKFX_OUT output clock.<br />
Using the DRP ports of the DCM, the Multiplier (M) and Divider (D) parameters can be<br />
dynamically redefined to produce different CLKFX_OUT frequencies. For the purposes of<br />
this tutorial, it suffices to show how the Multiply and Divide parameters are provided to<br />
the DCM via the 16-bit wide DI_IN port:<br />
DI_IN[15:8] = M – 1<br />
DI_IN[7:0] = D – 1<br />
For example, for an M/D factor of 6 / 5, DI_IN = 0504h.<br />
drp_stmach (drp_stmach.vhd)<br />
Contains incomplete script files to run the simulation.<br />
These script files will be completed as you go through the<br />
tutorial.<br />
Contains completed script, simulation and wave<br />
configuration files, as well as a completed <strong>ISE</strong> 12 project of<br />
the tutorial design, for comparison purposes.<br />
This module describes a Dynamic Reconfiguration Controller. The DRP controller asserts<br />
and monitors the DCM DRP signals in order to perform a dynamic reconfiguration cycle.<br />
A dynamic reconfiguration cycle is started by asserting the drp_start signal. Following this<br />
step, the DRP Controller asserts the appropriate DCM DRP pins in order to complete a full<br />
Dynamic Reconfiguration cycle.<br />
26 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
Preparing the Simulation<br />
Signal drp_done indicates a successful completion of a dynamic reconfiguration cycle.<br />
drp_demo (drp_demo.vhd)<br />
This is the top module of the tutorial design which connects the DCM macro and the DRP<br />
controller modules to the external I/O ports.<br />
drp_demo_tb (drp_demo_tb.vhd)<br />
Self-checking HDL test bench. Refer to Design Self-Checking Test Bench for more<br />
information.<br />
Design Self-Checking Test Bench<br />
Preparing the Simulation<br />
To test the functionality of this design, a self-checking test bench has been provided. (Refer<br />
to source file drp_demo_tb.vhd in the sources/ folder.) A self-checking test bench<br />
contains a validation routine or function that compares sampled values from the<br />
simulation against expected results. The self-checking test bench provided for this design<br />
performs the following functions.<br />
Generates a 100 MHz input clock for the design system clock (clk_in).<br />
Performs four different tests in order to dynamically change the output frequency of<br />
the design. <strong>In</strong> each test, a DRP cycle is started (using the drp_start signal) to set the<br />
output clock to a different frequency. The following table shows the desired output<br />
frequency and Multiplier/Divider parameters used for each test.<br />
Table 2-1: Desired Output Frequency and Multiplier/Divider Parameters Used For<br />
Each Test<br />
Test Freq. (MHz) Period (ps) Multiplier (M) Divider (D)<br />
1 75 13,332 3 4<br />
2 120 8,332 6 5<br />
3 250 4000 5 2<br />
4 400 2,500 4 1<br />
<strong>In</strong> each test, the test bench compares the expected clock period and the clock period<br />
measured during simulation. Based on the comparison results, messages are written<br />
to the simulator indicating success or failure.<br />
Upon completion of the simulation, a summary report provides a list of tests, both<br />
passed or failed.<br />
For more details on the functionality of this design, refer to the in-line comments included<br />
in the sources of the design.<br />
The <strong>ISim</strong> standalone flow enables you to to simulate your design without setting up a<br />
project in <strong>ISE</strong> Project Navigator. <strong>In</strong> this flow, you will manually create an <strong>ISim</strong> project file<br />
which fuse will use to create a simulation executable. Following completion of this step,<br />
the <strong>ISim</strong> Graphical User <strong>In</strong>terface (GUI) can be launched by running the simulation<br />
executable.<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 27<br />
UG682 (v 12.3) September 21, 2010
Chapter 3: Running <strong>ISim</strong> Standalone<br />
Creating an <strong>ISim</strong> Project File<br />
The typical syntax for an <strong>ISim</strong> project file is as follows:<br />
where:<br />
verilog|vhdl {.v|.vhd}<br />
verilog|vhdl indicates that the source is a Verilog or VHDL file. <strong>In</strong>clude either<br />
verilog or vhdl.<br />
indicates the library that a particular source on the given line<br />
should be compiled. work is the default library.<br />
is the source file or files associated with the library.<br />
Note: While one or more Verilog source files can be specified on a given line, only one VHDL source<br />
can be specified on a given line.<br />
Complete the following steps to build an <strong>ISim</strong> project file for the tutorial design:<br />
1. Browse to the scripts/ folder from the downloaded files.<br />
2. Open the simulate_isim.prj project file with a text editor.<br />
The project file is incomplete.<br />
3. List the missing sources using the syntax guidelines shown above.<br />
Missing sources:<br />
drp_dcm.vhd: VHDL source file. It should be compiled to work library.<br />
drp_tb_pkg.vhd: VHDL package file. It should be compiled to drp_tb_lib<br />
library.<br />
Note: You do not need to list the sources based on their order of dependency. fuse<br />
automatically resolves the order of dependencies and processes the files in the appropriate<br />
order.<br />
For comparison purposes, you can browse to the completed/ folder of the tutorial<br />
files for a completed version of the project file.<br />
4. Save and close the file.<br />
Building the Simulation Executable<br />
<strong>In</strong> this simulation step, fuse will use the project file created in the previous section to<br />
parse, compile and link all the sources for the design. Following completion of these steps,<br />
a simulation executable will be created which will enable you to run the simulation in the<br />
<strong>ISim</strong> GUI.<br />
Using fuse<br />
The typical fuse syntax is as follows:<br />
where:<br />
fuse –incremental –prj -o <br />
<br />
-incremental: requests fuse to compile only the files that have changed since<br />
the last compile<br />
-prj: specifies an <strong>ISim</strong> project file to use for input<br />
-o: specifies the name of the simulation executable output file<br />
28 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
Preparing the Simulation<br />
: specifies the top design unit<br />
Complete the following steps to parse, compile and elaborate the tutorial design using<br />
fuse:<br />
1. Browse to the folder scripts/ from the downloaded files.<br />
2. Open the fuse_batch.bat batch file using a text editor.<br />
3. This fuse command is incomplete. Using the syntax information provided above, edit<br />
the command line so it includes the following options:<br />
a. Use incremental compilation.<br />
b. Use simulate_isim.prj as the project file.<br />
c. Use simulate_isim.exe as the simulation executable.<br />
d. Use work.drp_demo_tb as the top design unit for simulation.<br />
4. Save and close the batch file.<br />
5. Double-click the fuse_batch.bat file to run fuse.<br />
Once fuse completes compiling source code, elaborating design units, and linking the<br />
object code, a simulation executable (simulate_isim.exe) should be present in the<br />
scripts folder.<br />
For comparison purposes, you can browse to the completed/ folder for a completed<br />
version of the fuse batch file.<br />
Simulating the Design<br />
<strong>In</strong> this simulation step you will launch the <strong>ISim</strong> GUI by running the simulation executable<br />
which was generated by the fuse tool in the previous section, Building the Simulation<br />
Executable. After this step is complete, you will be able to use the <strong>ISim</strong> GUI to explore the<br />
design in more detail.<br />
Running the Simulation Executable<br />
The typical syntax used when launching the simulation executable is as follows:<br />
where:<br />
Simulation_executable –gui –view -wdb<br />
<br />
-gui: launches <strong>ISim</strong> in GUI mode.<br />
-view: opens the specified waveform file in the <strong>ISim</strong> GUI.<br />
-wdb: specifies the file name of the simulation database output file.<br />
Complete the following steps to launch the simulation:<br />
1. Browse to the scripts/ folder from the downloaded files.<br />
2. Open the simulate_isim.bat batch file using a text editor. The batch file is<br />
intentionally blank.<br />
3. Using the syntax information provided above, edit the batch file so it includes the<br />
following settings:<br />
a. Simulation Executable name: simulate_isim.exe.<br />
b. Launch in GUI mode.<br />
c. Set simulation database output name to simulate_isim.wdb.<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 29<br />
UG682 (v 12.3) September 21, 2010
Chapter 3: Running <strong>ISim</strong> Standalone<br />
What’s Next?<br />
Note: A wave configuration file is not provided in the tutorial files. This file will be created<br />
4. Save and close the file.<br />
5. Double-click the simulate_isim.bat file to run the simulator.<br />
The <strong>ISim</strong> GUI will now open and load the design. The simulator time will remain at 0 ns<br />
until you specify a run time.<br />
For comparison purposes, you can browse to the completed/ folder for a completed<br />
version of the simulate_isim.bat batch file.<br />
Continue on to Chapter 4, Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface to learn more about the<br />
<strong>ISim</strong> GUI features, and tools for analyzing and debugging HDL designs.<br />
30 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
Chapter 4<br />
Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
Overview of the <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>) Graphical User <strong>In</strong>terface<br />
X-Ref Target - Figure 4-1<br />
The <strong>ISim</strong> Graphical User <strong>In</strong>terface (GUI) contains the wave window, toolbars, panels, and<br />
the status bar. <strong>In</strong> the main window, you can view the simulation-visible parts of the design,<br />
add and view signals in the wave window, utilize <strong>ISim</strong> commands to run simulation,<br />
examine the design, and debug as necessary.<br />
Figure 4-1: <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 31<br />
UG682 (v 12.3) September 21, 2010
Chapter 4: Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
Exploring the User <strong>In</strong>terface<br />
Main Toolbar<br />
X-Ref Target - Figure 4-2<br />
The toolbars available in the <strong>ISim</strong> main window consists of many functionally different<br />
toolbars. Each of these toolbars offers access to frequently used commands:<br />
File and Edit menu commands<br />
Window and View menu commands<br />
Simulation menu commands<br />
The main window toolbar icons are located near the top of the user interface.<br />
<strong>In</strong>stances and Processes Panel<br />
X-Ref Target - Figure 4-3<br />
Figure 4-2: Main Toolbar<br />
Figure 4-3: <strong>In</strong>stances and Processes Panel<br />
The <strong>In</strong>stances and Processes panel displays the block (instance and process) hierarchy<br />
associated with the wave configuration open in the Wave window. <strong>In</strong>stantiated and<br />
elaborated entities/modules are displayed in a tree structure, with entity components<br />
being ports, signals and other entities/modules.<br />
32 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
Source Files Panel<br />
X-Ref Target - Figure 4-4<br />
Overview of the <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>) Graphical User <strong>In</strong>terface<br />
The Source Files panel displays the list of all the files associated with the design. The list of<br />
files is provided by the fuse command during design parsing and elaboration, which is<br />
run in the background for GUI users. The HDL source files are available for quick access to<br />
the read-only source code.<br />
Objects Panel<br />
X-Ref Target - Figure 4-5<br />
Figure 4-4: Sources Files Panel<br />
Figure 4-5: Objects Panel<br />
The Objects panel displays all ports and signals associated with the selected instances and<br />
processes in the <strong>In</strong>stances and Processes panel.<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 33<br />
UG682 (v 12.3) September 21, 2010
Chapter 4: Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
X-Ref Target - Figure 4-6<br />
At the top of the panel, the Simulation Objects displays which instance/process is selected<br />
in the <strong>In</strong>stances and Processes panel and the corresponding objects and their values are<br />
listed in the Objects panel.<br />
The table columns are defined as follows:<br />
Wave Window<br />
Object Name - Displays the name of the signal, accompanied by the symbol which<br />
represents the type of object it is.<br />
Value - The value of the signals at the current simulation time or at the main cursor, as<br />
determined by the Sync Time toolbar button.<br />
Data Type - Displays the data type of the corresponding simulation object, logic or an<br />
array.<br />
Figure 4-6: Wave Window<br />
The Wave window displays signals, buses and their waveforms. Each tab in the Wave<br />
window represents a wave configuration, which consists of a list of signals and buses, their<br />
properties, and any added wave objects, such as dividers, cursors, and markers.<br />
<strong>In</strong> the user interface, the signals and buses in the wave configuration are traced during<br />
simulation, and therefore, the wave configuration is used to drive the simulation and to<br />
then examine the simulation results. Since design and simulation data are contained in a<br />
database, simulation data is not affected when adding signals to- or removing signals from<br />
the wave configuration.<br />
34 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
X-Ref Target - Figure 4-7<br />
Text Editor<br />
Overview of the <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>) Graphical User <strong>In</strong>terface<br />
The text editor window is available for easy access to the HDL source files used in the<br />
simulation. Basic steps available are:<br />
Opening HDL source files (read-only mode)<br />
Viewing HDL source files<br />
Setting breakpoints to source files for debugging<br />
Stepping through the source code<br />
Breakpoints Panel<br />
X-Ref Target - Figure 4-8<br />
Figure 4-7: Text Editor<br />
Figure 4-8: Breakpoints Panel<br />
The Breakpoints panel displays a list of all breakpoints currently set in the design. For each<br />
breakpoint set in your source files, the list in the Breakpoints panel identifies the file<br />
location, file name and line number. You can delete a selection, delete all breakpoints, and<br />
go to the source code from the Breakpoint panel toolbar buttons or context menu.<br />
For more information, see Chapter 4, “Debugging the Design” in the <strong>ISim</strong> User Guide.<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 35<br />
UG682 (v 12.3) September 21, 2010
Chapter 4: Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
Console Panel<br />
X-Ref Target - Figure 4-9<br />
Examining the Design<br />
Adding Signals<br />
Figure 4-9: Console Panel<br />
The Console panel enables you to view a log of messages generated by <strong>ISim</strong>, and to enter<br />
standard Tcl and <strong>ISim</strong>-specific commands at the command prompt.<br />
<strong>In</strong> this section, you will perform several steps to further analyze the functional behavior of<br />
the tutorial design. These include:<br />
Running and restarting the simulation to review the design functionality, using<br />
signals in the wave window and messages from the test bench shown in the Console<br />
panel.<br />
Adding signals from the test bench and other design units to the Wave window so<br />
their status can be monitored.<br />
Adding groups and dividers in order to better identify signals in the Wave window<br />
Changing signal and Wave window properties to better interpret and review the<br />
signals in the Wave window.<br />
Using markers and cursors to highlight key events in the simulation and to perform<br />
zoom and time measurement features.<br />
Using multiple Wave window configurations to further enhance your ability to<br />
review multiple signals in one simulation session.<br />
Note: Skip this step if you completed Chapter 2, Running <strong>ISim</strong> from <strong>ISE</strong> Project Navigator. All<br />
visible simulation objects from the test bench have been added to the Wave window.<br />
Prior to running simulation for a specified time, you must add signals to the Wave window<br />
in order to observe the signal status.<br />
You will add all available simulation objects from the test bench to the Wave window,<br />
which include:<br />
<strong>In</strong>put Clock (clk_in): This is a 100 MHz clock generated by the test bench and will be<br />
the input clock into the Digital Clock Manager (DCM).<br />
Dynamic Reconfiguration Ports (DRP) (drp_*): These are signals associated with the<br />
DCM DRP feature. The test bench asserts and monitors these signals to control and<br />
review the DCM DRP functionality.<br />
DCM Output signals (dcm_*): These are output clocks from the DCM.<br />
36 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
Examining the Design<br />
To add these signals to the Wave window:<br />
1. <strong>In</strong> the <strong>In</strong>stances and Processes panel, right-click the drp_demo_tb instance unit.<br />
2. Select Add to Wave Window. (Refer to Figure 4-10).<br />
X-Ref Target - Figure 4-10<br />
All visible simulation objects from the drp_demo_tb test bench will now show up in the<br />
Wave windw. (Refer to Figure 4-11).<br />
X-Ref Target - Figure 4-11<br />
Figure 4-10: Add to Wave Window<br />
Figure 4-11: Wave Window<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 37<br />
UG682 (v 12.3) September 21, 2010
Chapter 4: Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
X-Ref Target - Figure 4-14<br />
Running the Simulation for a Specified Time<br />
You can now run the simulator for a specified time. Run the simulation for 5 microseconds<br />
(us).<br />
1. <strong>In</strong> the <strong>ISim</strong> menu toolbar, type 5 us in the Simulation Time field and press Enter.<br />
(Refer to Figure 4-12).<br />
Note: <strong>In</strong>stead of pressing Enter, you can click the Run For toolbar button .<br />
X-Ref Target - Figure 4-12<br />
Note: You can also type run 5 us at the Tcl prompt (refer to Figure 4-13), and press Enter.<br />
X-Ref Target - Figure 4-13<br />
Figure 4-12: Simulation Time Field<br />
Figure 4-13: <strong>ISim</strong> Tcl Prompt<br />
The wave window now shows traces of the signals up to 5 microseconds in simulation<br />
time (Refer to Figure 4-14).<br />
Figure 4-14: Wave Window<br />
38 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
Examining the Design<br />
2. To display the full time spectrum in the Wave window, select<br />
Edit > Zoom > Zoom Full View or click the Zoom Full View button .<br />
3. You can use the horizontal and vertical scroll bars to view the full wave configuration.<br />
4. There are assertions from the test bench during the time of simulation. Review the<br />
Console panel for messages from the test bench (Refer to Figure 4-15).<br />
.<br />
X-Ref Target - Figure 4-15<br />
Restarting the Simulation<br />
Figure 4-15: Console Panel<br />
1. Before you continue, restart the simulation to clear the Wave window and set the<br />
simulation time to 0 picoseconds (ps).<br />
To restart the simulation, either:<br />
Click the Restart button in the menu toolbar<br />
Run menu command Simulation > Restart.<br />
Type restart at the Tcl prompt.<br />
The wave window should look like the one shown in Figure 4-16.<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 39<br />
UG682 (v 12.3) September 21, 2010
Chapter 4: Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
X-Ref Target - Figure 4-16<br />
Adding Groups<br />
Figure 4-16: Wave Window<br />
<strong>In</strong> the next section, you will be analyzing the simulation of the tutorial design in more<br />
detail using features from the Wave window, such as dividers, groups, cursors and<br />
markers.<br />
<strong>In</strong> the next steps, you will be adding signals from other design units in order to better<br />
analyze the functionality of this design. However, soon after you add additional signals to<br />
the wave window, the size of the wave window will not be large enough to display all<br />
signals in the same view. Reviewing all signals would require the use of the vertical scroll<br />
bar in the Wave window repeatedly, making the review process rather tedious.<br />
We can remedy this situation by collecting signals into a group. With a group, you can<br />
collectively show or hide signals of similar purpose.<br />
To group signals in the wave configuration:<br />
1. Click and hold the Ctrl key, and select signals of similar purpose in the Wave window.<br />
2. Right-click any selected signal and select New Group.<br />
3. Type a name for the group, such as DRP Test Signals.<br />
4. A collapsed group will be created in the Wave window. To expand the group, click<br />
once to the left of the group name.<br />
Use the instructions above to make groups for the following signals:<br />
1. All signals in the drp_demo_tb design unit that start with “drp_”. Name the group<br />
“DRP Test Signals”.<br />
2. All signals in the drp_demo_tb design unit that start with “dcm_”. Name the group<br />
“DCM Test Signals”.<br />
3. Expand all the created groups. Your wave window should be similar to the one shown<br />
in Figure 4-17.<br />
40 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
X-Ref Target - Figure 4-17<br />
Adding Dividers<br />
Figure 4-17: Adding Groups<br />
Examining the Design<br />
Note: If your signal groups do not match the figure shown above, you can use the following<br />
techniques to fix them:<br />
If you included an unrelated signal, use cut and paste to move it into the main list.<br />
If you created the group but missed a signal in the main list, use drag and drop to<br />
move the signal into the group. The signal will then be placed inside the group.<br />
You can undo the group using the Edit > Undo menu command.<br />
You can start over by ungrouping a group. Right-click on the group and select<br />
Ungroup.<br />
Soon you will be adding signals from other design units in order to better analyze the<br />
functionality of this design. To better visualize which signals belong to which design units,<br />
you can add dividers to separate the signals by design unit.<br />
To add dividers to the Wave window:<br />
1. Right-click anywhere on the Wave window and select New Divider.<br />
2. Enter a name for the divider.<br />
3. Use the instructions above to add three dividers named:<br />
TEST BENCH<br />
DCM<br />
DRP CONTROLLER<br />
4. Move the TEST BENCH divider to the top of the list by clicking the divider name and<br />
holding the mouse button down while moving the cursor to the top of the list.<br />
5. Move the other dividers to the bottom of the list.<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 41<br />
UG682 (v 12.3) September 21, 2010
Chapter 4: Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
Note: Divider names can be changed at any time by double-clicking on the divider name or pressing<br />
the F2 function key, and entering a new name.<br />
Your Wave window should be similar to the one shown in Figure 4-18 (with Groups<br />
collapsed).<br />
X-Ref Target - Figure 4-18<br />
Adding Signals from Sub-Modules<br />
Figure 4-18: Adding Dividers<br />
You will now add signals from the instantiated DCM module (<strong>In</strong>st_drp_dcm) and the<br />
instantiated DRP controller module (<strong>In</strong>st_drp_statmach) in order to study the<br />
interactions between these sub-modules and the test bench test signals.<br />
Follow these steps to add the necessary signals:<br />
1. <strong>In</strong> the <strong>In</strong>stances and Processes panel, expand the hierarchy by clicking once to the left<br />
of each child module (refer to Figure 4-19).<br />
2. Simulation objects associated with the currently highlighted design unit will appear in<br />
the Objects panel (refer to Figure 4-20).<br />
42 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
X-Ref Target - Figure 4-19<br />
X-Ref Target - Figure 4-20<br />
Figure 4-19: <strong>In</strong>stances and Process Panel<br />
Figure 4-20: Simulation Objects Panel<br />
Examining the Design<br />
3. Add all input and output ports from the <strong>In</strong>st_drp_dcm design unit instantiation to<br />
the Wave window. To do so, do one of the following:<br />
Select the <strong>In</strong>st_drp_dcm design unit in the <strong>In</strong>stance and Process panel to<br />
highlight it. Then in the Objects panel, right-click on the input/output ports and<br />
select Add to Wave Window (Refer to Figure 4-21).<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 43<br />
UG682 (v 12.3) September 21, 2010
Chapter 4: Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
X-Ref Target - Figure 4-21<br />
X-Ref Target - Figure 4-22<br />
Figure 4-21: Add to Wave Window<br />
Click and hold the Ctrl key, and select the input/output ports of the<br />
<strong>In</strong>st_drp_dcm design unit. Then, drag and drop the signals to the Wave<br />
window.<br />
Type wave add Tcl command at the <strong>ISim</strong> Tcl prompt. For example:<br />
wave add /drp_demo_tb/uut/inst_drp_dcm<br />
Note: By default, all types of simulation objects (variables, constants, etc.) are displayed in the<br />
Objects panel. You can filter the type of simulation objects shown in this panel. Use the Objects<br />
panel toolbar to filter by inputs, outputs, bi-directional, internal, constants and variables. Toggle<br />
the desired object type by clicking on the corresponding button.<br />
Figure 4-22: <strong>In</strong>puts, Outputs, Bi-Directional, <strong>In</strong>ternal, Constants and Variables<br />
4. You can move the recently added signals if they do not appear directly under the DCM<br />
divider.<br />
a. Click and hold Ctrl+Shift, click once on the first added DCM signal (clk_in) and<br />
the last added DCM signal (gnd_bit).<br />
b. Once all signals are selected, move the signals under the DCM divider by holding<br />
the mouse button and placing the mouse cursor right under the divider name.<br />
5. Repeat the steps above for input/output ports of <strong>In</strong>st_drp_statmach instantiated<br />
design unit.<br />
6. Additionally, you can also create groups for the signals recently added. Using the<br />
instructions provided for adding groups, define groups “<strong>In</strong>puts”, “<strong>In</strong>ternal”, and<br />
“Outputs” for each set of signals recently added.<br />
Note: Use the object icon to the left of the signal name to determine the type of the simulation object<br />
(Figure 4-23).<br />
44 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
X-Ref Target - Figure 4-23<br />
Examining the Design<br />
Your Wave window should be similar to the one shown in Figure 4-24 (with groups<br />
collapsed).<br />
X-Ref Target - Figure 4-24<br />
Figure 4-23: Signals and Icons<br />
Figure 4-24: Configuring the Wave Window<br />
Changing Signal and Wave Window Properties<br />
Next, you will change the properties of some of the signals currently shown in the Wave<br />
window in order to better visualize the behavioral simulation.<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 45<br />
UG682 (v 12.3) September 21, 2010
Chapter 4: Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
Changing the Signal Name Format<br />
By default, <strong>ISim</strong> adds signals to the waveform using the short name (the hierarchy<br />
reference removed). For some signals, it is important to know which module they belong<br />
to.<br />
To change the signal name format:<br />
1. <strong>In</strong> the wave window, right-click on the signal name, listed under the Name column.<br />
2. Select Name > Long (Refer to Figure 4-25).<br />
X-Ref Target - Figure 4-25<br />
Note: You can perform a format change on multiple signals with fewer clicks by:<br />
Selecting multiple signals using Ctrl+Shift.<br />
Applying the format change via the right-click context menu.<br />
Use the instructions above to change the format of the following bus signals from “Short”<br />
to “Long”, listed under the DRP Test Signals group:<br />
drp_multiply<br />
drp_divide<br />
Changing the Signal Radix Format<br />
Some signals are better interpreted if seen in hexadecimal rather than in binary. For<br />
example, the signals drp_multiply and drp_divide are bus signals that are best<br />
interpreted in hexadecimal format, rather than binary.<br />
To change the radix of a signal:<br />
1. <strong>In</strong> the wave window, right-click on the signal name, listed under the Name column.<br />
2. Select Radix, then the radix type you wish to interpret the signal in (Refer to<br />
Figure 4-26).<br />
X-Ref Target - Figure 4-26<br />
Using the instructions above, change the format of the following signals from “Binary” to<br />
“Hexadecimal”:<br />
drp_demo_tb/drp_multiply<br />
drp_demo_tb/drp_divide<br />
Changing the Signal Color<br />
Figure 4-25: Change the Signal Name Format<br />
Figure 4-26: Changing the Radix of a Signal<br />
<strong>ISim</strong> allows you to change the signal color in the Wave window to help you quickly<br />
identify similar signals from each other.<br />
46 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
Examining the Design<br />
To change the color of a signal:<br />
1. <strong>In</strong> the Wave window, right-click a signal name in the Name column.<br />
2. Select Signal Color, and pick a color from the color palette or a custom color by<br />
clicking on the ellipsis (…) button (Refer to Figure 4-27).<br />
X-Ref Target - Figure 4-27<br />
Using the instructions above, change the format of the following signals from their default<br />
color to a color of your choice:<br />
drp_demo_tb/drp_multiply<br />
drp_demo_tb/drp_divide<br />
Floating the Wave Window<br />
Depending on your screen resolution, you may notice that the wave window has been<br />
populated with more signals than the screen can view at one time. To alleviate this<br />
problem, we can increase the viewable area by floating the wave window. Following this<br />
step will open a new window with just the waveform contents.<br />
To float a window, do one of the following:<br />
While highlighting an object in the Wave window, select Window > Float.<br />
Click the Float Window main toolbar button.<br />
X-Ref Target - Figure 4-28<br />
X-Ref Target - Figure 4-29<br />
Figure 4-27: Changing the Signal Color<br />
Figure 4-28: Selecting Float from the View Menu<br />
Right-click the wave configuration name tab and select Float.<br />
Figure 4-29: Selecting Float from the Wave Configuration Name Tab<br />
You are done making modifications to the Wave window. The Wave window should now<br />
look similar to Figure 4-30 when test bench groups are expanded.)<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 47<br />
UG682 (v 12.3) September 21, 2010
Chapter 4: Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
X-Ref Target - Figure 4-30<br />
Saving the Wave Window Configuration<br />
You can save the current state of the Wave window (wave configuration) so it is available<br />
for use in future <strong>ISim</strong> simulation sessions of your design.<br />
To save the wave configuration:<br />
1. Select File > Save As to assign a name to the current wave configuration (Refer to<br />
Figure 4-31).<br />
X-Ref Target - Figure 4-31<br />
Figure 4-30: Fully Configured Floating Wave Window<br />
Figure 4-31: Saving the Wave Window Configuration<br />
2. Save the current wave configuration to the filename tutorial_1.wcfg.<br />
The wave configuration is now saved for future use.<br />
48 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
X-Ref Target - Figure 4-32<br />
Examining the Design<br />
Note: You can load the saved Wave window configuration using the menu command File > Open.<br />
This feature is useful when you have set up a wave configuration that you will reuse in future<br />
simulation sessions of the design.<br />
Simulation the Design<br />
Using Markers<br />
You are ready to simulate the design again with the updated wave configuration. Re-run<br />
the simulation by either:<br />
Click the Run All toolbar button .<br />
Select Simulation > Run All.<br />
Type run all at the Tcl prompt.<br />
The simulation will run for about 13 microseconds (us).<br />
After the simulation is complete, use the menu toolbar button to zoom to full view.<br />
The wave configuration should look similar to Figure 4-32.<br />
Figure 4-32: Wave Window After 13 us Simulation Time<br />
The self-checking test bench used in this design performs four different tests to showcase<br />
the functionality of the DCM Dynamic Reconfiguration feature. Follow the next steps to<br />
use markers to mark each time a new test has started.<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 49<br />
UG682 (v 12.3) September 21, 2010
Chapter 4: Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
1. <strong>In</strong> the Console panel, identify the simulation times when each test has started. For<br />
example, Test 2 starts at about 3.46 microseconds (3,461,664 ps), as shown by this<br />
segment of the <strong>ISim</strong> Console:<br />
X-Ref Target - Figure 4-33<br />
2. From the <strong>ISim</strong> main menu, select Edit > Go To and enter 1150 ns in the Go To Time<br />
field to move the main (yellow) cursor to the first test bench test.<br />
X-Ref Target - Figure 4-34<br />
X-Ref Target - Figure 4-35<br />
Figure 4-33: Console Window<br />
Figure 4-34: Edit > Go To<br />
Figure 4-35: Go To Time<br />
3. <strong>In</strong> the Wave window, add a marker at this time. To add a marker, either:<br />
Click the Add Marker toolbar button .<br />
Select Edit > Markers > Add Marker.<br />
4. Repeat these steps for all four tests performed by the test bench. The Wave window<br />
should look similar to Figure 4-36.<br />
50 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
X-Ref Target - Figure 4-36<br />
Using Cursors<br />
The <strong>ISim</strong> Console reports that Test 2 and Test 4 failed (Figure 4-37).<br />
X-Ref Target - Figure 4-37<br />
Figure 4-36: Using Markers to Identify Start of Tests<br />
Figure 4-37: Console Report Test 2 and Test 4 Failed<br />
Examining the Design<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 51<br />
UG682 (v 12.3) September 21, 2010
Chapter 4: Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
<strong>In</strong> Test 2 and 4, a Dynamic Reconfiguration (DRP) write cycle is performed in order to<br />
change the multiply and divide factors of the Digital Frequency Synthesizer and set new<br />
clock output (CLKFX) frequencies (120 MHz and 400 MHz, respectively). However, at the<br />
end of the DRP cycle, the test bench measured a period that did not match the expected<br />
period. Tests 2 and 4 fail due to the period discrepancy (Figure 4-38, Figure 4-39).<br />
X-Ref Target - Figure 4-38<br />
X-Ref Target - Figure 4-39<br />
<strong>In</strong> the next few steps, you will use the <strong>ISim</strong> main cursor (yellow cursor) to zoom in the<br />
wave window when one of the failing tests takes place. You will also use the cursor to<br />
measure the period of signal dcm_clkfx_out and verify that the test bench is making<br />
accurate measurements.<br />
Zooming <strong>In</strong><br />
Figure 4-38: Test 2 Fails Due To Period Discrepancy<br />
Figure 4-39: Test 4 Fails Due To Period Discrepancy<br />
First, zoom in where Test 2 starts to review the status of output clock dcm_clkfx_out.<br />
To use a cursor for zooming in on a specific area:<br />
1. Place the cursor on the desired area using one of the following methods:<br />
Click and drag the main cursor (yellow cursor) close to the marker that represents<br />
the start of Test 2 (marker at time 3,461,664 ps). The cursor will snap onto the<br />
marker.<br />
Click the Previous Marker or Next Marker toolbar buttons to quickly<br />
move the main cursor from marker to marker.<br />
Select Edit > Go To and specify the time when Test 2 starts (time 3,461,664 ps).<br />
The main cursor will now move to this time location.<br />
52 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
X-Ref Target - Figure 4-40<br />
2. Zoom in using one of the following methods:<br />
Click the Zoom <strong>In</strong> toolbar button .<br />
Select View > Zoom > Zoom <strong>In</strong>.<br />
Press F8.<br />
The Wave window will zoom in around the area specified by the cursor.<br />
3. Use step 2 above repeatedly until you can clearly see DCM test signals<br />
dcm_clk0_out and dcm_clkfx_out toggle.<br />
Measuring Time<br />
Figure 4-40: Zooming into the Wave Window<br />
Examining the Design<br />
You can use the main cursor to measure time between two endpoints. You will use this<br />
feature to confirm the test bench calculations reported in the Console during Test 2 by<br />
measuring the period of dcm_clkfx_out after the DRP cycle has completed (signal<br />
drp_done is asserted).<br />
To measure time using cursors:<br />
1. Use the Snap to Transition toggle button<br />
edges.<br />
to easily snap the cursor on to transition<br />
2. Press and hold the left mouse button in an area around the first clock rising edge<br />
following DRP cycle completion (drp_done signal asserted). The main cursor will<br />
snap to the rising edge of dcm_clkfx_out.<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 53<br />
UG682 (v 12.3) September 21, 2010
Chapter 4: Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
X-Ref Target - Figure 4-41<br />
3. While holding the button, move the mouse over to the next clock rising edge. A second<br />
marker should appear.<br />
The time between the two defined endpoints will appear at the bottom of the wave<br />
window as a time delta (refer to Figure 4-41).<br />
Note: Use Zoom <strong>In</strong> for better performance of the time measurement feature.<br />
Figure 4-41: Measuring Time With the Measure Tool<br />
Using the cursors, we measure a 7,142 ps time difference between two rising edges of<br />
the dcm_clkfx_out output clock. This translates to a 140 MHz clock signal. Test 2<br />
fails due to the frequency discrepancy (expected is 120 MHz).<br />
4. Repeat the same steps above to analyze the Test 4 failure. You should observe that<br />
while the test bench expects a frequency of 400 MHz, the actual frequency measured is<br />
300 MHz.<br />
Note: Use the Floating Ruler feature (available from the wave window toolbar) to display a<br />
hovering ruler over the wave configuration. This feature is available when performing a time<br />
measurement using cursors between two endpoints. The zero (0 ps) on the ruler is placed at the first<br />
time endpoint. This feature is useful when making multiple time measurements with respect to the<br />
first endpoint (Figure 4-42).<br />
54 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
X-Ref Target - Figure 4-42<br />
Using Multiple Wave Configurations<br />
Examining the Design<br />
Depending on the resolution of the screen, a single Wave window may not display all the<br />
signals of interest at the same time. You can resolve this problem by opening multiple<br />
Wave windows, each with their own set of signals and signal properties.<br />
To open a new Wave window:<br />
1. <strong>In</strong> <strong>ISim</strong>, select File > New.<br />
2. <strong>In</strong> the New dialog box, select Wave Configuration and click OK (Figure 4-43).<br />
A blank wave configuration will be shown.<br />
X-Ref Target - Figure 4-43<br />
Figure 4-42: Floating Ruler Feature<br />
Figure 4-43: New Wave Configuration<br />
To move dividers, groups and simulation objects to the new wave configuration:<br />
1. Press and hold the Ctrl key, and highlight objects you want to move to the new wave<br />
window.<br />
2. Right-click any selected signals, and select Cut.<br />
3. Click the window tab for the new wave configuration, untitled 1.<br />
4. Right-click in the Name column area of the wave configuration, and select Paste.<br />
5. Use the instructions above to move all the simulation objects associated with the DCM<br />
and DRP Controller units to a new wave window (dividers, groups, etc.).<br />
6. Upon completion of this task, select File > Save As to save this wave configuration as<br />
tutorial_2.wcfg.<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 55<br />
UG682 (v 12.3) September 21, 2010
Chapter 4: Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
X-Ref Target - Figure 4-44<br />
You should now have two wave windows that should look similar to Figure 4-44 and<br />
Figure 4-45.<br />
Figure 4-44: tutorial_1.wcfg<br />
56 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
X-Ref Target - Figure 4-45<br />
Debugging the Design<br />
Debugging the Design<br />
Now that you have examined the design using markers, cursors, and multiple wave<br />
configurations, you will now use <strong>ISim</strong> debugging features, such as setting breakpoints and<br />
stepping through source code, in order to debug the design and address the two failing<br />
DRP tests.<br />
Viewing Source Code<br />
Figure 4-45: tutorial_2.wcfg<br />
First, take a look at the test bench for the tutorial design and learn how each test is<br />
performed.<br />
To open a source code (read-only mode), either:<br />
Select File > Open to point to the file of choice.<br />
<strong>In</strong> the <strong>In</strong>stances and Processes Panel, right-click on the design unit described by the<br />
source file of interest, then select Go to Source Code.<br />
<strong>In</strong> the Objects Panel, right-click on any of the simulation objects declared in the source<br />
file of choice, then select Go to Source Code.<br />
<strong>In</strong> the Source Files Panel (viewable by clicking on the “Source Files” tab), double-click<br />
a source file.<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 57<br />
UG682 (v 12.3) September 21, 2010
Chapter 4: Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
X-Ref Target - Figure 4-46<br />
Use the directions above to open the source code for the tutorial design test bench<br />
(drp_demo_tb.vhd). The source file will be opened using the integrated text editor<br />
(Refer to Figure 4-46).<br />
Using Breakpoints and Stepping<br />
A breakpoint is a user-determined stopping point in the source code used for debugging<br />
the design with <strong>ISim</strong>. When simulating a design with set breakpoints, simulation of the<br />
design stops at each breakpoint in order to verify the design behavior. Once the simulation<br />
stops, an indicator is shown in the text editor next to the line of source code where the<br />
breakpoint was set, allowing you to compare the Wave window results with a particular<br />
event in the source code.<br />
Another useful <strong>ISim</strong> debugging tool is the Stepping feature. With stepping, you can run the<br />
simulator one simulation unit at the time. This is helpful if you are interested in learning<br />
how each line of your source code affects the results in simulation.<br />
We can use both of these debugging features to learn how the DRP cycle is performed<br />
during Test 2 in an attempt to debug the failing test.<br />
Setting Breakpoints<br />
Figure 4-46: <strong>In</strong>tegrated Text Editor<br />
Begin by first setting a breakpoint around the first signal assignment performed during<br />
each of the DRP cycle tests.<br />
58 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
Debugging the Design<br />
To set a breakpoint:<br />
1. Open the source code which will contain the breakpoint.<br />
2. Go to an executable line in the source code which will contain the breakpoint.<br />
3. Add a breakpoint using one of the following methods:<br />
Right-click anywhere on the executable line and select Toggle Breakpoint.<br />
Highlight the line by performing a left-click on the line number, then from the<br />
menu, select View > Breakpoint > Toggle Breakpoint.<br />
Click the text editor toolbar breakpoint button .<br />
4. Use the instructions above to set a breakpoint at line 185 in drp_demo_tb.vhd (Refer<br />
to Figure 4-47). Doing so will cause the simulator to stop every time the signal<br />
drp_multiply is assigned a value.<br />
X-Ref Target - Figure 4-47<br />
Note: You can manage breakpoints by clicking on the Breakpoints tab (next to the Console tab). All<br />
set breakpoints will appear in this list. From here, you can:<br />
Delete selected breakpoint<br />
Delete all breakpoints<br />
Go to the line of source code for selected breakpoint<br />
X-Ref Target - Figure 4-48<br />
Figure 4-47: Setting a Breakpoint at Line 185 in drp_demo_tb.vhd<br />
Figure 4-48: Breakpoints Tab<br />
Re-run the simulation with the breakpoint enabled by following these steps:<br />
1. Bring the <strong>ISim</strong> main window into focus.<br />
Note: Debugging with the breakpoints and stepping features work best when you are able to<br />
review the console output and the Wave window at the same time. Use the Float feature of the<br />
<strong>ISim</strong> panels, or resize the windows of the simulator, to best accommodate the windows so they<br />
can be reviewed at the same time.<br />
2. To restart the simulation from the <strong>ISim</strong> menu toolbar, click the Restart button .<br />
3. To run the simulation, click the Run All button .<br />
The simulation runs near the start of the first test.<br />
Focus changes to the text editor where it shows the yellow indicator (<br />
source code the simulator executed.<br />
) at the last line of<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 59<br />
UG682 (v 12.3) September 21, 2010
Chapter 4: Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
.<br />
X-Ref Target - Figure 4-49<br />
Additionally, a message will appear in the Console indicating that the simulator has<br />
stopped, including the line of source code last executed by the simulator.<br />
We know Test 1 finishes successfully when we examined the design earlier. As such,<br />
we can skip debugging this test.<br />
4. To continue forward to Test 2, click the Run All button .<br />
The simulation now stops at the start of Test 2.<br />
X-Ref Target - Figure 4-50<br />
Stepping through Source Code<br />
Figure 4-49: The Last Line of Executed Source Code<br />
Figure 4-50: Message in the Console <strong>In</strong>dicating That the <strong>Simulator</strong> Has Stopped<br />
You first need to verify that in Test 2, the appropriate Multiplier and Divider parameters<br />
are being set correctly via the drp_multiply and drp_divide bus signals. You will use<br />
stepping to step through the source code line by line and review how the drp_multiply<br />
and drp_divide bus signals are assigned to the DCM DRP ports.<br />
To step through a simulation, either:<br />
Click on the Step toolbar button .<br />
Select Simulation > Step.<br />
Type step at the Tcl prompt.<br />
1. Use the instructions above to step through the design. As you step through the source<br />
code, pay close attention to each of these events:<br />
drp_multiply and drp_divide bus signals are assigned values from a<br />
constant test_vectors.<br />
drp_start asserts in order to start a DRP cycle.<br />
drp_multiply bus signal is assigned to the 8 uppermost bits of bus signal<br />
DI_IN, while drp_divide bus signal is assigned to the 8 lowermost bits of the<br />
same bus.<br />
The DRP controller (drp_stmach.vhd) leaves idle mode and moves to the next<br />
DRP cycle step, clearing the DCM status registers.<br />
2. <strong>In</strong> the “tutorial_2” wave window, expand the DCM <strong>In</strong>puts bus.<br />
3. Continue stepping through the simulation until the di_in bus signal is updated with<br />
a new value (you may need to zoom in considerably in order to observe the change).<br />
At around 3,465 ns, the bus should be updated from 0203h to 0604h.<br />
60 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
X-Ref Target - Figure 4-51<br />
Debugging the Design<br />
Note: Change the radix of bus signal di_in to Hexadecimal to verify this value change.<br />
Figure 4-51: Analyzing Output of DCM DI_IN <strong>In</strong>put Bus on the Wave Window<br />
4. The output clock frequency of this design (dcm_clkfx_out) is dependent on the<br />
multiply and divide factors you provide. For Test 2, we use the following parameters<br />
and expected output clock frequency:<br />
Table 4-1: Parameters and Expected Output Clock Frequency<br />
You may recall that for M=6 and D=5, di_in[15:0] bus value should be 0504h.<br />
Notice that the status of di_in in Test 2 is 0604h. Test 2 fails because an incorrect M/<br />
D factor is provided via the drp_multiply and drp_divide signals in the test<br />
bench.<br />
5. You can repeat the steps above to determine the cause of failure for Test 4. You will<br />
determine that the failure is also due to incorrect assignments of the multiply and<br />
divide signals in the test bench.<br />
Fixing Bugs in the Design<br />
Test Freq. (MHz) Period (ps) Multiplier (M) Divider (D)<br />
2 120 8,332 6 5<br />
By using breakpoints and stepping, you have determined that the incorrect multiply and<br />
divide values are assigned to the drp_multiply and drp_divide signals in the test<br />
bench.<br />
<strong>In</strong> the next steps, revise the test bench test vectors to use the correct Multiplier and Divider<br />
parameters in Tests 2 and 4.<br />
1. To close the <strong>ISE</strong> <strong>Simulator</strong>, select File > Close.<br />
Note: If changes have been made to the wave configuration before the last save, <strong>ISim</strong> prompt<br />
you to save changes prior to closing the session.<br />
2. Using a text editor (outside of <strong>ISim</strong>), open the test bench source file,<br />
drp_demo_tb.vhd.<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 61<br />
UG682 (v 12.3) September 21, 2010
Chapter 4: Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
Verifying Bug Fix<br />
3. <strong>In</strong> lines 117 through 127, test vectors for the 4 DRP tests are defined. Revise the<br />
constant declaration to read (changes highlighted in bold):<br />
------------------------------------------------<br />
-- ** TEST VECTORS **<br />
-- (Test, Frequency, Period, Multiplier, Divider)<br />
------------------------------------------------<br />
constant test_vectors : vector_array := (<br />
( 1, 75, 13332 ps, 3, 4),<br />
( 2, 120, 8332 ps, 6, 5),<br />
( 3, 250, 4000 ps, 5, 2),<br />
( 4, 400, 2500 ps, 4, 1));<br />
4. Save and close the file.<br />
Now that the test bench source code has been fixed, you need to re-compile the source code<br />
and build a new simulation executable.<br />
1. Re-launch the <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>).<br />
If you are using the <strong>ISim</strong> <strong>ISE</strong> <strong>In</strong>tegrated flow, in Project Navigator re-launch <strong>ISim</strong><br />
by double-clicking on Simulate Behavioral Model.<br />
If you are using the <strong>ISim</strong> Standalone flow, re-launch the <strong>ISE</strong> <strong>Simulator</strong> by running<br />
the fuse script, followed by the simulation executable (fuse_batch.bat and<br />
simulate_isim.bat).<br />
2. Once <strong>ISim</strong> starts, load the tutorial_1.wcfg and tutorial_2.wcfg wave<br />
configurations previously saved in Examining the Design.<br />
To load a wave window configuration:<br />
Select File > Open, and point to the wave configuration files (.wcfg).<br />
3. You are ready to simulate the design again with the updated test bench. Re-run the<br />
simulation using one of the following methods:<br />
Click the Run All toolbar button .<br />
Select Simulation > Run All.<br />
Type run all at the Tcl prompt<br />
If the test vectors in the test bench were properly revised, the simulation should run to<br />
completion, showing that all tests pass (Figure 4-52).<br />
62 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010
X-Ref Target - Figure 4-52<br />
What’s Next<br />
Figure 4-52: Console Showing That All Tests Pass<br />
Debugging the Design<br />
This completes the <strong>ISE</strong> <strong>Simulator</strong> (<strong>ISim</strong>) <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong>. Refer to the Additional<br />
Resources section in the Preface for links to more detailed information about the <strong>ISE</strong><br />
<strong>Simulator</strong>.<br />
<strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong> www.xilinx.com 63<br />
UG682 (v 12.3) September 21, 2010
Chapter 4: Using the <strong>ISim</strong> Graphical User <strong>In</strong>terface<br />
64 www.xilinx.com <strong>ISE</strong> <strong>ISim</strong> <strong>In</strong>-<strong>Depth</strong> <strong>Tutorial</strong><br />
UG682 (v 12.3) September 21, 2010