问题信息:
VCS版本:Version L-2016.06_Full64
报错内容:
Error-[SFCOR] Source file cannot be opened
Source file "../../pre_sim/rtl/defines.v" cannot be opened for reading due
to 'No such file or directory'.
Please fix above issue and compile again.
"../../../pre_sim/tb/single_data_sync_tran.v", 14
Source info: `include "../../pre_sim/rtl/defines.v"
1 error
出现该问题的环境是我在调用某一个tb.v代码时,需要把defines.v文件也include进去。
`timescale 1ns/1ns
`include "../../pre_sim/rtl/defines.v"
module single_data_sync_tran(
input clk,
input rst_n,
input data_sync_tran_en,
input [38:0] ctrl_data,
output ctrl_bit,
output fsync,
output lsync
);
明明我的路径相对于该tb文件本身是正确的,为什么还会报错呢?
问题原因
原因是VCS在检查.v文件中的include时,是以VCS命令被执行的路径为参考的,而不是以tb文件所在的路径为参考的,如果我将上图中的
`include "../../pre_sim/rtl/defines.v"
更改为
`include "../../../pre_sim/rtl/defines.v"
就可以解决该问题,因为我执行vcs命令的文件夹层次比rtl代码所在的层次更深一级。
但是我更推荐的下面的解决办法,不需要费力记路径。
最终解决办法
去除该tb文件中的include语句,然后在file.f文件中包含该define的路径,然后vcs执行的命令中增加 -f ./file.f命令即可解决该问题。因为tb中没有直接调用该define文件,但是VCS读取的文件中又该define文件,所以依然可以找得到。
file.f文件如下图:
../../../pre_sim/rtl/defines.v
../../../syn/STANDALONE/netlist/io_top_out.v
../../../pre_sim/tb/io_top_tb.v
../../../pre_sim/tb/data_sync_tran.v
../../../pre_sim/tb/single_data_sync_tran.v
../../../pre_sim/tb/data_tran.v
../../../pre_sim/tb/sync_tran.v
/home/jiang_group_stu/pub_space/lib/SMIC180/SCC018UG_UHD_RVT_V0p4a/verilog/scc018ug_uhd_rvt.v
/home/jiang_group_stu/pub_space/lib/SMIC180/SP018_V1.5b/verilog/SP018_V1p5a.v
VCS命令如下图(其中包括读取file.f文件):
vcs -full64 -LDFLAGS -Wl,--no-as-needed \
+notimingcheck \
-timescale=1ns/1ns \
-f ./file.f \
-o simv \
-l ./comp.log \
-debug_access+r \
-LDFLAGS \
-rdynamic \
-fsdb