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