RE: [sv-bc] confusion in determining the type of an self determined binary expression during evalution of type operator

From: Brad Pierce <Brad.Pierce_at_.....>
Date: Mon Oct 15 2007 - 04:22:08 PDT
Sumay,

I don't see why it should make a difference whether the expression is
the operand of a type operator or used, say, as the index in an indexed
part-select, or as the right-hand side of a parameter assignment.  In a
given scope, an expression usually just has one self-determined type.

In your example, the self-determined type of "a+6" is "integer".  And
the self-determined type of "a+int'(6)" would be "int".

But I don't know what the self-determined type of, say, "{3{2'b01}}" is,
so neither do I know the result of "type({3{2'b01}})".  I could say the
same even for "2'b01" and "type(2'b01)".  Is it legal to apply "$left"
to a literal?  If it's legal, what is "$left(2'b01)"?

The reason I say 'usually' in the first paragraph is because I'm not
sure about an expression like "x.y" in the following --

// Should the test_bit be 0 or 1?

module test(output test_bit);

struct { int y; } x;
assign x.y = 0;

generate
  if ( 1 ) begin : GEN
    assign test_bit = x.y;
    struct { byte y ; } x;
    assign x.y = 1;
  end
endgenerate

initial begin
  #1 $display("test_bit == %d", test_bit);
end

endmodule

-- Brad

-----Original Message-----
From: Sumay Guin [mailto:sumay@cal.interrasystems.com] 
Sent: Monday, October 15, 2007 3:43 AM
To: Brad Pierce
Cc: sv-bc@eda-stds.org
Subject: Re: [sv-bc] confusion in determining the type of an self
determined binary expression during evalution of type operator

Hi Brad,
               I cannot understanding your reply. I want to know what
will be the  type of a  self determined binary  or  concatination
expression when they are used in type operator. Please let me know
whether  you understand my query or not .

Thanks,
Sumay
Brad Pierce wrote:

>Sumay,
>
>The LRM says that "The type operator applied to an expression shall 
>represent the self-determined result type of that expression."  So you 
>are asking about how to calculate the self-determined type of an 
>expression.  The type operator is just one of many contexts where a 
>self-determined context must be calculated.  Two common such contexts 
>in Verilog are concatenations and parameter declarations.
>
>-- Brad
>
>-----Original Message-----
>From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of 
>Sumay Guin
>Sent: Monday, October 15, 2007 2:53 AM
>To: sv-bc@eda-stds.org
>Subject: [sv-bc] confusion in determining the type of an self 
>determined binary expression during evalution of type operator
>
>Hi,
>      Consider the usage of type operator,
>      int a,b;
>      byte  c ;
>      b = type(a + 6 )'(c);
>
>      so , what will  be  the type of self determined binary expression

>( here a+6 ) when we try to find out it's type using type operator.
>      Also in case if user specified concatination/multiple 
>concatination expression in type operator then what will be the type of

>the
>      concatination/multiple concatination expression ? As LRM does not

>state it clearly, Can someone tell me what would be the type of
>      above expressions.
>
>Thanks ,
>Sumay
>    
>       
>     
>    
>
>
>
>
>--
>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 Oct 15 04:22:31 2007

This archive was generated by hypermail 2.1.8 : Mon Oct 15 2007 - 04:22:45 PDT