Introduction to Simulation of
Verilog Designs
using ModelSim-Altera
Presenter: Phong Bui
Email: phongbui102@gmail.com
Digital Image Processing Group IC Design Lab Hanoi 29/01/2013
Contents
1. Introduction
2. Design Project
3. Simulate without testbench
4. Simulate with testbench
1. Introduction
ModelSim is a verification and simulation tool for
VHDL, Verilog, SystemVerilog, and mixedlanguage designs.
Software : ModelSim-Altera 6.6d Starter Edition
References :
Introduction to Simulation of Verilog Designs Using ModelSim Graphical Waveform Editor (Altera). ModelSim Tutorial (Mentor Graphics).
3
Contents
1.Introduction
2.Design Project
3.Simulate without testbench
4.Simulate with testbench
2. Design Project
Simple example : f(x1, x2, x3) = x1x2 + x2x3 + x3x1 Verilog code :
module majority(x1, x2 ,x3 ,f); input : x1, x2, x3; output: f;
assign f = (x1&x2)|(x2&x3)|(x3&x1);
endmodule;
5
2. Design Project
Open the ModelSim simulator. In the displayed window select File > New > Project
2. Design Project
A Create Project pop-up box will appear
1.Enter the name of the project
Choose Project Location
2. Design Project
Create new file
2 3
8
2. Design Project
Double click
Text Editor
2. Design Project
Or add existing file
10
2. Design Project
After completed coding, select Compile > Compile all
Compile of majority.v was successfull
11
Contents
1.Introduction
2.Design Project
3.Simulate without testbench
4.Simulate with testbench
12
3. Simulate without testbench
Select Simulate > Start simulation, Start Simulation window will appear
13
3. Simulate without testbench
Simulation window
14
3. Simulate without testbench
Create waveforms for Simulation
15
3. Simulate without testbench
Modify waveforms for Simulation
Right click
16
3. Simulate without testbench
Waveform window
17
3. Simulate without testbench
Waveform window
18
3. Simulate without testbench
With output signal
19
3. Simulate without testbench
SimulateSelect Run all
20
3. Simulate without testbench
Result
To stop simulation, slect Simulate > End simulation
21
Contents
1.Introduction
2.Design Project
3.Simulate without testbench
4.Simulate with testbench
22
4. Simulate with testbench
Create testbench file to project
23
4. Simulate with testbench
After completed coding, select Compile > Compile all
24
4. Simulate with testbench
Select Simulate > Start simulation
25
4. Simulate with testbench
Add signal to waveform
26
4. Simulate with testbench
Add signal to waveform
27
4. Simulate with testbench
Simulate
28
4. Simulate with testbench
Zoom in, zoom out
29
Demo
Question ?
30