Tools (Icarus)
Integrated Electronic
Aug. 2009 | Simulation Tools | 1
Systems Lab
Icarus Verilog Simulation Flow
`include "module1.v“
testbench.v `include "module2.v“
`include "module2.v“
module1.v `include "module2.v“
module2.v module first_counter_tb();
module3.v ...
module4.v
endmodule
a.out
myhost> gtkwave file.vcd
file.vcd
under Windows:
E:\Verilog> vpp a.out
under Linux:
myhost> ./a.out
Integrated Electronic
Aug. 2009 | TU Darmstadt | Integrated Electronic Systems Lab | 2
Systems Lab
Icarus Verilog Simulator Download
Icarus Packages:
Microsoft Windows:
http://bleyer.org/icarus/
1) iverilog-0.9.1_setup.exe [5.33MB]
2) GTKWave for Windows
3) optional: IVI, a graphical frontend for Icarus
(based on Eclipse)
4) optional: Verilog syntax highlighting for UltraEdit
Integrated Electronic
Aug. 2009 | TU Darmstadt | Integrated Electronic Systems Lab | 3
Systems Lab
Icarus Verilog Simulator Download
Icarus Packages:
Servername: software.opensuse.org
Directory: /download/repositories/science/openSUSE_11.1/
(Choose the directory for your distribution)
Start “Install Software” in Yast, goto “Search” and look for gEDA. All
packages appear.
Install the packages „verilog“ and „gtkwave“ as usual.
Integrated Electronic
Aug. 2009 | TU Darmstadt | Integrated Electronic Systems Lab | 4
Systems Lab
Icarus Verilog Simulator Download
Icarus Packages:
SuSE: http://software.opensuse.org/search
Integrated Electronic
Aug. 2009 | TU Darmstadt | Integrated Electronic Systems Lab | 5
Systems Lab
Icarus Verilog Simulator Download
Icarus Packages:
Integrated Electronic
Aug. 2009 | TU Darmstadt | Integrated Electronic Systems Lab | 6
Systems Lab
Running your first Example
Example from: http://www.asic-world.com/verilog/first1.html
Testbench : first_counter_tb.v
Integrated Electronic
Aug. 2009 | TU Darmstadt | Integrated Electronic Systems Lab | 7
Systems Lab
Icarus Verilog Simulation Flow
`include „first_counter.v“
first_counter_tb.v module first_counter_tb();
...
$dumpfile("file.vcd");
$dumpvars(1,clock, reset,
first_counter.v enable, counter_out);
...
endmodule
myhost> iverilog first_counter_tb.v
a.out
myhost> gtkwave file.vcd
file.vcd
under Windows:
E:\Verilog> vpp a.out
under Linux:
myhost> ./a.out
Integrated Electronic
Aug. 2009 | TU Darmstadt | Integrated Electronic Systems Lab | 8
Systems Lab
Icarus Verilog Simulation Flow
`include „first_counter.v“
first_counter_tb.v module first_counter_tb();
...
$dumpfile("file.vcd");
$dumpvars(1,clock, reset,
first_counter.v enable, counter_out);
...
endmodule
myhost>
myhost>
iverilog
iverilog
first_counter_tb.v
testbench.v
a.out
myhost> gtkwave file.vcd
file.vcd
under Windows:
E:\Verilog> vpp a.out
under Linux:
myhost> ./a.out
Integrated Electronic
Aug. 2009 | TU Darmstadt | Integrated Electronic Systems Lab | 9
Systems Lab
Running your first Example
//----------------------------------------------------- first_counter.v
// Design Name : first_counter
// File Name : first_counter.v
// Function : This is a 4 bit up-counter with
// Synchronous active high reset and
// with active high enable signal
//-----------------------------------------------------
module first_counter (
clock , // Clock input of the design
reset , // active high, synchronous Reset input
enable , // Active high enable signal for counter
counter_out // 4 bit vector output of the counter
); // End of port list
Integrated Electronic
Aug. 2009 | TU Darmstadt | Integrated Electronic Systems Lab | 10
Systems Lab
Running your first Example
first_counter.v
//### (1) Port Descriptions ###
//-------------Input Ports-----------------------------
input clock ;
input reset ;
input enable ;
//-------------Output Ports----------------------------
output [3:0] counter_out ;
Integrated Electronic
Aug. 2009 | TU Darmstadt | Integrated Electronic Systems Lab | 11
Systems Lab
Running your first Example
first_counter.v
//### (2)Code ###
Integrated Electronic
Aug. 2009 | TU Darmstadt | Integrated Electronic Systems Lab | 12
Systems Lab
Running your first Example
`include „first_counter.v“
first_counter_tb.v module first_counter_tb();
...
$dumpfile("file.vcd");
$dumpvars(1,clock, reset,
first_counter.v enable, counter_out);
...
endmodule
myhost>
myhost>
iverilog
iverilog
first_counter_tb.v
testbench.v
a.out
myhost> gtkwave file.vcd
file.vcd
under Windows:
E:\Verilog> vpp a.out
under Linux:
myhost> ./a.out
Integrated Electronic
Aug. 2009 | TU Darmstadt | Integrated Electronic Systems Lab | 13
Systems Lab
Running your first Example
first_counter_tb.v
// This is the TESTBENCH
endmodule
Integrated Electronic
Aug. 2009 | TU Darmstadt | Integrated Electronic Systems Lab | 14
Systems Lab
Running your first Example
// ### (1) Initialize Variables ###
first_counter_tb.v
// Initialize all variables
initial begin
// define file for simulation values dump, needed for GTKWave
$dumpfile("file.vcd");
// define singals to be recorded (in dumpfile) on actual design level
$dumpvars(1,clock, reset, enable, counter_out);
// Clock generator
always begin
#5 clock = ~clock; // Toggle clock every 5 ticks
end
Integrated Electronic
Aug. 2009 | TU Darmstadt | Integrated Electronic Systems Lab | 16
Systems Lab
Running your first Example
`include „first_counter.v“
first_counter_tb.v module first_counter_tb();
...
$dumpfile("file.vcd");
$dumpvars(1,clock, reset,
first_counter.v enable, counter_out);
...
endmodule
myhost>
myhost>
iverilog
iverilog
first_counter_tb.v
testbench.v
a.out
myhost> gtkwave file.vcd
file.vcd
under Windows:
E:\Verilog> vpp a.out
under Linux:
myhost> ./a.out
Integrated Electronic
Aug. 2009 | TU Darmstadt | Integrated Electronic Systems Lab | 17
Systems Lab
Running your first Example
`include „first_counter.v“
first_counter_tb.v module first_counter_tb();
...
$dumpfile("file.vcd");
$dumpvars(1,clock, reset,
first_counter.v enable, counter_out);
...
endmodule
myhost>
myhost>
iverilog
iverilog
first_counter_tb.v
testbench.v
a.out
myhost> gtkwave file.vcd
file.vcd
under Windows:
E:\Verilog> vpp a.out
under Linux:
myhost> ./a.out
Integrated Electronic
Aug. 2009 | TU Darmstadt | Integrated Electronic Systems Lab | 18
Systems Lab
Running your first Example
`include „first_counter.v“
first_counter_tb.v module first_counter_tb();
...
$dumpfile("file.vcd");
$dumpvars(1,clock, reset,
first_counter.v enable, counter_out);
...
endmodule
myhost>
myhost>
iverilog
iverilog
first_counter_tb.v
testbench.v
a.out
myhost> gtkwave file.vcd
file.vcd
under Windows:
E:\Verilog> vpp a.out
under Linux:
myhost> ./a.out
Integrated Electronic
Aug. 2009 | TU Darmstadt | Integrated Electronic Systems Lab | 19
Systems Lab
Running your first Example
Integrated Electronic
Aug. 2009 | TU Darmstadt | Integrated Electronic Systems Lab | 20
Systems Lab