使用*软件Icarus Verilog Simulator进行仿真

时间:2023-03-09 17:34:43
使用*软件Icarus Verilog Simulator进行仿真

Icarus Verilog Simulator(http://iverilog.icarus.com/home)使用iverilog作为源代码编译器,编译生成vvp程序文本,使用vvp作为运行时引擎,支持vcd波形Dump,支持lxt格式波形,可以使用gtkwave来Debug波形。

各大Linux发行版和Windows系统均可以直接安装iverilog/gtkwave,iverilog/vvp/gtkwave参数可以通过man *查看。

一个简单的Testbench示例:

 //***********************************************************************************************
// File : tb_top.sv
// Author : Lyu Yang
// Date : 2018-12-09
// Description : Simple Testbench using iVerilog
//***********************************************************************************************
`timescale 1ns/1ns
module tb_top; logic clk;
logic [:] cnt; initial forever # clk = ~clk; initial begin
clk = ;
cnt = ;
repeat()
begin
@(posedge clk);
cnt = cnt + ;
$display("@%4t ns: cnt = 0x%-04X", $time, cnt);
end
#;
$finish;
end initial begin
//$dumpfile("tb_top.vcd");
$dumpfile("tb_top.lxt");
$dumpvars();
end endmodule

使用上述工具集的Makefile示例:

 #***********************************************************************************************
# File : Makefile
# Author : Lyu Yang
# Date : --
# Description : Makefile for iVerilog
#*********************************************************************************************** all: cmp vvp lxt cmp:
iverilog -g2005-sv tb_top.sv -o tb_top.vvp vvp:
vvp tb_top.vvp -fst -sdf-verbose -lxt2 lxt:
gtkwave tb_top.lxt & clean:
@rm -rf tb_top.vvp tb_top.lxt

波形窗口:

使用*软件Icarus Verilog Simulator进行仿真