报错信息
Launch HLS failed! Please see vivado_hls.log for details.
查看vivado_hls.log
若是在Linux下,可以使用find
命令查找该log文件在哪里:在工程项目目录下运行find . -name vivado_hls.log
若是在Windows下,可以使用Everything进行搜索。
注:我自己的场景无法复现了,这里引用Xilinx支持论坛上的
vivado_hls.log
的报错信息(链接:https://support.xilinx.com/s/question/0D52E00006uxy49SAA/vivado-fails-to-export-ips-with-the-error-message-bad-lexical-cast-source-type-value-could-not-be-interpreted-as-target?language=en_US)
在vivado_hls.log
的尾部,有如下报错信息:
source run_ippack.tcl -notrace
bad lexical cast: source type value could not be interpreted as target
while executing
"rdi::set_property core_revision 2201031408 {component component_1}"
invoked from within
"set_property core_revision $Revision $core"
(file "run_ippack.tcl" line 989)
INFO: [Common 17-206] Exiting Vivado at Mon Jan 3 14:08:25 2022...
ERROR: [IMPL 213-28] Failed to generate IP.
command 'ap_source' returned error code
注意到若其中有source type value could not be interpreted as target
字样,并且通常还会带有日期数字(在上方报错信息中便是2201031408
),那么可以接着往下读了。
如果不是这个报错,本文可能不适用,请自行根据报错信息进行搜索。
出错原因
参考了这一篇和这一帖的内容,大抵了解到这是由int32
引发的Bug。
32位有符号数,其可以表示的最大整数为2147483647
(0x7FFFFFFF
),而在上面的报错信息中,出现了日期数字2201031408
,显然是要大于2147483647
的,因而出问题了。
解决方案
由于诱发问题的数字和当前日期有关,所以最直接的方式是调整系统时间到20年的某天(这样生成的日期数字就是20xxxx
,不会大于2147483647
)。
也可以使用faketime
工具,若是在Ubuntu下,可以执行如下命令安装:
sudo apt install faketime
然后使用faketime
,指定时间,打开Vivado
记得先把Vivado的bin目录放到环境变量里唷
faketime "2020-01-01 00:00:00" vivado