Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - Follow-up on text processing functions

 
Thread Tools Search this Thread
Old 03-31-2007, 11:17 PM   #1
Default Follow-up on text processing functions


OK, I'm stuck; time to expose my ignorance.

I said that you can't have a function parameter of
class VARIABLE, even when it's of mode IN:

function is_empty(variable S: in string) ---illegal
function is_empty(S: in string) --- legal

And two different simulators agree. But then I
remembered that of course you *can* have function
input parameters of class SIGNAL; if this were not
true, then it would be impossible to write function
RISING_EDGE, for example.

The relevant bit of LRM is 1076-2002 clause 2.1.1.
It clearly says that function parameters must be
mode IN and can be CONSTANT or SIGNAL class
(or FILE, which of course is somewhat special).

Does anyone have any idea why VARIABLE is
outlawed here? It's completely mysterious to me.
The IN restriction would make any such variable
parameters read-only, as required by common sense.

Yours confused
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK

http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.


Jonathan Bromley
  Reply With Quote
Old 04-01-2007, 06:32 AM   #2
Mike Treseler
 
Posts: n/a
Default Re: Follow-up on text processing functions
Jonathan Bromley wrote:

> Does anyone have any idea why VARIABLE is
> outlawed here? It's completely mysterious to me.
> The IN restriction would make any such variable
> parameters read-only, as required by common sense.


Hmmm. What if the variable were an access type?


-- Mike Treseler




Mike Treseler
  Reply With Quote
Old 04-01-2007, 10:47 AM   #3
Jonathan Bromley
 
Posts: n/a
Default Re: Follow-up on text processing functions
On Sat, 31 Mar 2007 22:32:45 -0700, Mike Treseler
<> wrote:

>Jonathan Bromley wrote:
>
>> Does anyone have any idea why VARIABLE is
>> outlawed here? It's completely mysterious to me.
>> The IN restriction would make any such variable
>> parameters read-only, as required by common sense.

>
>Hmmm. What if the variable were an access type?


"const ref" vs. "ref const"....

I suppose there would then be no way to stop me taking a
copy of the access variable and using the copy to
mess with the object, thus giving the function side effects.
But it surely should be permissible for an impure function?
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK

http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.


Jonathan Bromley
  Reply With Quote
Old 04-02-2007, 06:10 PM   #4
Mike Treseler
 
Posts: n/a
Default Re: Follow-up on text processing functions
Jonathan Bromley wrote:

> "const ref" vs. "ref const"....
>
> I suppose there would then be no way to stop me taking a
> copy of the access variable and using the copy to
> mess with the object, thus giving the function side effects.
> But it surely should be permissible for an impure function?


It should be.
I use local impure functions
for synthesis and simulation because
I like the clarity of a return value
lacking in a procedure call.

-- Mike Treseler


Mike Treseler
  Reply With Quote
Old 04-12-2007, 01:38 AM   #5
Mike Treseler
 
Posts: n/a
Default Re: Follow-up on text processing functions
> Jonathan Bromley wrote:
>
>> "const ref" vs. "ref const"....
>>
>> I suppose there would then be no way to stop me taking a
>> copy of the access variable and using the copy to
>> mess with the object, thus giving the function side effects.
>> But it surely should be permissible for an impure function?


Mike Treseler wrote:

> It should be.
> I use local impure functions
> for synthesis and simulation because
> I like the clarity of a return value
> lacking in a procedure call.


.... or maybe SIGNAL class is provided to functions
just to scope in the signal attributes.

The default CONSTANT class works fine to
pass the *value* of a signal or variable
to a function.

What is lost by disallowing a VARIABLE class
for function formals is the possibility
to specify that the actual
*must* be a variable.

-- Mike Treseler


Mike Treseler
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Give you enough string functions in Java web reporting tool freezea Software 0 10-08-2009 09:03 AM
Put cursor at the end of input text peace2007 Software 1 10-17-2007 11:41 AM
Memories on TV 3 and Text alca11 Software 0 07-20-2006 09:32 PM
SONY DVD RW DW-G120A SOMETIMES FAILS...... atlantic965 DVD Video 0 06-18-2006 10:36 PM
Burn process failed - help! Log file posted for help troubleshooting Michael Mason DVD Video 1 08-16-2004 09:24 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46