RE: [sv-ac] Re: [sv-bc] Re: if-else

From: Arturo Salz <Arturo.Salz_at_.....>
Date: Thu Nov 01 2007 - 11:35:14 PDT
John,

I believe it can happen with parameters (example below) and dynamically
sized types.

   module M #(size = 8) (input logic clk);
     logic [size-1:0] v;

     always @(posedge clk)
        if( v ) ...
   endmodule

   M #(1) M1 (phi1);

	Arturo

-----Original Message-----
From: owner-sv-ac@eda.org [mailto:owner-sv-ac@eda.org] On Behalf Of
Eduard Cerny
Sent: Thursday, November 01, 2007 10:52 AM
To: john.havlicek@freescale.com; Eduard.Cerny@synopsys.COM
Cc: sharp@cadence.com; sv-ac@eda.org; sv-bc@eda.org
Subject: RE: [sv-ac] Re: [sv-bc] Re: if-else

Hi John,
No bits? Can that happen, unless it is an event and the invalid?
ed

> -----Original Message-----
> From: John Havlicek [mailto:john.havlicek@freescale.com] 
> Sent: Thursday, November 01, 2007 1:44 PM
> To: Eduard.Cerny@synopsys.COM
> Cc: john.havlicek@freescale.com; sharp@cadence.com; 
> sv-ac@eda.org; sv-bc@eda.org
> Subject: Re: [sv-ac] Re: [sv-bc] Re: if-else
> 
> Hi Ed:
> 
> 'b0 is another possibility.  I am trying to understand the
> technical distinction, if any, from the different choices.
> 
> Is it possible for "expression" to have no bits at all in
> 
>    if (expression != 'b0)
> 
> If so, what does the inequality comparison mean?
> 
> J.H.
> 
> > X-MimeOLE: Produced By Microsoft Exchange V6.5
> > Content-class: urn:content-classes:message
> > Date: Thu, 1 Nov 2007 09:18:01 -0700
> > Thread-Topic: [sv-ac] Re: [sv-bc] Re: if-else
> > thread-index: Acgcoi150OVUrIY6TjSJCBnw3Fw2gAAAJKmg
> > From: "Eduard Cerny" <Eduard.Cerny@synopsys.com>
> > Cc: <sv-ac@eda.org>, <sv-bc@eda.org>
> > X-OriginalArrivalTime: 01 Nov 2007 16:18:02.0861 (UTC) 
> FILETIME=[C6F9F9D0:01C81CA2]
> > 
> > I thought we would use 'b0?
> > ed=20
> > 
> > > -----Original Message-----
> > > From: owner-sv-ac@eda.org [mailto:owner-sv-ac@eda.org] On=20
> > > Behalf Of John Havlicek
> > > Sent: Thursday, November 01, 2007 12:13 PM
> > > To: sharp@cadence.com
> > > Cc: sharp@cadence.com; john.havlicek@freescale.com;=20
> > > sv-ac@eda.org; sv-bc@eda.org
> > > Subject: [sv-ac] Re: [sv-bc] Re: if-else
> > >=20
> > > Hi Steven:
> > >=20
> > > Thanks for your clarification.
> > >=20
> > > The only other issues that are nagging me involve stuff that
> > > I guess is near the boundary of the realm of what is useful. =20
> > > For example:
> > >=20
> > > - In "expresson !=3D 0", the constant 0 is signed 32-bit. 
>  Are there
> > >   any cases in which we should use 1'b0 instead of 0?
> > >=20
> > > - Are there any cases where "expression" has no bit at 
> all?  If so,
> > >   is sign-extension defined?  I am worried about void 
> members of=20
> > >   tagged unions and similar things.  Perhaps a tagged 
> union with=20
> > >   only one member and such that the one member is void type.
> > >=20
> > >=20
> > > J.H.
> > >=20
> > > > Date: Thu, 1 Nov 2007 10:51:06 -0400 (EDT)
> > > > From: Steven Sharp <sharp@cadence.com>
> > > > Reply-To: Steven Sharp <sharp@cadence.com>
> > > > Cc: sv-ac@eda.org, sv-bc@eda.org
> > > > Content-MD5: ogJLgUzqnuP7SOfkNcmc3A=3D=3D
> > > > X-Received: By mx-sanjose.cadence.com as lA1EpoHs026736 at=20
> > > Thu Nov  1 07:51:50 2007
> > > > X-OriginalArrivalTime: 01 Nov 2007 14:55:02.0620 (UTC)=20
> > > FILETIME=3D[2E8581C0:01C81C97]
> > > >=20
> > > > John,
> > > >=20
> > > > As you have noted,
> > > >=20
> > > > 	if (expression)
> > > > =09
> > > > is equivalent to
> > > >=20
> > > > 	if (expression !=3D 0)
> > > >=20
> > > > The problem is then that the results of the equality=20
> > > operator are not
> > > > clearly specified when unknowns are involved.  The 
> correct answer is
> > > > that (value1 !=3D value2) is equivalent to (|(value1 ^=20
> > > value2)).  So for
> > > > (expression !=3D 0), that is equivalent to 
> (|expression), as you =
> > have
> > > > suggested.
> > > >=20
> > > > This definition makes sense.  If any of the bits are 1,=20
> > > then the value
> > > > is definitely not equal to zero, no matter what any unknown=20
> > > bits are.
> > > > If all of the bits are 0, then the value is definitely=20
> > > equal to zero.
> > > > If the bits are a mixture of 0 and X/Z, then it is unknown=20
> > > whether the
> > > > value is equal to zero.  It depends on the value of the=20
> > > unknown bits.
> > > >=20
> > > > After that, there is the issue of how if-else deals 
> with an unknown
> > > > condition.  It rather arbitrarily treats an unknown=20
> > > condition as false.
> > > > Jonathan's suggestion of a cast to "bit" has this same 
> effect.  This
> > > > treatment can cause simulation to produce optimistic=20
> > > results, which is
> > > > undesirable, but that is how it works.
> > > > =09
> > > > Steven Sharp
> > > > sharp@cadence.com
> > > >=20
> > >=20
> > > --=20
> > > This message has been scanned for viruses and
> > > dangerous content by MailScanner, and is
> > > believed to be clean.
> > >=20
> > >=20
> 

-- 
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 Thu Nov 1 11:35:41 2007

This archive was generated by hypermail 2.1.8 : Thu Nov 01 2007 - 11:36:41 PDT