My First Verilog FPGA Design Simulation

Today’s goal was to be able to figure out how to use modelSim enough to see some wave forms coming from a simple FPGA design.

At this point, I’m not going to try to document exactly how to run ModelSim as the tutorials below certainly do at least as well as I possibly could; however, once I’ve become confident in using modelSim I think I will create a video of basic usage so, minimally, I can come back and look at how I make this work.

If you install the Quartus II Designer from Altera, it installs ModelSim-Altera, their version of ModelSim. Just check the Altera programs on the start button.

I looked at various tutorials to get the very basics down. These sites were useful to me:

A look into CPLDs – using the Quartus II software and ModelSim

ModSim Tutorial – from Northwestern University

ModelSim Tutorial – from Mentor Graphics

ModelSim Tutorial – from Altera

My procedure is unrefined at this point, but the overall flow is:

  • Create the Design in Altera’s Quartus II. Make sure it compiles properly. For this test I built about the simplest thing possible, an AND gate:
module MSFF (A, B, C);

input   A, B;
output  C;

assign C = A & B;
  • Once compiled, check the RTL viewer and make sure the RTL looks good. It’s kind of hard to screw up an AND gate (not that I didn’t have trouble figuring out the exact syntax, but I’m slowly figure out when to use assign, =, and <=):


  • Once I’m happy with it in Quartus, I exit Quartus and then run ModelSim. I create a new project and add an existing file. I then add the verilog file I already created in Quartus II. At this point, I don’t know how stupid of an idea using the existing file is, but it hasn’t got me into trouble yet.
  • Now that the file is open you must compile it and then start the simulation.
  • Once the simulation is running, I created different clock signals for A and B such that they would produce all the different possible values for A and B.
  • Finally I ran the simulation and got the wave output. Looking at C for the different values of A and B I can verify this simple design works.


Pretty cool. Now I need to build something just a bit more complex than an AND gate!


I recorded an ‘instructional’ video for myself so I can recall how to enter a design into Quartus and then run modelSim on it. I can guarantee that once I put this away for 6 months I will not recall any of the details.

This is kind of long and certainly not polished, but someone else might find it useful if they are trying to figure out how to put everything together for the first time.

Quartus and modelsim need a big monitor. To view this video clearly, run it on a 1920×1080 monitor and make sure it is playing at 1080p quality in youtube. Then all the text will be sharp.


This entry was posted in c-fpga and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s