RE: [sv-bc] part selects on arbitrary expressions

From: Brad Pierce <Brad.Pierce_at_.....>
Date: Tue Mar 06 2007 - 12:35:12 PST
A safe way to isolate evaluation of an expression from its context is

       `define SELF(expr) type(expr)'(expr)

There is also a connection to the following issue

    http://www.eda-stds.org/svdb/bug_view_page.php?bug_id=0001425

-- Brad
 

-----Original Message-----
From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of
Gordon Vreugdenhil
Sent: Tuesday, March 06, 2007 10:33 AM
To: Arturo Salz
Cc: Bresticker, Shalom; Feldman, Yulik; sv-bc@eda.org
Subject: Re: [sv-bc] part selects on arbitrary expressions



Arturo Salz wrote:
> Shalom,
> 
>  
> 
> I have to agree with Yulik on this. Put aside expressions for a moment

> and consider taking a slice of the return value of a function:
> 
>             function bit [16:1] F; ... enfunction
>             reg [5:0] instr;
> 
>             always @(clk)
>                  instr = F()[8:2];
> 
> The function call is a self-determined context, so there are no 
> ambiguities as to what the semantics of the above ought to be

That is only true if you assume/require that the select binds to the
self-determined type of the expression before the context-determined
type is applied.  But that argument could be used for any expression as
long as we syntactically denote what is going on.  That is exactly what
the parenthesized expression syntax does -- (expr)[select] would be
treated as though the (expr) was self-determined (as in your function
call example) and the select would apply to that before consideration of
the context-determined type.

I won't reiterate the rest of the discussion, but I don't think function
calls are anything different, they are just simpler to recognize as a
special case.

Gord.

--
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com


-- 
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 Tue Mar 6 12:35:45 2007

This archive was generated by hypermail 2.1.8 : Tue Mar 06 2007 - 12:36:07 PST