仿真(Simulation)

1.4.1 如何执行仿真

%> ./simv <runtime_options>
Run-time 选项可以用来控制仿真行为的切换

  • User-defined run-time controls(plusargs)
  • Control VPD or FSDB creation
  • Modify assertion behaviors (-sva等)
  • Collect code coverage (-cov)

但是有些仿真选项并不是说用就能用,simv的执行,很多时候依赖于你执行vcs命令(编译步骤)时,所附加的选项,例如dump波形,就需要在编译时,加上使能dump波形的选项。

Common simv Options
  • +<runtime_args> -Specify simulation runtime plusargs
  • -l -Create runtime log file
  • +ntb_random_seed=# -Specify default random seed for simulation
  • -verdi -Start Verdi interactive debug session
  • -gui -Start interactive GUI session
  • -ucli -Stop at Tcl prompt upon start-up
  • -do <run.tcl> -Execute specified Tcl script upon start-up
  • -cm -Enable coverage options
仿真的模式

在仿真阶段,有两种模式,交互式模式和批处理模式。
每种模式,对应的调试方法大致相同,但是联调的交互式模式能做的更多,但是整个流程会更慢一些。
在联调的交互式模式下,你可以进行如下操作:

  • 查看波形
  • 比较波形
  • trace驱动和负载
  • 查看原理图
  • 执行UCLI/Tcl命令
  • 设置断点(行,时间,事件等)
  • 行调试

在后处理模式下,你可以进行如下操作:

  • 查看波形
  • 比较波形
  • trace驱动和负载
  • 查看原理图

如果想在仿真时,使用调试功能,不管哪一种调试模式,首先都需要在编译或者elaboration的时候,使能debug mode。
VCS MX为调试模式提供以下编译选项:
-debug_pp,-debug,-debug_access(+), -debug_all,-debug_region =()(+)

  • 在部分调试模式下elab设计
    vcs -debug [compile_options] TOP

  • 在完全调试模式下elab设计
    vcs -debug_all [compile_options] TOP

  • 用所需的调试功能来elab设计
    vcs -debug_access<+options> [compile_options] TOP

你可以在编译时使用-debug_access选项来更好地控制仿真中调试的功能。
与-debug_pp选项相比,-debug_access选项允许存储VPD和FSDB文件以进行后处理调试,并减少不必要的调试选项。
你可以使用-debug_access+指定其他选项,以有选择地启用所需的调试功能。 只启用所需的调试功能,即可优化仿真性能。
debug_access(+<option>)*

-debug_access支持的选项

OptionDescription
rThe -debug_access+r option enables the read capability for the entire design.
wThe -debug_access+w option applies write (deposit) capability to the registers and variables for the entire design.
wnThe -debug_access+wn option applies write (deposit) capability to the nets for the entire design.
fThe -debug_access+f option enables the following: Write (deposit) capability on registers and variables.Force capability on registers, variables, and nets.This option is equivalent to -debug_access+w+fn
fnThe -debug_access+fn option applies force capability to the nets for the entire design.
fwnThe -debug_access+fwn option applies write (deposit) and force capability to all nets in the design.
lineThe -debug_access+line option enables line debugging. It allows you to use the commands for step/next and line breakpoints.This option is equivalent to -debug_access+pp -line
cbkThe -debug_access+cbk option enables PLI-based callbacks on static nets, registers, and variables.
cbkdThe -debug_access+cbkd option enables both dumping and PLI-based callbacks on dynamic nets, registers, and variables.
threadThe -debug_access+thread option enables the debugging of the SystemVerilog threads.
classThe -debug_access+class option is equivalent to the following command:-debug_access+r+w+thread+class+line+cbk+cbkd.The -debug_access+class option enables testbench debug capabilities.
nomemcbkThe -debug_access+nomemcbk option disables callbacks for memories and multidimensional arrays (MDAs). By default,-debug_access enables callbacks for memories and MDAs.
dmptfThe -debug_access+dmptf option enables dumping of task/function ports and internal nodes/memories for the entire design.
ppThe -debug_access+pp option is equivalent to the following command:-debug_access+w+cbk+drivers.The -debug_access+pp option enables debug capabilities equal to -debug_pp (except for no thread debugging and dumping of task/function signals, and does not apply capability inside cells and encrypted modules).
allThe -debug_access+all option is equivalent to the following commands:-debug_access+line+class+wn+driver+r+w+cbk+f+fn+thread+cbkd.The -debug_access+all option enables debug capabilities equal to -debug_all (except it does not apply capability inside cells and encrypted modules).
reportThe -debug_access+report option enables the reporting of the global debug capability diagnostics.

在上面的选项中,存在-debug_access+pp, -debug_access+all的选项,你或许会有疑问,为什么会有-debug_pp -debug_all 选项呢? 感觉似乎有重复定义的嫌疑.
其实“-debug_access”是VCS从2014.03版本开始为用户提供的一个新选项.
下面要讲的“-debug_region”是在-debug_access之上VCS的2015.09发行版提供的一个新选项。
旧版的VCS调试更加易于使用,并在仿真运行时性能上进行权衡。 但是,运行时性能是提高用户工作效率的关键。 考虑到这一点,较新版本的VCS带来性能更有效的调试方法。
使用新调试选项(-debug_access和-debug_region)的有效调试方法可用于实现具有所需调试可见性的新性能,从而优化仿真运行时性能。
所以所有的一切都在于精细化控制,提高仿真效率。所以,尽量改用最新的优化的debug选项吧。

与-debug_access配合可以使用-debug_region来控制-debug_access指定的功能作用的范围,从而进一步提高了运行时性能
-debug_region选项使你能够将调试功能应用于设计的所需部分[DUT,单元,TB和标准包(OVM,UVM和RAL)或加密实例(模块,程序,包和接口)]。
编译时必须和-debug_access选项一起使用-debug_region选项。 以下是-debug_region的语法:
-debug_access(+ <option>)* -debug_region =(<option>)(+ <option>)*

-debug_region支持的选项

OptionDescriptionDefault Functionality if -debug_region is not specified
libApplies debug capabilities to the cells inside libraries.Debug capability is not applied to the libraries.
cellApplies debug capabilities to the cells.Debug capability is not applied to the cells.
encryptApplies debug capabilities to the fully-encrypted instances (modules, programs, packages, and interfaces).Debug capability is not applied to the fully-encrypted
tbApplies debug capabilities only to the testbench, but does not apply debug capabilities to the standard packages. It does not apply debug capability to the standard packages. The VPD/FSDB dumping of the DUT is not affected by this option.Debug capability is applied to testbench and DUT.
dutApplies debug capabilities only to the non-testbench objects.Debug capability is applied to testbench and DUT.
stdpkgApplies debug capabilities to the standard packages. You must use the stdpkg option in combination with the tb option. VCS issues a warning message if you use -debug_region=stdpkg only. The -debug_region=tb+stdpkg option applies debug capabilities to both testbench and standard packages.Debug capability is applied to the standard packages.

examples:
-debug_access+class -debug_region=tb
仅将类调试功能应用于测试平台。 调试功能不适用于标准软件包
-debug_access+force -debug_region=dut
将force调试功能应用于DUT
-debug_access+class -debug_region=tb+stdpkg
将调试功能应用于TB和标准软件包

TB的定义

  • SystemVerilog程序(program)/包(package)实例是测试平台的一部分。 在程序/包块内声明的所有对象都被视为测试平台的一部分。
  • 如果模块(module)包含以下任何元素,则SystemVerilog模块(包括在模块块内声明的所有对象)被视为测试平台的一部分:
  • 类定义
  • 动态或关联数组的声明
  • 智能队列的声明
  • 类变量的声明
  • 导入部分或者全部包(package)
  • 包含时钟块或上述点中提到的元素(类定义,动态数组等)的SystemVerilog接口实例是测试平台的一部分。 在接口块内声明的所有对象都被视为测试平台的一部分
simv在错误结果上返回非零值

VCS MX生成的simv可执行文件在出现错误,致命错误和断言失败时返回非零值。
simv可执行文件返回错误,致命错误和断言值的值为:

  • 0(无指示)
  • 1(如运行时崩溃或系统崩溃)
  • 2(错误)
  • 3(致命)

下表列出了可能的场景和返回的错误值:

ScenarioReturn Error Value
$fatal/UVM_FATAL/OVM_FATAL/VMM_FATAL3
$error/UVM_ERROR/ OVM_ERROR/ VMM_ERROR/ Errors promoted from warning messages to errors2
Assertion failure Verilog2
$warning /UVM_WARNING/ OVM_WARNING/ VMM_WARNING0
Unique/priority RT warnings0
-xzcheck0

使用时,只需在simv命令后,添加-exitstatus选项即可,命令如下:

%> simv -exitstatus
%> echo $status
UCLI (Unified Command line interface)

统一命令行界面(UCLI)为交互式仿真提供了一组通用命令。 UCLI是VCS MX中批处理模式调试的默认命令行界面。
UCLI命令基于Tcl,因此你可以使用任何带有UCLI的Tcl命令。 你还可以编写Tcl程序并在UCLI提示符下执行它们。 使用UCLI命令,您可以执行以下操作:

  • 控制仿真
  • 存储VPD/FSDB波形文件
  • 保存/恢复仿真状态
  • force/release信号
  • 可以使用断点,范围/线程信息和内置宏调试设计

VCS has two command line I / F
-CLI: Command line I / F for Verilog (default)
-UCLI: Multi-language compatible TCL-based command line I / F
Support from VCS 2005.06
Available for DVE/Verdi debug
Compared to conventional CL I command
You can use the TCL command
Can be controlled with common commands even in Verilog/VHDL mixed environment

Can be specified at simv runtime
%> simv –ucli –i cmd.lst
cmd.lst

run 1000 ns
finish
UCLI commands examples
CommandDescription
finishFinishes/ends processing in the tool
forceForces a value onto a variable
getReturns the current value of the specified variable
runAdvances the tool to a specific point

More info:

Unified Command Line Interface User Guide in the SolvNet
“Using UCLI” in VCS® MX/VCS® MXi™ User Guide

  • 5
    点赞
  • 30
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
当涉及到钢板库的仿真实例时,Plant Simulation(工厂仿真软件)可以用于模拟钢板库的运作。以下是一个简单的钢板库仿真实例: 假设我们有一个钢板库,其中包含不同尺寸和厚度的钢板。我们想要了解如何优化钢板库的布局和作业流程,以提高生产效率。 首先,我们需要建立一个模型来表示钢板库的物理结构。我们可以使用Plant Simulation中的建模工具来创建钢板库的平面图。在平面图中,我们可以添加表示钢板的对象,并设置它们的属性,如尺寸、厚度等。 接下来,我们需要定义钢板库的作业流程。这包括钢板的入库、出库、移动和存储等操作。我们可以使用Plant Simulation中的模拟元件来模拟这些操作。例如,我们可以创建一个入库站点和一个出库站点,并定义它们之间的移动路径。 然后,我们可以设置一些仿真参数,如钢板的到达速率、作业时间等。这些参数可以通过历史数据或实际观察来估计。 最后,我们可以运行仿真并收集数据。通过仿真运行的结果,我们可以评估不同布局和作业策略对钢板库性能的影响。我们可以分析钢板库的利用率、等待时间、作业效率等指标,并根据这些指标进行优化。 总结起来,Plant Simulation可以用于钢板库的仿真,帮助我们理解和优化钢板库的运作方式。通过模拟不同的场景和策略,我们可以找到最佳的布局和作业流程,以提高生产效率。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值