title: Behavior difference between always_comb and always@(*)
body: <p>I just found that always@(*) does not work as expected when it involve <code>function</code>.</p>
  
  <p>Please see simple sample code below.</p>
  
  <p><a href="http://www.edaplayground.com/x/J7M" rel="nofollow">http://www.edaplayground.com/x/J7M</a></p>
  
  <pre><code>module test;
    reg a, b, c;
  
    function reg my_func();
      if (b==0) begin
        $display("DEBUG 0 @%0t", $time);
        return a;
      end
      else if (b==1) begin
        $display("DEBUG 1 @%0t", $time);
        return ~a;
      end
      else begin
        $display("DEBUG 2 @%0t", $time);
        return 0;
      end
    endfunction
  
    always @(*) begin
    //always_comb begin
      c = my_func();
    end
  
    initial begin
      a = 0; #10;
      a = 1; #10;
      a=0; 
    end
  endmodule
  </code></pre>
  
  <p>Try to switch between <code>always @(*)</code> and <code>always_comb</code> in simulation. If I use <code>always @(*)</code>, nothing will display. But if I use <code>always_comb</code>, it will show expected result as follows:</p>
  
  <pre><code>DEBUG 2 @0
  DEBUG 2 @0
  DEBUG 2 @10
  DEBUG 2 @20
  </code></pre>
  
  <p>The above code is just simple combinational logic. 
  Why <code>always @(*)</code> and <code>always_comb</code> show different result? Is it just simulation issue? Further experiment I noticed that it may have something to do with usage of <code>function</code> inside the always block.</p>