c语言中的flag示例,Makefile简单实例讲解2---CFLAG DVCS 等参数

本文介绍了在VCS环境下,如何使用-CFLAGS -DVCS选项编译C语言源代码,特别是在涉及UVM源文件时的使用。-DVCS是一个宏定义,用于传递给gcc/g++编译器。编译过程包括vcs命令编译verilog文件生成可执行文件,然后运行该文件。此外,还提到了-v2k选项、DVE交互界面和-debug_all选项用于单步调试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

VCS

=vcs

-sverilog -fsdb_old -timescale=1ns/1ns

-gui -R \+acc +vpi +define+UVM_OBJECT_MUST_HAVE_CONSTRUCTOR

\

+incdir+$(UVM_HOME)/src

$(UVM_HOME)/src/uvm.sv (UVM_HOME)/src/dpi/uvm_dpi.cc

-CFLAGS -DVCS \+UVM_TESTNAME=hello_case +UVM_VERBOSITY=$(UVM_VERBOSITY)

-l vcs.log

-debug_all

其中,

-CFLAGS为C编译器选项。

1 编译UVM源文件时,一般使用 -CFLAGS

-DVCS 选项。

-DVCS代表为C源代码定义的宏。所有已-D开始的选项都被gcc、g++编译器当做宏来处理。和VCS编译时间的选项一起,应该传输-DVCS时加上选项-CFLAGS,这样-DVCS就可以传给gcc、g++编译器了。

如 % vcs top.v test.c -CFLAGS

-DVCS

2在哪种编译环境下,使用-CFLAGS -DVCS选项?

当我们使用外部的UVM源(库?)时,必须使用-DVCS选项。(如果使用-ntb_opts

uvm,那么就不需要-DVCS了,因为通过-ntb_opts

uvm实现了内部传输)。另外,如果C源文件中有宏以‘VCS’命名,那实现传递需要使用-CFLAGS -D。

-CFLAGS 和 -DVCS有什么用?

> How to use the gcc compiler's option "-DVCS"?

-DVCS represents a macro defined for C source code. Please note

that anything

followed by -D is treated as a macro by the gcc/g++ compiler. Along

with

VCS compile-time options one should pass -DVCS with -CFLAGS so

that

-DVCS gets passed to gcc/g++.

Example steps:% vcs top.v test.c -CFLAGS -DVCS

>> What's the compile environment that we need to use this

option?

"-CFLAGS -DVCS" is usually required during UVM source

compilation.

Therefore, if we are using an external UVM source then you must

pass -DVCS.

(If we are using -ntb_opts uvm then no need to pass this option

because it is

internally passed with -ntb_opts uvm). Also, if we have any macros

with

the name 'VCS' defined in any other C source then we need to

pass

it with -CFLAGS -D

VCS对verilog模型进行仿真包括两个步骤:

1.

编译verilog文件成为一个可执行的二进制文件命令为: vcs source_files

2. 运行该可执行文件: ./simv

类似于NC, 也有单命令行的方式:vcs source_files -R

-R 命令表示, 编译后立即执行。

vcs常用的命令选项如下:

-cm line|cond|fsm|tgl|obc|path  设定coverage的方式

+define+macro=value+      预编译宏定义

-f filename             RTL文件列表

+incdir+directory+

添加include 文件夹

-I                 进入交互界面

-l

logfile文件名

+v2k                使用推荐的标准

-o指定输出的可执行文件的名字,缺省是simv

-debug_all 单步调试

使用VCS的交互界面方式,即使用DVE,不仅可以看到DUT,还可以看到验证平台的代码。使用-debug_all单步调试选项可以看出平台运行时的执行步骤。

Verdi可以对DUT的信号进行追踪trace,但Verdi无法加载验证平台(应该是的)。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值