[sv-bc] Confusion in function evaluation approach

From: Surya Pratik Saha <spsaha_at_.....>
Date: Wed Jul 18 2007 - 02:23:43 PDT
Hi,
     Consider the scenario

     function signed [15:0] func;
      
input [7:0] ix1,cond;   
        [...]
     endfunction


    assign in1  = func(func('sb1110111,3),func('sb11001100,2));

        Now we can follow two different approaches during propagation of value form actual to formal argument for the above function call

Approach 1:
- evaluate first argument func('sb1110111,3) and propagate the evaluated value to the corresponding formal argument of func( (func('sb1110111,3),func('sb11001100,2)).
- evaluate the second argument func('sb11001100,2) and propagate the evaluated value to
   the corresponding formal argument of func( func('sb1110111,3),func('sb11001100,2)).

By this approach - during value propagation of the second argument of function call func(func('sb1110111,3),func('sb11001100,2)) the propagated value of the first formal argument for func(func('sb1110111,3),func('sb11001100,2)) got changed due to propagation of value form actual to formal argument during evaluation of func('sb11001100,2). So after value propagation from actual to formal arguments the first formal argument of the function call func(func('sb1110111,3),func('sb11001100,2)) will contain value 'sb11001100, not evaluated value of func('sb1110111,3).

Approach 2:
 - evaluate arguments func('sb1110111,3) and func('sb11001100,2) and stores the evaluated values at the table.
- propagate the stored evaluated value to the formal arguments for func(func('sb1110111,3),func('sb11001100,2).

By this approach - first fromal argument of function call func(func('sb1110111,3),func('sb11001100,2) will contain evaluated value of func('sb1110111,3) not 'sb11001100. But this approach is similar to automatic function evaluation whereas the original function is a static one.

 LRM is not clear on function call value propagation. Can someone help me what would be the right approach. Different tools behave differently here.
-- 
Regards
Surya

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean. Received on Wed Jul 18 02:24:37 2007

This archive was generated by hypermail 2.1.8 : Wed Jul 18 2007 - 02:26:05 PDT