使用modelsim产生VCD文件和使用VCD文件作为激励的方法
(2010-08-04 18:05:20)| 分类: verilog |
下面的代码可以产生VCD文件,并保存在了counter.vcd文件中:
module counter(res, clk, out);
input res, clk;
output[7:0] out;
reg[7:0] out;
always@(posedge clk)
if(res)
else
endmodule
module dump;
reg res, clk;
wire[7:0] out;
counter counter(res, clk, out);
initial
begin
end
always #5 clk<=!clk;
endmodule
若使用counter.vcd作为激励对counter进行仿真,方法如下:
在modelsim的命令行中,输入
vsim -vcdstim counter.vcd counter
然后,再把counter进行add to wave 的操作;
然后,再点击restart按钮;
最后,点击run_all按钮即可,出现了波形。
产生的VCD文件格式分析:
$date
$end
$version
$end
$timescale
$end
$scope module dump $end
$scope module counter $end
$var wire 1 ! res $end
$var wire 1 " clk $end
$upscope $end
$upscope $end
$enddefinitions $end
#0
$dumpvars
1!
0"
$end
#5
1"
#10
0"
#15
1"
#20
0"
#25
1"
#30
0"
#31 (-------》#后的数字表示时间;)
0!
#35
1"
#40
0"
#45
1"
#50
0"
#55
1"

加载中…