Sometime over the course of the past few weeks, I decided that it was finally time (actually quite a bit past time) to step out of the physical hardware world for a moment and learn how to work in the virtual world by means of a software simulator.
This means that, as opposed to implementing and running my designs in a physical FPGA, I will instead use a simulator to mimic what will happen when I apply stimulus to the inputs to my designs. There are a number of software simulation options available on the market, but Iím starting with what Iíve got, which is the Xilinx ISE Simulator (ISim). Step one is to make myself a pretty bad-tasting Latte (bad wasnít my intention, but thatís definitely what I ended up with today).
Xilinx has a VHDL simulation tutorial for their ISE (integrated software environment) version 12.4, which is what I have. Yes, it's true that Xilinx sponsors All Programmable Planet (APP), but that doesnít mean Iím not genuinely pleasantly surprised once again with their tutorial set -- I am.
In my experience with chip companies, most of them seem to have documentation or a tutorial for an older version of a different language on some other version of the chip I need to use. They tell you: ďSure, itís exactly the same, only a whole lot different.Ē Fortunately, I donít have to worry about that here.
The tutorial uses a Vertex-5 chip, but the only change necessary will be to select the Spartan-6 FPGA I'm currently using in the project settings. To get the tutorial documentation and files, go to: ďISE Simulator (ISim) In-Depth TutorialĒ on this web page. You'll find it just a little bit down from the top. Un-zip the design files into your Xilinx code directory and open the PDF. The tutorial covers using the simulator from within ISE (which I am going to do) and from the command-line (which I am not going to do).
As far as I can tell, the steps involved are as follows:
- Write your VHDL (or Verilog) code
- Write a testbench
- Compile everything
- Fuse it
- Run the simulation executable
The tutorial example uses the Digital Clock Manager (DCM). Iíve fiddled with the DCM before, so that concept isnít entirely alien to me. The concept of a testbench is, however, somewhat alien. Not totally though. Iíve read enough about testbenches here on APP; if I think in terms of hardware, I would assume that Iím creating hardware that will give my code specific inputs so I can examine the outputs based on those inputs.
So read the tutorial down through Page 13, as I have, and then start up ISE. Create a new project, as instructed. The "Project Settings" dialog box will differ from the tutorial, unless you happen to be using a Virtex-5 chip. For my Spartan-6 LX9, it will be as illustrated below (click here to see a larger, more detailed version of this image):
Otherwise, everything Iím doing matches the tutorial PDF... until we reach Page 22. The first step on Page 22 says: ďIn the Design Panel, select Behavioral Simulation from the dropdown list.Ē The problem is that I donít have a dropdown list as illustrated below:
Quick... did you spot my "deliberate" mistake? Iíll give you a hint; itís a pretty basic mistake. I donít know if I missed an instruction, or if the tutorial's creators simply assumed that no one could possibly mess this up, but at the top of the dialog I have the ďImplementationĒ view selected. I need to click the radio button for ďSimulationĒ to get my drop-down list to magically appear. Doing this put me back on track on Page 23 with only about a five minute delay.
The end result of the tutorial on my monitor exactly matches the screen capture in the tutorial document as illustrated below (click here to see a larger, more detailed version of this image):
This is cool, except that it means nothing to me yet. Iíve gone through all of the steps, but thus far I havenít learned anything (apart from the fact that I need to be in the ďSimulationĒ view, of course). Unfortunately, the ďhavenít learned anythingĒ refrain seems to be far too common a theme for me, but Iíll do my best to break out of this pattern soon. The tutorial doesnít actually end there. It now jumps to Chapter 4 (unless you want to go through the command-line version also).
Between now and next week, Iím going to read the remainder of the tutorial and start dissecting the various parts of this simulation system. Until then; how about a vote? Is ISim the way to go? Or is there something else that's much better out there?