微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 微电子和IC设计 > IC验证交流 > NC和VCS在编译时出现不同的结果

NC和VCS在编译时出现不同的结果

时间:10-02 整理:3721RD 点击:

  1. `timescale 1ns/10ps

  2. program test_dis(input [7:0] data);
  3. initial
  4. $display("@%0t, PROGRAM : data = %d", $time, data);
  5. endprogram

  6. module tb();
  7. reg [7:0] data;
  8. reg clk;

  9. initial
  10. begin
  11. #0clk = 0;
  12. data = 0;
  13. #20 $stop;
  14. end

  15. always #5 clk = ~clk;

  16. always @ (negedge clk)
  17. begin
  18. data <= $random%128;
  19. $display("@%0t, DISPLAY : data = %d", $time, data);
  20. end

  21. test_dis u1(data);

  22. endmodule

复制代码


代码如上,利用NC编译,可以得到相应的结果:(PS:如何让仿真时间不在0时刻停止呢?为什么会隐形调用finish呢?)




但是利用VCS编译的时候,会有如下error:


只能说明,VCS的语法检查更严格。尽管仿真结果都非预期。
用 program test_dis(input bit[7:0] data); 试试?

一样的有误。logic一样的会报错。

Sorry, I did not see your code carefully before. Yes, SV does supports default bit argument declaration
And I also checked your code again, it should not be any difference with IRUN and VCS. Actually, it is proved in my site.
The reason why your code did not run is that you used PROGRAM structure but you did not put any timing procedure inside it. The whole testbench will finish after the last initial block of PROGRAM is run. So it means you code will always be done at #0. If you put the code #20 stop inside the initial block of PROGRAM. You problem can be resolved.

工具不同,选项也不一样!如果纯粹为了检查语法及综合性,最好用专门的工具!VCS 和 NC只是一个simulator而已!

是的,今天我也发现了这个原因。软件和硬件的描述思维方式确实不一样啊

systemverilog中,program为主进程,当program执行完毕时,会自动finish。你在0ps停止仿真,是因为你program中的initial中,只有1个display它结束你的仿真就结束了。
你vcs用的什么版本的?不同版本的仿真器或者不同的仿真器,对sv的语法结构实现的程度和认可度是不一样的,不能因为这个就说什么仿真器语法检查更为严格。我在vcs2012.09的手册中,看到如下结构:



说明vcs是完全支持这个结构的。
拿ius9.2来说,它还无法支持program带有lifetime参数呢,你能说它语法检查更严格吗?

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top