如何在 systemverilog 文件中 运行 shell 脚本

How to run shell script in systemverilog file

我有这个系统verilog代码。此 verilog 代码需要 运行 shell 脚本,此 shell 脚本将 运行 perl 脚本。我的编译失败了,因为它没有生成我的输出文件 output.sv。下面是我的verilog代码

module check_value( dut_if if );

   //Run shell script
   $system($sformatf("sh my_shell.sh"))

  //Output from the shell script   
   `include "output.sv";

endmodule

同样在这里,我提供了我的 shell 脚本。以防万一,它需要。

 #!/usr/bin/tcsh -f

 unset PROJECT
 perl my_perl.pl
  1. $system 是需要在程序代码块内调用的函数,例如 initial
  2. 在编译所有源代码并处理 `include 个文件后,该调用在运行时执行
  3. output.sv 存在之前,您的代码不会编译。

因此您需要将脚本执行放在模拟脚本之外。