John if you see section 12.4.3 for default args, also 2nd form [,[..]] is supported. -- task read(int j = 0, int k, int data = 1 ); ... endtask; This example declares a task read() with two default arguments, j and data. The task can then be called using various default arguments: read( , 5 ); // is equivalent to read( 0, 5, 1 ); <<<<<<<<<<<<<<<< read( 2, 5 ); // is equivalent to read( 2, 5, 1 ); read( , 5, ); // is equivalent to read( 0, 5, 1 ); <<<<<<<<<<<<<<<< read( , 5, 7 ); // is equivalent to read( 0, 5, 7 ); read( 1, 5, 2 ); // is equivalent to read( 1, 5, 2 ); -- Thx. -Bassam. -----Original Message----- From: owner-sv-ac@eda.org [mailto:owner-sv-ac@eda.org] On Behalf Of John Havlicek Sent: Monday, January 08, 2007 9:29 AM To: dmitry.korchemny@intel.com Cc: sv-ac@eda-stds.org Subject: Re: [sv-ac] Mantis item #1591 Hi Dmitry: I also prefer the uniformity and flexibility of the second alternative. I'd like to know what other actual argument lists in the language do when argument expressions can be omitted (e.g., because there is a default). Do you know? J.H. > X-Authentication-Warning: server.eda-stds.org: majordom set sender to > owner-sv-ac@eda.org using -f > X-ExtLoop1: 1 > X-IronPort-AV: i="4.13,159,1167638400"; > d="scan'208,217"; a="182676916:sNHT1973560302" > X-MIMEOLE: Produced By Microsoft Exchange V6.5 > Content-class: urn:content-classes:message > Date: Mon, 8 Jan 2007 18:10:58 +0200 > X-MS-Has-Attach: > X-MS-TNEF-Correlator: > Thread-Topic: Mantis item #1591 > thread-index: AcczP5VbAC0ifOFNTv6GcxrUmJVV1w== > From: "Korchemny, Dmitry" <dmitry.korchemny@intel.com> > X-OriginalArrivalTime: 08 Jan 2007 16:11:03.0024 (UTC) > FILETIME=[980C2F00:01C7333F] > X-eda.org-MailScanner: Found to be clean, Found to be clean > X-Spam-Status: No, No > Sender: owner-sv-ac@eda.org > X-eda.org-MailScanner-Information: Please contact the ISP for more > information > X-eda.org-MailScanner-From: owner-sv-ac@server.eda.org > > This is a multi-part message in MIME format. > > ------_=_NextPart_001_01C7333F.95A42888 > Content-Type: text/plain; > charset="us-ascii" > Content-Transfer-Encoding: quoted-printable > > Hi all, > > =20 > > I was sure I sent this mail three weeks ago, but I cannot find it in > the reflector somehow. Therefore I am resending it now. > > =20 > > Shalom opened a Mantis item #1591: > > =20 > > The syntax of $past is described in 17.7.3 and 22.9 as=20 $past( > expression1 [, number_of_ticks] [, expression2] [, > clocking_event]) > > This is not precise as it both implies that the 3rd or 4th argument > may be present without at least the commas preceding the preceding > arguments, and also does not show that the actual argument may be > omitted as long as at least the comma is present (at least for the 2nd > and 3rd arguments). > > A more precise syntax (though harder to read) is > > $past( expression1 [, [number_of_ticks] [, [ expression2] [, > clocking_event]]] ) or > > $past( expression1 [, [number_of_ticks] [, [ expression2] [, > [clocking_event]]]] ) . > > The difference between the two is whether clocking_event may be > omitted if the last comma is present. > > =20 > > =20 > > I think that the second alternative is better: > > =20 > > $past( expression1 [, [number_of_ticks] [, [ expression2] [, > [clocking_event]]]] ) . > > > > because it makes writing scripts easier: there is no need to analyze > whether the clocking event has been provided or not; the invocation > string will remain exactly the same. > > =20 > > Here is a small Perl example: > > =20 > > sub writePastOfSig > > { > > my $clockEvent =3D shift; > > print "\$past(sig, 1, 1, $clockEvent)"; > > } > > =20 > > Both invocations > > =20 > > writePastOfSig("@(posedge clk)"); > > =20 > > and > > =20 > > writePastOfSig(); > > =20 > > will work correctly with this definition. With the first alternative > the code of writePastOfSig should be more complex. > > =20 > > The second alternative is also consistent with the syntax of the > general function invocation: > > =20 > > list_of_arguments ::=3D > > [ expression ] { , [ expression ] } { , . identifier ( [ expression ] > ) } > > | . identifier ( [ expression ] ) { , . identifier ( [ expression ] ) > | } > > =20 > > If so, the definition of other sampled value functions should be > rewritten accordingly. > > =20 > > Thanks, > > Dmitry > > -- 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 Mon Jan 8 10:58:20 2007
This archive was generated by hypermail 2.1.8 : Mon Jan 08 2007 - 10:58:26 PST