| |
1、+v2k
verilog 标准:
IEEE1364-1995 -----大改进-----IEEE1364-2001---小修正---IEEE1364-2005
2009年加入SystemVerilog后 ,新统一标准 IEEE 1800-2009
其中 verilog 2001 是最常用的。
如果设计中使用了verilog IEEE1364-2001 的一些描述方法,那么使用vcs进行编译时,要使用参数 +v2k 例如: vcs flow.v +v2k
+v2k编译选项的使用
下表列出了Std 1364-2001的结构实现,以及这些结构中是否需要+v2k参数的使用。我们知道
verilog的发展到现在最新的标准是2001,所以为了兼容2001标准的verilog语言,VCS特设了
这个选项。
Std 1364-2001结构 Require +v2k
逗号分割敏感列表中的变量:
always @(r1,r2,r3)
yes
基于名称的参数传递:
modname #(.param_name(value)) inst_name(sig1,…);
yes
ANSI标准端口和参数列表:
module dev (output reg [7:0] out1,input wire [7:0] w1);
yes
在寄存器生命阶段进行初始化:
reg [15:0] r2 = 0;
yes
条件编译控制:
`ifdef …`elseif
yes
除能默认的线类型:
`default_nettype
yes
有符号算法扩展:
reg signed [7:0] r1;
no
输出文件任务:
$fopen $fscan $scanf…
no
从runtime命令行传递参数:
$value$plusarg系统功能
yes
部分索引功能:
reg [8+:5] = 5`b11111;
yes
多维数组
reg [7:0] r1 [3:0] [3:0];
yes
持续文件名和行号:
`line
yes
暗指敏感列表:
always @*
yes
幂操作:
r1=r2**r3;
yes
属性:
(* optimize_power=1 *)
module dev (res,out,clk,data1,data2);
yes
generate段 yes
局部参数声名 yes
自动任务和函数 :
task automatic t1 ();
需要-sverilog编译
选项
常量函数:
localparam lp1 = const_func(p1);
yes
带有位范围的参数:
parameter bit [7:0] [31:0] P = {32`d1 , 32`d2 , 2`d3 , 32`d4 , 32`d5 , 32`d6 ,
32`d7 ,32`d8};
编译选项中需要
加入-sverilog选项
2.6 VCS V2K的配置和库影射
都知道-v,-y 可以指定库/库的存放路径。但是你也可以通过使用一个文件将多个库/库路径
包含到这个文件中,进行一次性指定。对于sv来说Interface 类型的模块也可以被当作库的一
个因素来存在。
库影射文件
库影射文件的格式如下:
library lib1 /net/design1/design1_1/*.v;
library lib2 /net/design1/design1_2/*.v;
VCS在调用库的时候就是按照你在影射文件中的定义顺序来调用实际module的。
编译过程中可以通过-libmap 来引用可“库影射文件”。
例如:vcs +v2k –libmap lib.lst
vcs -sverilog –libmap lib.lst
上面虽然调用了“库映射文件”,但是在库中的verilog模型中可能还使用了“`include”语句调用了
别的module文件,所以在你的“库映射文件”中可以使用-incdir指令来指定查询路径。
例如:
library gatelib /net/design1/gatelib/*.v -incdir /net/design1/spec1lib, /net/design1/spec2lib;
2、+incdir+directory+
如果设计文件中使用了 `include包含文件 ,+incdir+指示编译器包含文件的路径,可以有多个路径,加号后面添加即可。
例子:
如果 flow.v 文件中使用了`include “para.v” ,而且 flow.v和para.v在一个文件夹下,那么无需指明包含文件的路径,会在flow.v所在文件夹下查找。
vcs flow.v 或者 vcs flow.v para.v
如果 flow.v 和 para.v 不在一个路径下,编译时需要指明包含文件的路径
vcs flow.v +incdir+/home/pcc/test 这样vcs在编译flow.v过程中会根据路径搜索para.v文件
3、-y directory
vcs 在指定的路径下查找例化模块的源文件,
比如顶层模块中会例化很多子模块文件,编译时只需要列出顶层模块,-y 指明其他例化模块源文件的路径即可, 要配合 “ +libext+文件后缀+文件后缀+ ” 使用。
4、 +libext+文件后缀+文件后缀+...
vcs 只搜索指定后缀名的文件
例子 : 工程包含四个文件 top.v a.v b.v top_tb.v ,top_tb.v是顶层模块包括top.v,top.v 包含 a.v 和 b.v ,其中top.v 在路径 /home/pcc/test/ 下,a.v 和 b.v 在 /home/pcc/test/test2 下 , top_tb.v 在 /home/pcc/hello/ 下 ,编译时 假设用户运行路径在 /home/pcc/any 下
[pcc@localhost any]$ vcs /home/pcc/hello/top_tb.v -y ../test -y /home/pcc/test/test2 +libext+.v +v2k -o test4/test_simv
生成的二进制可执行仿真文件命名为 test_simv 保存路径为 /home/pcc/any/test4/
-y directory 指示 top_tb.v中包含的例化模块源文件的路径,可以多次添加路径。
+libext+.v 指示搜索时后缀.v的文件,指示vcs编译时把例化模块源文件包含进来。
转自:http://bbs.ednchina.com/BLOG_ARTICLE_3029140.HTM
对verilog中的memory和寄存器进行初始化
可以采用如下option对设计中的所有memory和register bits进行初始化:
+vcs+initreg+random
在0时刻将设计中的所有状态变量(reg类型),寄存器和MDA中的memory初始化成随机的
0/1。
注意:+vcs+initreg+只对verilog的设计起作用。
+vcs+initreg初始化正常的memory和多维的reg类型数组。例如:
reg [7:0] mem [7:0] [15:0];
+vcs+initreg不会初始化register变量和reg类型以外的多维数组。
2.2 +plusarg_save选项
+plusarg_save与+plusarg_ignore是相互对立的两个选项,一个是用来使能编译参数,一个是用
来非使能编译参数。编译参数要在+plusarg_save/+plusarg_ignore之后,例如:
+plusarg_save +test_case0
在你的RTL中通过+test_case0参数来开启某段event。例如:
if ($test$plusargs(“+test_case0”)) begin
…
end
其中+test_case0是从编译参数阶段获得的许可。
当然你也可以通过编译过程为一个变量指定一个值,然后在执行阶段将这个值传递给这个变
量,这个时候只需要将参数值+在编译列表中,然后在RTL中通过$value$plusargs,调用这个
参数语法如下:
integer = $value$plusargs("plusarg_format",signalname);
实际使用情况如下:
module valueplusargs;
reg [31:0] r1;
integer status;
initial
begin
$monitor("r1=%0d at %0t",r1,$time);
#1 r1=0;
#1 status=$value$plusargs("r1=%d",r1);
end
endmodule
运行阶段执行下面的命令:
%simv +r1=10
$monitor系统任务的输出:
r1=x at 0
r1=0 at 1
r1=10 at 2
条件表达式中的X/Z的检查
如果你想让VCS检查到你的RTL代码中条件表达式的值在出现X/Z的情况下报警。可以使用
-xzcheck选项。
warning ’signal_name’ within scope hier_name in file_name.v: line_number to x/z at time
simulation_time
-ntb
Enables the use of the OpenVera Testbench language constructs described
in the OpenVera Language Reference Manual: Native TestBench.
-ntb_cmp
Compiles and generates the testbench shell (file.vshell) and shared
object files. Use this option when compiling the .vr file separately
from the design files.
-ntb_define <macro>
Specifies any OpenVera macro name on the command line. You can specify
multiple macro names using the + delimiter.
-ntb_filext <.ext>
Specifies an OpenVera file extension. You can specify multiple filename
extensions using the + delimiter.
-ntb_incdir <directory_path>
Specifies the include directory path for OpenVera files. You can specify
multiple include directories using the + delimiter.
-ntb_noshell
Tells VCS not to generate the shell file.Use this option when you
recompile a testbench.
-ntb_opts <keyword_argument>
The keyword arguments are as follows:
check
Reports error, during compilation or simulation, when there is an
out-of-bound or illegal array access.
dep_check
Enables dependency analysis and incremental compilation. Detects
files with circular dependencies and issues an error message when
VCS cannot determine which file to compile first.
no_file_by_file_pp
By default, VCS does file by file preprocessing on each input file,
feeding the concatenated result to the parser. This argument disables
this behavior.
print_deps[=<filename>]
Enter this argument with the dep_check argument. This argument tells
VCS to display the dependencies for the source files on the screen or
in the file that you specify.
tb_timescale=<value>
Specifies an overriding timescale for the testbench. The timescale
is in the Verilog format (for example, 10ns/10ns).
use_sigprop
Enables the signal property access functions. (for example,
vera_get_ifc_name()).
vera_portname
Specifies the following:
The Vera shell module name is named vera_shell.
The interface ports are named ifc_signal.
Bind signals are named, for example, as: \if_signal[3:0].
You can enter more than one keyword argument, using the + delimiter,
for example:
-ntb_opts use_sigprop+vera_portname
-ntb_shell_only
Generates only a .vshell file. Use this option when compiling a
testbench separately from the design file.
-ntb_sfname <filename>
Specifies the filename of the testbench shell.
-ntb_sname <module_name>
Specifies the name and directory where VCS writes the testbench shell
module.
-ntb_spath
Specifies the directory where VCS writes the testbench shell and shared
object files. The default is the compilation directory.
-ntb_vipext <.ext>
Specifies an OpenVera encrypted-mode file extension to mark files for
processing in OpenVera encrypted IP mode. Unlike the -ntb_filext option,
the default encrypted-mode extensions .vrp, .vrhp are not overridden,
and will always be in effect. You can pass multiple file extensions at
the same time using the + delimiter.
-ntb_vl
Specifies the compilation of all Verilog files, including the design,
the testbench shell file and the top-level Verilog module.
+maxdelays
Use maximum value when min:typ:max values are encountered in delay
specifications SDF files.
+memcbk
Enables callbacks for memories and multidimensional arrays (MDAs).
Use this option if your design has memories or MDAs and you are doing
any of the following:
o Writing a VCD or VPD file during simulation. For VCD files, at
runtime, you must also enter the +vcs+dumparrays runtime option.
For VPD files you must enter the $vcdplusmemon system task. VCD
and VPD files are used for post-processing with DVE or debugging
using SmartDebug.
o Using the VCS/SystemC Interface
o Interactive debugging with DVE
o Writing an FSDB file for Debussy
o Using any debugging interface application - VCSD/PLI (acc/pli)
that needs to use value change callbacks on memories or MDAs.
APIs like acc_add_callback, vcsd_add_callback, and vpi_register_cb
need this option if these APIs are used on memories or MDAs.
+memopt
Applies optimizations to reduce memory. For more information see the
VCS/VCSi User Guide.
+mindelays
Use minimum value when min:typ:max values are encountered in delay
specifications and SDF files.
+nospecify
Suppresses module path delays and timing checks in specify blocks.
+notimingcheck
Suppresses timing checks in specify blocks.
Options For Calling The vcd2vpd and vpd2vcd Utilities
*****************************************************
-vcd2vpd <vcd_filename> <vcdplus_filename>
Tells VCS to find and run the vcd2vpd utility that converts a VCD
file to a VPD file. VCS inputs to the utility the specified VCD
file and the utility outputs the specified VPD file.
-vpd2vcd <vcdplus_filename> <vcd_filename>
Tells VCS to find and run the vpd2vcd utility that converts a VPD
file to a VCD file. VCS inputs to the utility the specified VPD
file and the utility outputs the specified VCD file.
Environment Variables
*********************
DISPLAY_VCS_HOME
Enables the display at compile time if the path to the directory
specifies with the VCS_HOME environment.
LM_LICENSE_FILE
The complete path of the VCS license file or port@host.
PATH
On UNIX add $VCS_HOME/bin to this environment variable.
VCS_HOME
Specifies the directory where you installed VCS.
VCSI_HOME
Specifies the directory where you installed VCSi.
TMPDIR
Specifies the directory for temporary compilation files.
VCS_CC
Specifies the C compiler.
VCS_COM
Specifies the path to the VCS compiler executable named vcs1
(or vcs1.exe).
VCS_LOG
Specifies the runtime log file name.
VCS_RUNTIME
Specifies which runtime library named libvcs.a VCS uses.
VCS_SWIFT_NOTES
Enables the printf PCL command.
VCS_WARNING_ATSTAR
Specifies the number of signals in a Verilog-2001 implicit sensitivity
list that must be exceeded before VCS displays a warning. The default
limit is 100 signals.
PDF files for the VCS documentation set are in $VCS_HOME/doc/UserGuide.