Introduction to Simulation of
Verilog Designsusing ModelSim-Altera
Presenter: Phong Bui
Email: phongbui102@gmail.com
Digital Image Processing Group
IC Design Lab
Hanoi 29/01/2013
2
Contents
4. Simulate with testbench
3. Simulate without testbench
2. Design Project
1. Introduction
3
1. Introduction
ModelSim is a verification and simulation tool for
VHDL, Verilog, SystemVerilog, and mixed-language
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).
4
Contents
4.Simulate with testbench
3.Simulate without testbench
2.Design Project
1.Introduction
5
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;
6
2. Design Project
Open the ModelSim simulator. In the displayed window select File > New > Project
7
2. Design Project
A Create Project pop-up box will appear…
1.Enter the name of the project
Choose Project Location
8
2. Design Project
Create new file…
1
2
3
9
2. Design Project
Double click
Text Editor
10
2. Design Project
Or add existing file…
11
2. Design Project
After completed coding, select Compile > Compile all
Compile of majority.v was successfull
12
Contents
4.Simulate with testbench
3.Simulate without testbench
2.Design Project
1.Introduction
13
3. Simulate without testbench
Select Simulate > Start simulation…, Start Simulation window will appear…
14
3. Simulate without testbench
Simulation window…
15
3. Simulate without testbench
Create waveforms for Simulation…
16
3. Simulate without testbench
Modify waveforms for Simulation…
Right click
17
3. Simulate without testbench
Waveform window…
18
3. Simulate without testbench
Waveform window…
19
3. Simulate without testbench
With output signal…
20
3. Simulate without testbench
Simulate…Select Run all
21
3. Simulate without testbench
Result…
To stop simulation, slect Simulate > End simulation
22
Contents
4.Simulate with testbench
3.Simulate without testbench
2.Design Project
1.Introduction
23
4. Simulate with testbench
Create testbench file to project
24
4. Simulate with testbench
After completed coding, select Compile > Compile all
25
4. Simulate with testbench
Select Simulate > Start simulation…
26
4. Simulate with testbench
Add signal to waveform…
27
4. Simulate with testbench
Add signal to waveform…
28
4. Simulate with testbench
Simulate…
29
4. Simulate with testbench
Zoom in, zoom out…
30
Demo…
Question ?