Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20705 Discussions

Creating a waveform in Modelsim

Altera_Forum
Honored Contributor II
6,632 Views

Hi, 

 

I'm attempting to use Modelsim for the first time. 

 

I'm following the tutorial 'Introduction to Simulation of VHDL Designs Using ModelSim Graphical Waveform Editor' by Altera found at - ftp://ftp.altera.com/up/pub/altera_material/11.1/tutorials/vhdl/modelsim_gui_introduction.pdf 

 

Everything seems to work okay up to the point of creating the waveform on the Wave window. When i right click on an object, the 'Create Wave' option doesn't appear, as shown in the screenshot i've taken of what i see - http://s9.postimage.org/l0gv5hptb/modelsim.jpg.  

 

I assumed that they might have changed the 'Create Wave' option to 'Add Wave' but when i click this the 'Create Waveform Wizard' doesn't appear either. The object appears in the Wave window but the only waveform i'm able to produce is a clock. As i can't find a option to open the waveform wizard and it doesn't allow me to modify the clock waveform, as shown in this screen shot i've taken of what it shows in the Wave window - http://s1.postimage.org/8xs2pr5nj/modelsim_2.jpg 

 

 

I feel like i'm missing something fundamental or i haven't setup my Modelsim quite right. 

 

I'm using Quartus II V12.1 with Modelsim-Altera Starter edition V10.1b on a Windows 7 machine. 

 

 

Any help is very very appreciated.
0 Kudos
11 Replies
Altera_Forum
Honored Contributor II
3,648 Views

I was playing with the waveform editor in Modelsim 10.0c (Quartus 11.1sp1) last week. I don't recall the exact procedure, I just followed the documentation - from the Modelsim GUI click on Help -> PDF Documentation, User's Manual. 

 

Since you are just starting to use Modelsim, let me give you some advice - you are going about it the wrong way. 

 

Drawing a waveform and using that as the basis for your simulation stimulus works ok for some very basic tests. However, as you gain more experience with the tool, you will find that what you really need to create is a model of the device you are interfacing. 

 

I've posted some very simple examples in these threads: 

 

http://www.alteraforum.com/forum/showthread.php?t=32386 

http://www.alteraforum.com/forum/showthread.php?t=38988 

http://www.alteraforum.com/forum/showthread.php?t=35572 

http://www.alteraforum.com/forum/showthread.php?t=34391 

 

and a more complicated example in this Wiki page 

 

http://www.alterawiki.com/wiki/using_the_usb-blaster_as_an_sopc/qsys_avalon-mm_master_tutorial 

 

Run some of these tests, and you'll see how the simulation-only stimulus 'creates' waveforms that interact with the synthesizeable logic. 

 

Cheers, 

Dave
0 Kudos
Altera_Forum
Honored Contributor II
3,648 Views

Thank you Dave once again. 

 

I would like the simulation process to be as simple as possible at the moment. I feel that even though a test bench will probably be the better solution later in the project, i feel that it has a steeper learning curve to be able to get up to the stage where i can comfortably simulate a project without spending a considerable amount of time on it. 

 

Although at the moment, i'm considering on just reverting to the inbuilt Qsim in Quartus which is the old waveform simulator found in version 9.0 and earlier. Purely because even though i do each and every step in a few tutorials i've seen, the 'Create Wave' option on the right-click of an object just doesn't appear. Like i said before i think i'm probably missing a vital key in the simulation process that's not mentioned in the tutorials i've seen. 

 

Thanks for the links to the examples of the testbench files you've created. I'll look at them in the near future once i'm a little more free.
0 Kudos
Altera_Forum
Honored Contributor II
3,648 Views

 

--- Quote Start ---  

 

I would like the simulation process to be as simple as possible at the moment. I feel that even though a test bench will probably be the better solution later in the project, i feel that it has a steeper learning curve to be able to get up to the stage where i can comfortably simulate a project without spending a considerable amount of time on it. 

 

--- Quote End ---  

 

 

You cannot avoid the learning curve. The Modelsim wave editor produces a VHDL or Verilog file that you then need to connect to your logic. So the only step you are 'changing' by using the waveform editor is that you are manually creating the waveforms using a graphical editor, rather than typing in VHDL. 

 

I can understand that using Qsim looks to be easier. However, spend a few minutes and run the modelsim_example.zip example and you'll see that its not really that much effort. 

 

Cheers, 

Dave
0 Kudos
Altera_Forum
Honored Contributor II
3,648 Views

 

--- Quote Start ---  

Thank you Dave once again. 

 

I would like the simulation process to be as simple as possible at the moment. I feel that even though a test bench will probably be the better solution later in the project, i feel that it has a steeper learning curve to be able to get up to the stage where i can comfortably simulate a project without spending a considerable amount of time on it. 

 

Although at the moment, i'm considering on just reverting to the inbuilt Qsim in Quartus which is the old waveform simulator found in version 9.0 and earlier. Purely because even though i do each and every step in a few tutorials i've seen, the 'Create Wave' option on the right-click of an object just doesn't appear. Like i said before i think i'm probably missing a vital key in the simulation process that's not mentioned in the tutorials i've seen. 

--- Quote End ---  

 

 

hi, 

i had the same issue, i'd like to ask if u have found a solution 

regards :)
0 Kudos
Altera_Forum
Honored Contributor II
3,648 Views

The best solution is to write your testbench in HDL.

0 Kudos
Altera_Forum
Honored Contributor II
3,648 Views

One other method to start with a test stimulus of your design is to write commands in TCL and submit these on the ModelSim command line. This allows you to assign values to your inputs (including clock and reset), to turn them on and off at set times, advance the time wheel, and make variable updates to control the time points when you want events to take place. 

 

Before I created a full-blown VHDL TestBench, I wrote text files filled with TCL script statements, and then would feed these into the ModelSim command line located at the bottom of the display using copy/paste with the mouse. There is a method of having ModelSim read a TCL stimulus command file, but I've not needed to use that, since I may be spending a lot of time exploring how I want to conduct the testing itself. 

 

I did a web search on example files, and I can post some of the commands I used, if this is of interest. 

 

Using the stimulus scripting is another option to consider. It doesn't require as much work as writing a full-blown TestBench, but is likely more flexible than drawing waveforms. 

 

Hope this helps. 

regds, 

jim
0 Kudos
Altera_Forum
Honored Contributor II
3,648 Views

Let me ad this....I should also say that the contents of the Wave View can be managed by scripting as well. 

 

Here are some of the typical TCL commands for building a stimulus file (I've removed my design hierarchy information, so all you see if the signal name): 

 

1. active Low reset: 

 

force -freeze sim:/RES 1 {} 

force -freeze sim:/RES 0 10 

force -freeze sim:/RES 1 45 

 

2. setting up a clock: 

 

force -freeze sim:/CLK 1 0, 0 {25 ps} -r 50 

 

3. add signal to wave viewer: 

 

add wave -position end sim:/ROW_DATA 

 

 

4. assign values to inputs at start time and at time offsets: 

 

force ROW_DATA 0 0 

 

set elapsedTime03 3000 

 

force ROW_DATA 1 $elapsedTime03 

 

 

5. run simulation for some number of cycles: 

 

run 9000000 

 

I'm not going to describe the TCL syntax or statement semantics; this is something you can look up online (and everything in Quartus uses TCL scripting in the background, so it's a good thing to learn). You would also likely have some set of statements before all the ones I've listed that would do signal initialization, any looping to increment counters, etc., and send signals at periodic times, and also perform offset calculations. 

 

When you submit your script statements to ModelSim, it executes them internally; depending on the complexity of your stimulus algorithm, it can take many seconds to run before the vsim> prompt comes back...remember to be patient. Plus, as an interactive scripting tool, you get immediate feedback from ModelSim if you have an error (error messages). Once you run all the statements to operate on your signals and indicate which signals you want to view, you tell ModelSim to "run" some number of time steps. Once it completes this process, the wave viewer is updated with the waveform response. Make sure to open the Wave Viewer (or specify it in TCL command). 

 

Scripting your test stimulus can be fairly easy yet powerful option, and you can get this going quickly. To give you contrast, it took me a few hours to write scripting to drive my simulations, whereas when I finally had to write the TestBench, it took me 3-4 days (since it has to be fully simulated by itself to insure that it is correct before applying it to the the model). 

 

One other suggestion: start small, work out the behavior of a single test signal, get it working, then add other signals to the stimulus set. 

 

Hope this helps. Have fun. 

regds, 

jim
0 Kudos
Altera_Forum
Honored Contributor II
3,648 Views

Likewise, zeinab, I am just now struggling with the exact same issue. I am glad it is just not my overlooking something, though that does little to reduce the frustration of hours spent so far trying to get the "tutorial" to work!

0 Kudos
Altera_Forum
Honored Contributor II
3,648 Views

 

--- Quote Start ---  

I am just now struggling with the exact same issue. I am glad it is just not my overlooking something, though that does little to reduce the frustration of hours spent so far trying to get the "tutorial" to work! 

--- Quote End ---  

 

Which "tutorial" are you struggling with? If you can be a little more specific, I can probably help reduce your frustration :) 

 

Simulations that involve HDL code only and Modelsim are pretty easy to deal with. Simulations that involve Qsys generated projects are more complicated, since Altera's tools generate the Modelsim script and its not that good. 

 

Cheers, 

Dave
0 Kudos
Altera_Forum
Honored Contributor II
3,648 Views

Hi Dave, 

The latest tutorial to "not work" is a simple one here (ftp://ftp.altera.com/up/pub/altera_material/12.0/tutorials/verilog/modelsim_gui_introduction.pdf). I thought "if I can't get this to simulate (using the supplied instructions) then I need to change my approach", such as learn to write a test bench module. My problem was that the Create Pattern Wizard as illustrated on page 9 never appeared: On page 8 the instruction is "in the Objects window, right click on X1". When I do so, the pop-up menu choices are add wave and add wave new. Nowhere does create wave appear, and what does appear does not have the same functionality. I was running the Altera version of ModelSim as a stand-alone program.
0 Kudos
Altera_Forum
Honored Contributor II
3,648 Views

 

--- Quote Start ---  

 

The latest tutorial to "not work" is a simple one  

 

--- Quote End ---  

 

Rather than attempt to use a non-working example, I'd recommend taking a look at the examples I've provided in the links back at the start of this thread. 

 

Using the waveform editor to create stimulus is a bad idea. The technique is useful in a very limited number of situations, and even then, since you can write HDL code to create the waveforms, I'd argue that its never useful. 

 

Cheers, 

Dave
0 Kudos
Reply