二 vcd dump

由于VCD可以用于做功耗分析,所以需要把其dump出来。另外VCD可以作为结果,也可以作为激励,但是实际看到的少啊!

VCD是verilog的标准,所以有系统函数$dumpvars,$dumpfile(),$dumpon,$dumpoff,$dumpflush.

但是VHDL没有相关函数,所以要使用modelsim的脚本 :

vcd file, vcd add, vcd flush

注意:

a)以上前两句要加在vsim后面,见sample,

b)注意在仿真结束前调用 vcd flush,把buffer中的数据输出给文件,估算buffer可能是2kB大小。如果文件很小且没有运行vcd flush,会看到文件没有内容!

另外如果不运行vcd flush,则最后的约2KB数据不会写进vcd中!

c)另外vcd add只能添加bit, bit_vector,std_logic, and std_logic_vector
vcd add
This command adds the specified objects to a VCD file.
The allowed objects are Verilog nets and variables and VHDL signals of type bit, bit_vector,
std_logic, and std_logic_vector (other types are silently ignored). The command works with
mixed HDL designs.

d) 如果想子模块一起存储VCD,添加-r,但是参数是有顺序的

vcd add /top/* -r 这个是错的

改为

vcd add -r /top/*

e) -----------VCD script sample-------

#    vcd file test.vcd
#    vcd add /top/*

vsim -L work -t ns -novopt -c -pli ./pslse-master/pslse/afu_driver/src/afu_driver.sl +nowarnTSCALE work.top
#注意 -novopt很重要,否则会被优化层次结构,甚至有些模块会不见了!(比如做了D触发器以及其testbench,就能看到这个问题)
    vcd file test.vcd
#  vcd add /top/* -r   这句话是错误的,参数有顺序
    vcd add -r /top/*
为了只计算power,只需要dut的功耗,可以如下

vcd add -r /top/dut/*

f) vcd flush,解释见后

如果在仿真结束后,没有运行vcd flush,会有部分内容,甚至全部内容没有写到vcd的file中,碰到如下问题

在verilog的代码中使用了$stop。

而在do文件中,最后是

run all

这样得到的vcd file是空文件,因为没有flush进去吧?!

即使改为

run all

vcd flush

仍然出错,因为script会pause在run all。

修改的原则,保证确实flush到文件中了!

.)取消$stop,修改run all为run 具体时间(如1ms),添加vcd flush。

.)此法不适合VHDL而适合verilog,在$stop前添加,$dumpflush。仍然run -all

但是不建议脚本和verilog的vcd相关task混合使用,要不全部用脚本,或者全部用task

1) ---------------  如下来自modelsim OEM产生的script

vmap presynth presynth
vmap SmartFusion2 "D:/Microsemi/Libero_SoC_v11.7/Designer/lib/modelsim/precompiled/vlog/SmartFusion2"

vlog -vlog01compat -work presynth "${PROJECT_DIR}/hdl/top.v"
vlog "+incdir+${PROJECT_DIR}/stimulus" -vlog01compat -work presynth "${PROJECT_DIR}/stimulus/tb.v"

vsim -L SmartFusion2 -L presynth  -t 1ps -novopt presynth.tb
add wave /tb/*
add log -r /*
vcd file power.vcd
vcd add -r /tb/top_0/*
run 500ns
vcd flush
echo "VCD file power.vcd was successfully exported under the project simulation/ direct

2) ----------sample 采用verilog函数 dump (注意最后用了和vcd flush一样的作用的function $dumpflush)-------

http://verilog.renerta.com/mobile/source/vrg00056.htm

initial begin
  $dumpfile("test.txt");
  $dumpvars(1,a,y);
  #200;
  $dumpoff;
  #200;
  $dumpon;
  #20;
  $dumpall;
  #10;
  $dumpflush;
end
endmodule

The dumpfile will contain only changes of 'a' and 'y' variables.
After 200 time units, dumping will be suspended for 200 time units.
Next, dumping will start again and after 20 time units, all variables
will be dumped.

问题:实在不知道$dumpall和$dumpflush的区别,如下是查找modelsim的ug得到解释以及相对应的vcd命令

vcd checkpoint
This command dumps the current values of all VCD variables to the specified VCD file. While
simulating, only value changes are dumped.
Related Verilog tasks: $dumpall, $fdumpall

vcd on
This command turns on VCD dumping to the specified file and records the current values of all
VCD variables.
By default, vcd on is automatically performed at the end of the simulation time that the vcd add
command performed.
Related Verilog tasks: $dumpon, $fdumpon
Syntax
vcd on [<filename>]
Arguments
• <filename>
(optional) Specifies the name of the VCD file. If omitted the command is executed on the
file designated by the vcd file command or dump.vcd if vcd file was not invoked.
 
vcd flush
This command flushes the contents of the VCD file buffer to the specified VCD file. This
command is useful if you want to create a complete VCD file without ending your current
simulation.
Related Verilog tasks: $dumpflush, $fdumpflush

-----------------------

三) 要查看以前的仿真,需要先将VCD转为wlf

vcd2wlf xx.vcd xx.wlf

然后用-view参数查看,导入wav.do显示需要看的波形!

vsim -do wav.do(波形文件) -view test=xx.wlf(test是dataset名,可以不要)

四)VCD 格式理解

$date
    Fri Aug 26 15:48:49 2016
$end
$version
    QuestaSim Version 10.3_1
$end
$timescale
    1ps
$end

$scope module dff_tb $end

$scope module dut $end
$var wire 1 ! clk $end    --- shannon:这句话表示用!符号表示clk网络
$var wire 1 " rst $end    --- shannon:这句话表示用"符号表示rst网络
$var wire 1 # d $end
$var reg 1 $ q $end
$upscope $end
$upscope $end
$enddefinitions $end
#0
$dumpvars                --- shannon: dump值
0$          
0#
0!
1"
$end
#5000                         --- shannon :网络clk 值在5000是为1
1!
#10000
0!
#15000
1!
#16000
0"                                     ---shannon:网络rst 值在16000ps时变为0  (1ps 是 vsim -t 1ps -novopt work.dff_tb 定义的单位)
#20000
0!
#25000
1!
#30000
0!
#35000
1!
#40000
0!

modelsim(2) - vcd (dump, 查看,格式理解)的更多相关文章

  1. 【Kindle】pdf转mobi适合kindle查看格式

    pdf转mobi适合kindle查看格式 1.用到软件:福昕风腾PDF套件,切白边,PDF-Viewer,导出png图片ChainLP,图片转换为mobi文件<期间要下载kindlegen.ex ...

  2. YUV主要采样格式理解

    主要的采样格式有YCbCr 4:2:0.YCbCr 4:2:2.YCbCr 4:1:1和 YCbCr 4:4:4.其中YCbCr 4:1:1 比较常用,其含义为:每个点保存一个 8bit 的亮度值(也 ...

  3. Json格式理解

    json格式中共有三个重要符号"[","{",":" 中括号和花括号的唯一区别就是:中括号不需要key,花括号必须有key

  4. 在Modelsim波形中查看值

    在Modelsim的波形中查看值时,可以利用右键选择变量的数据类型.如果变量值为0,可以选择unsigned类型观察,可以1位显示0. 长度较大的数据以十六进制显示时,即使值为0,也依然显示为长度较长 ...

  5. 各种波形文件VCD,VPD,SHM,FSDB生成的方法

    转载---http://www.cnblogs.com/zeushuang/archive/2012/11/14/2769640.html 仿真是IC设计不可或缺的重要步骤,仿真后一般需要记录下波形文 ...

  6. 各种波形文件vcd,vpd,shm,fsdb生成的方法(zz)

    仿真是IC设计不可或缺的重要步骤,仿真后一般需要记录下波形文件,用于做详细分析和研究.说一下几种波形文件WLF(Wave Log File).VCD(Value Change Dump)文件,fsdb ...

  7. vsim仿真VHDL输出fsdb格式文件

    vsim(modelsim)仿真VHDL输出fsdb格式文件 1.Dump准备 (1) 将下列设置放到顶层testbench tb.vhd文件中[注意放置的位置:关系如图] library novas ...

  8. 《深入理解Java虚拟机》(四)虚拟机性能监控与故障处理工具

    虚拟机性能监控与故障处理工具 详解 4.1 概述 本文参考的是周志明的 <深入理解Java虚拟机> 第四章 ,为了整理思路,简单记录一下,方便后期查阅. JDK本身提供了很多方便的JVM性 ...

  9. modelsim 保存波形文件

    1. do文件记录了仿真的过程和加载的各种库. do文件的保存过程: file——>save format——>D:/modeltech_6.5b/examples/run_wave.do ...

随机推荐

  1. unity5.3.4之no android module loaded

    参考http://www.cnblogs.com/shenggege/p/5165616.html 最近从unity5.1.3升级到5.3.4的时候,发现有个问题: system.io.file' d ...

  2. 【LeetCode OJ】Construct Binary Tree from Inorder and Postorder Traversal

    Problem Link: https://oj.leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-trav ...

  3. OD调试篇13

    今天的程序比较大,听说还是比较牛的程序,不过破解它的一个比较老的版本的.打开程序看看. 点击about   然后点enter registration code    输入name  以及密钥之后,会 ...

  4. HC蓝牙模块测试AT指令搭建外部电路遇到的问题

    按这个搭,AT指令烧不进去,两块板两次都不行. 这是我的底板(比较混乱的万能版) 第一次短路了,VCC和GND在板子下面连起来了,肉眼当然看不见,吹下来重新焊就好了. 第二次,txdrxd与usb转T ...

  5. PAT (Basic Level) Practise:1014. 福尔摩斯的约会

    [题目链接] 大侦探福尔摩斯接到一张奇怪的字条:“我们约会吧! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm”.大侦探很快 ...

  6. python数据结构与算法——二叉树结构与遍历方法

    先序遍历,中序遍历,后序遍历 ,区别在于三条核心语句的位置 层序遍历  采用队列的遍历操作第一次访问根,在访问根的左孩子,接着访问根的有孩子,然后下一层 自左向右一一访问同层的结点 # 先序遍历 # ...

  7. python数据结构与算法——归并排序

    归并排序: 原理与C语言实现 参考:白话经典算法系列之五 归并排序的实现 1. 容易对有序数组A,B进行排序. 2. 为了使得A,B组内数据有序:可以将A,B组各自再分成二组. 3. 经过不断分组,当 ...

  8. JAVA 编码中文简述

    中文编码问题虽然是个老问题,但对不熟悉的人来说还是不好处理的.不过Java中已经有了一套比较成熟的解决方案. 首先对中文编码格式予以简单介绍:中文编码有三套国标:GB2312,GBK,GB18030, ...

  9. JSBinding / About JSComponent and Serialization

    About JSComponent JSCompnent is a normal Unity script. It inherits from JSSerializer and JSSerialize ...

  10. JSBinding+SharpKit / 更新的原理

    首先,其实不是热更新,而是更新. 热更新意思是不重启游戏,但只要你脚本里有存储数据,就不可能.所以只能叫更新. 但大家都这么说,所以... 先举个具体的例子: 如果是C#:在 Prefab 的 Gam ...