Vivado下用Xilinx自带的仿真器进行仿真,测试文件里调用了$fopen打开数据文件,并进行读取。fp的返回值为0,文件打开失败。
initial begin
fp = $fopen("sim_input.txt", "r");
if (!fp) begin
$display("can not open sim_input.txt");
$finish;
end
解决办法是将数据文件放入到对应的仿真目录下:
\sim_1\impl\func\xsim
\sim_1\synth\func\xsim
。。。