[sv-bc] 'always_comb' safer than 'assign'

From: Brad Pierce <Brad.Pierce_at_.....>
Date: Thu Dec 15 2005 - 22:53:05 PST
It's not uncommon for the right-hand side of a continuous assignment
statement to be a function call, or to contain a function call.  If the
function depends on a global net or variable, then it's more accurate to
use always_comb, because it "is sensitive to changes within the contents
of a function".

 

For example,

 

module test(input in, output logic out1, out2);

 

  function f();

     return in;

  endfunction

 

  assign out1 = f();

  always_comb out2 = f();

 

  initial begin

    #1 $display(out1, , out2);

    force in = 1'b1;

    #1 $display(out1, , out2);

    force in = 1'b0;

    #1 $display(out1, , out2);

  end

 

endmodule

 

-- Brad

 

 

 
Received on Thu Dec 15 22:53:13 2005

This archive was generated by hypermail 2.1.8 : Thu Dec 15 2005 - 22:53:43 PST