eecs270.org

ModelSim Quick Start

ModelSim is the simulator officially supported by EECS 270. It runs on CAEN lab machines (in person or via VNC). For a local alternative using iverilog + gtkwave/VaporView, see the Local Simulation Tools Setup Guide.

This page walks through simulating Project 0 in ModelSim. The same steps apply to every project but with modified file names.

Create a ModelSim Project

  1. Start ModelSim. On CAEN, launch it from the start menu or terminal.
  2. File → New → Project.
    • Project name: Project0
    • Project location: a folder on your N: drive (e.g. N:/270_projects). ModelSim creates the directory if needed.
      • Do not use the local C: drive on CAEN - your work won’t persist across machines.
      • Do not use a cloud drive (e.g., Dropbox, Google Drive) - ModelSim will become unusably slow.
    • Leave the default library name as work.
    • Click OK.
  3. Project → Add to Project → Existing File… and add Project0.v, TestBench0.v, and Majority.v.

The Project tab should now list your three files with ? next to each, indicating they are uncompiled.

Compile

  1. Select all three files.
  2. Right-click → Compile → Compile Selected.
    • You can also use Compile All, though it will generally be a little slower.
  3. On success, each file gets a green check mark. On failure, a red X appears next to the offending file. Read the error in the transcript pane, fix the source, and recompile.

Simulate

  1. Click the Library tab.
  2. Expand the work library, highlight TestBench0, right-click → Simulate.
  3. ModelSim opens the simulation view. If the Wave pane is not visible, open it with View → Wave.

Add signals to the waveform

You should see waveforms showing LEDG[0] going high whenever two or more bits of SW are high.

Save your wave configuration

In the Wave pane: File → Save Format → save as wave0.do. Next time, load with File → Load → Macro File to skip re-adding signals. Each project’s starter pack includes a waveN.do you can use directly.

Iterating

After editing source:

  1. Re-select the changed files in the Project tab and Compile Selected.
  2. Simulate → End Simulation, then re-launch the simulation.
  3. Run again.

Tips