zoukankan      html  css  js  c++  java
  • nonblocking vs blocking funny example

     1 module hwscan;
     2 integer fd;
     3     initial 
     4     begin
     5       fd = $fopen("data2o.txt""w");
     6     end 
     7     always @(posedge tb.clk) begin
     8          $fwrite(fd,"hw: (int=%d,reg=%d) ",tb.Count,tb.rcnt);
     9     end
    10 endmodule

    hwsan

     1 `timescale 1ns/100ps;  
     2 module tb;
     3   reg clk;
     4   
     5   
     6   integer Count;
     7   reg [7:0] rcnt;
     8   /////////////////////
     9   integer fdt;   
    10   ////////////////
    11 
    12   initial 
    13   begin
    14     fdt = $fopen("datat.txt""w");
    15     clk=0;
    16     Count=0;
    17     rcnt = 8'h0;
    18     #10;
    19     forever
    20     #5 clk =~clk;   
    21   end 
    22   always@(posedge clk)
    23   begin 
    24     $fwrite(fdt, "tb: (integer=%d,reg=%d) ", Count,rcnt);
    25     Count=Count+1;
    26     rcnt<=rcnt+1;
    27     $fwrite(fdt, " <+1> [integer=%d,reg=%d]", Count,rcnt);
    28     if (Count==124
    29     begin
    30       $fwrite(fdt, " if {integer=%d,reg=%d} ", Count,rcnt);
    31       Count=0;
    32       rcnt<=0;
    33       $fwrite(fdt, "<=0> |integer=%d,reg=%d| ", Count,rcnt);
    34     end  
    35     $fwrite(fdt, " ");
    36   end
    37 endmodule 

     tb


     you will see the difference

  • 相关阅读:
    abstract修饰方法总结
    linux tar.gz zip 解压缩 压缩命令
    html5视频播放
    Response.Redirect 打开新窗体的两种方法
    Gmail POP3设置
    加壳学习笔记(二)-汇编基础
    C#-异常处理:tyr,catch,finally ---ShinePans
    cocos2d jsb 打包 Android APK
    编写你自己的单点登录(SSO)服务
    一分钟制作U盘版BT3
  • 原文地址:https://www.cnblogs.com/testset/p/3550089.html
Copyright © 2011-2022 走看看