RE: [sv-ac] 1728 mantis: "let" construct vs function

From: Rich, Dave <Dave_Rich_at_.....>
Date: Mon Apr 07 2008 - 08:31:42 PDT
There may be contexts where certain argument types are not allowed, just
as immediate assertions will have restrictions on what could be used
inside a let.

 

________________________________

From: owner-sv-ac@server.eda.org [mailto:owner-sv-ac@server.eda.org] On
Behalf Of Bresticker, Shalom
Sent: Monday, April 07, 2008 7:56 AM
To: Mirek Forczek; sv-ac@server.eda.org
Subject: RE: [sv-ac] 1728 mantis: "let" construct vs function

 

There are several advantages to let over parameterized tasks and
functions (which have not been done yet because it is not trivial to do
so). Others can explain them better than I. One example, though, is that
let arguments can be sequences and properties. Another is their context
sensitiveness.

 

Shalom

	 

	
________________________________


	From: owner-sv-ac@server.eda.org
[mailto:owner-sv-ac@server.eda.org] On Behalf Of Mirek Forczek
	Sent: Monday, April 07, 2008 5:34 PM
	To: sv-ac@server.eda.org
	Subject: [sv-ac] 1728 mantis: "let" construct vs function

	Hi,

	 

	The 1728 mantis introduces 'let' construct: the motivation is
given as:

	 

	"Including let expressions into packages (See Clause 25) is a
natural way to implement a well-structured customization for
assertions."

	 

	there is an example also:

	 

	// in a package
	let at_least_two(sig, rst = 1'b0) = rst || ($countones(sig) >=
2);

	
	// in a design
	reg [15:0] sig1; reg [3:0] sig2;
	    always_comb begin
	        q1: assert (at_least_two(sig1));
	        q2: assert (at_least_two(~sig2));
	    end

	 

	 

	I'm wondering if the same could be achieved just with functions
(?):

	 

	// in a package
	function automatic bit at_least_two(sig, rst = 1'b0);

	    return rst || ($countones(sig) >= 2);

	endfunction

	
	// in a design (no change at all vs 'let' version)
	reg [15:0] sig1; reg [3:0] sig2;
	    always_comb begin
	        q1: assert (at_least_two(sig1));
	        q2: assert (at_least_two(~sig2));
	    end

	 

	 

	Are there any other benefits in having 'let' construct over
already existing 'function' ?

	 

	If it is about unbounded argument types in 'let' construct, a
parametrized function and tasks shall be considered as an alternative.

	They shall provide same flexibility as the "let" construct but
they would be an extension of an existing concept (function, task)
instead of a brand new one (let).

	The parametrized function and tasks extension (functions and
tasks with #parameters - in particular: with type parameters) would be
consistent with already intorduced concpet of the parametrized classes -
and their methods in particular.

	 

	 

	Regards,

	Mirek

	  

	
	-- 
	This message has been scanned for viruses and 
	dangerous content by MailScanner <http://www.mailscanner.info/>
, and is 
	believed to be clean. 

---------------------------------------------------------------------
Intel Israel (74) Limited
 
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

-- 
This message has been scanned for viruses and 
dangerous content by MailScanner <http://www.mailscanner.info/> , 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 Mon Apr 7 08:32:41 2008

This archive was generated by hypermail 2.1.8 : Mon Apr 07 2008 - 08:32:58 PDT