Re: [sv-ac] Recursive instantiation of let

From: Surya Pratik Saha <spsaha@cal.interrasystems.com>
Date: Thu Mar 08 2012 - 07:59:04 PST
Hi Kausik,
There is a difference between function and 'let'. 'Let' body gets substituted/replaced by its actual, like macro. But function gets evaluated.

Now LRM is not clear when another 'let' is used in actual of 'let', what will be the order of substitution. If actual of top level 'let'  is expanded first, then it becomes a recursive instantiation inside the 'let' body itself as Alok explained. But if actual of bottom level 'let' is expanded first as Dhiraj explained, then it is not a recursive instantiation.

However I have filed Mantis 4071 for LRM fix.

Regards
Surya

-------- Original Message  --------
Subject: Re: [sv-ac] Recursive instantiation of let
From: datta.kausik@gmail.com
To: Surrendra Dudani <Surrendra.Dudani@synopsys.com>, 'Surya Pratik Saha' <spsaha@cal.interrasystems.com>, Dhiraj Kumar Prasad <dhiraj@cadence.com>
Cc: Alok Kumar Sinha <aksinha@cal.interrasystems.com>, "sv-ac@eda.org" <sv-ac@eda.org>
Date: 3/8/2012 9:27 AM
Surya,

You are misinterpreting the definition of recursion.

Passing a non recursive function call as actual to the same function call doesn't make it recursive.

Thanks
Kausik

--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Surrendra Dudani <Surrendra.Dudani@synopsys.com> wrote:

I think the statement “Recursive let instantiations are not permitted” should be clarified.

Surrendra

 

From: owner-sv-ac@eda.org [mailto:owner-sv-ac@eda.org] On Behalf Of Surya Pratik Saha
Sent: Wednesday, March 07, 2012 9:23 AM
To: Dhiraj Kumar Prasad
Cc: Alok Kumar Sinha; sv-ac@eda.org
Subject: Re: [sv-ac] Recursive instantiation of let

 

Hello Dhiraj,
Thanks for your reply. But LRM does not clearly mention that recursive instantiation restriction is applicable to 'let' body only. When you try to expand the 'let' formal with 'actual' then in your case, it becomes a recursive call of that 'let'. Am I missing anything?

Regards
Surya


-------- Original Message  --------
Subject: Re: [sv-ac] Recursive instantiation of let
From: Dhiraj Kumar Prasad <dhiraj@cadence.com>
To: Alok Kumar Sinha <aksinha@cal.interrasystems.com>, sv-ac@eda.org <sv-ac@eda.org>
Cc: Dhiraj Kumar Prasad <dhiraj@cadence.com>
Date: 3/7/2012 4:41 PM

Hello Alok,

 

Recursive let instantiation is not permitted as it may result in infinite call but again this is w.r.t to let body not w.r.t usage of let.

 

For your second example i.e usage

 

assign  x = myxor( myxor(a) ,  myxor(b) );


The number of argument for internal myxor is 1 in place of 2 and neither have default value. So it will raise error. Might you tried to write something like

 

assign x = myxor(myxor(a,b), myxor(c,d));

 

LRM clearly says that the let construct get expanded with actual argument replacing formal argument, which here stand for the replacement till any let construct

expansion is required.

 

So the above usage will be replaced with

       myxor(a,b) = ((a+b) + (c+d));

which is always legal.

 

Regards,

dhiRAj




 

From: owner-sv-ac@eda.org [mailto:owner-sv-ac@eda.org] On Behalf Of Alok Kumar Sinha
Sent: Wednesday, March 07, 2012 2:50 PM
To: sv-ac@eda.org
Subject: [sv-ac] Recursive instantiation of let

 

Hi,

According to LRM section 11.13,

"The let body gets expanded with the actual arguments by replacing the formal arguments with the actual
arguments. Semantic checks are performed to verify that the expanded let body with the actual arguments
is legal. The result of the substitution is enclosed in parentheses (...) so as to preserve the priority of evaluation
of the let body. Recursive let instantiations are not permitted."

So, it is clear that

(1) let myxor(a, b) = myxor(a) + myxor(b);

is illegal since it is having same let instantiation in its body.

Now if there is a case where a let is defined as,

(2) let myxor(a, b) = a + b;

, and for a let instantiation like

assign  x = myxor( myxor(a) ,  myxor(b) );

Will it be expanded to :
let myxor(a, b) = myxor(a) + myxor(b);

I other words, does that mean - the instantiation becomes recursive.

According to my interpretation, when formal arguments get replaced with the actuals in the let body, it will result in
a let defined as in (1), and hence should become recursive.

Anyone, please confirm if my understanding is correct or if I am missing anything.

Thanks and Regards
Alok
 


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean. Received on Thu Mar 8 08:00:25 2012

This archive was generated by hypermail 2.1.8 : Thu Mar 08 2012 - 08:00:42 PST