[sv-bc] RE: Need for 1566 (variable number of arguments)

From: Daniel Schostak <Daniel.Schostak@arm.com>
Date: Thu Jun 03 2010 - 14:29:39 PDT

Two possible use cases that have occurred to me are:

  1) Wrapping $display (or other system tasks that take variable numbers of arguments). However, I think for this to be useful, a $vdisplay system task would be required in the same way that C has a vprintf function to take a list of arguments.
  2) Creating utility functions that can operate on a variable number of arguments (for example, calculating the maximum of an arbitrary number of variables).

(1) can be usually worked around by using $psprintf / $sformatf to pass a pre-formatted string, but this restricts what can be done easily in the wrapping function (and also means that there is the overhead of formatting the string even if the wrapping function will discard it for some reason).

(2) could be worked around by using an untyped mailbox (as mentioned in the meeting) or a list (if all the arguments can be of the same type). However, if the data to be passed to the function is not already stored in a mailbox or a list, then there would be some overhead in creating the container and then discarding it once the function call is complete. It seems plausible to me that an implementation of variable arguments could pass data more efficiently to a function that operates on an arbitrary number of variables.

I do not think either use case indicates that adding variable arguments would allow you to do something you cannot already do some other way in SystemVerilog. However, I think adding variable arguments might well allow you to write more concise and generic code. (I think that this is more so for (2) than (1), because I think it is likely that without variable arguments (2) would be solved with a less direct workaround than was suggested above for efficiency reasons.)

From, Daniel.

-----Original Message-----
From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of Little Scott-B11206
Sent: 03 June 2010 13:24
To: sv-bc@eda.org
Subject: [sv-bc] Need for 1566 (variable number of arguments)

Hi all:

Mantis item 1566 was created because of a question asked by Mike Burns,
but the question is not directly related to variable numbers of
arguments. There is minimal interest in variable numbers of arguments
within Freescale, so I don't have any additional information or
clarification in regard to the requirements for this Mantis item

Thanks,
Scott

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.
-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Jun 3 14:30:10 2010

This archive was generated by hypermail 2.1.8 : Thu Jun 03 2010 - 14:33:00 PDT