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

  • 相关阅读:
    IOC
    paxos算法
    搜索引擎相关
    java常识
    Redis相关概念
    Keepalived简单理解
    LVS简单理解
    dbproxy
    用不上索引的sql
    二叉树、B树、B+树、B*树、VAL树、红黑树
  • 原文地址:https://www.cnblogs.com/testset/p/3550089.html
Copyright © 2011-2022 走看看