微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 嵌入式设计讨论 > FPGA,CPLD和ASIC > Active-HDL 是前仿真吗?

Active-HDL 是前仿真吗?

时间:10-02 整理:3721RD 点击:
写了一个程序,代码如下:

  1. //在两个进程中进行阻塞赋值,观察时候有先后顺序;并观察testbench的结果,以判断testbench是前仿还是后仿
  2. module test9(clk,rst,in,temp,out);
  3. input clk,rst;
  4. input [1:0] in;
  5. output reg [1:0] out;
  6. output reg [1:0] temp;

  7. always @(posedge clk or negedge rst)
  8.         if(!rst)
  9.                 temp=in;
  10.                 else
  11.                 temp=temp+1;

  12. always @(posedge clk or negedge rst)
  13.         if(!rst)
  14.                 out=0;
  15.                 else
  16.                 out=temp;
  17. endmodule

复制代码



经过综合,RTL图如下:



可见out和temp的赋值是同时进行的,没有先后顺序,若使用非阻塞型的赋值,情况也是如此;
用Active-HDL的testbench进行仿真,代码如下:

  1. //-----------------------------------------------------------------------------
  2. //
  3. // Title       : test9_1
  4. // Design      : test9
  5. // Author      :
  6. // Company     :
  7. //
  8. //-----------------------------------------------------------------------------
  9. //
  10. // File        : test9_1.v
  11. // Generated   : Fri May 17 10:59:29 2013
  12. // From        : interface description file
  13. // By          : Itf2Vhdl ver. 1.22
  14. //
  15. //-----------------------------------------------------------------------------
  16. //
  17. // Description :
  18. //
  19. //-----------------------------------------------------------------------------
  20. `timescale 1 ns / 1 ps

  21. //{{ Section below this comment is automatically maintained
  22. //   and may be overwritten
  23. //{module {test9_1}}
  24. module test9_1 ();
  25. //}} End of automatically maintained section

  26. // -- Enter your statements here -- //
  27. reg clk,rst;

  28. reg [1:0] in;
  29. wire [1:0] out,temp;

  30. initial
  31.         begin
  32.         rst=1;
  33.         #10 rst=0;
  34.         #10 rst=1;
  35. end                       

  36. initial
  37.         clk=0;

  38. always
  39.         #5 clk=~clk;       

  40. initial
  41.         in=0;  

  42.        
  43. test9 cc(clk,rst,in,temp,out);       
  44. endmodule


  45. //在两个进程中进行阻塞赋值,观察时候有先后顺序;并观察testbench的结果,以判断testbench是前仿还是后仿
  46. module test9(clk,rst,in,temp,out);
  47. input clk,rst;
  48. input [1:0] in;
  49. output reg [1:0] out;
  50. output reg [1:0] temp;

  51. always @(posedge clk or negedge rst)
  52.         if(!rst)
  53.                 temp=in;
  54.                 else
  55.                 temp=temp+1;

  56. always @(posedge clk or negedge rst)
  57.         if(!rst)
  58.                 out=0;
  59.                 else
  60.                 out=temp;
  61. endmodule

复制代码



仿真结果时序图如下:



out和temp是同步进行输出,所以我判断改仿真为前仿真,没有考虑D触发器的计算时间。

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

网站地图

Top