Subject: Re: [sv-cc] Updated LRM - functions for bit type part-selects
From: Andrzej Litwiniuk (Andrzej.Litwiniuk@synopsys.com)
Date: Wed Mar 19 2003 - 15:50:21 PST
> >  > If we can provide an
> >  > equivalent that will allow us to also conveniently handle packed
> >  > arrays between 33 bits and 64 bits in size that would be nice to.
> > 
> >  > As for having dedicated functions to extract whole 32 or
> >  > 64 bit quantities, I don't think it is worth it.
> >  >
> >  > Perhaps for now, in the interest of simplicity, we should
> >  > just add the svGetBits() function as you've defined it above
> >  > and not bother with the fixed width variants.
> >  >
> >  > -- johnS
> > 
> > I have no opinion whether fixed 32-bit and 64-bit variants are worthy.
> > Neither I have any clue how useful may be the variant for 33 to 64 bits.
John,
I kind of stopped halfway:
 - removed svGetPartSelectBit()
 - kept dedicated functions for 32 and 64 bits: svGet32Bits(), svGet64Bits()
 - didn't introduce the variant with a variable width 33-64 and the related
   macros SV_GET_UNSIGNED_BITS64/SV_GET_SIGNED_BITS64
So, currently we have:
svBitVec32 svGetBits(const svBitPackedArrRef s, int i, int w);
svBitVec32 svGet32Bits(const svBitPackedArrRef s, int i); // 32-bits
long long  svGet64Bits(const svBitPackedArrRef s, int i); // 64-bits
void       svGetPartSelectLogic(svLogicVec32* d, const svLogicPackedArrRef s, 
                     int i, int w);
We may later decide to remove svGet32Bits()/svGet64Bits() and/or to introduce
the variant with a variable width 33-64 bits along with the all needed macros.
Team, what's your opinion?
If we keep svGetBits64() or introduce svGetBits33_64(), then what should be 
the result type?
        long long ?
        svBitVec64 prone to misinterpretation?
        sv64Bits ?
> johnS:
> [...] If we provide the 64 bit slice extract function with
> the w parameter, we would probably want 64 bit variants of 
> SV_GET_UNSIGNED_BITS() and SV_GET_SIGNED_BITS() as support macros.
> SV_MASK() could be used with either so no 64 bit variant needed
> there. Do you agree ?
I'm not sure about SV_MASK().
        #define SV_MASK(N) (~(-1<<(N)))
"-1" is int rather than long long. So SV_MASK64 may be needed, too.
> Perhaps we could to it this way:
> 
>      SV_GET_UNSIGNED_BITS()
>      SV_GET_SIGNED_BITS()
>      svBitVec32 svGetBits(const svBitPackedArrRef s, int i, int w);
> 
>      SV_GET_UNSIGNED_BITS64()
>      SV_GET_SIGNED_BITS64()
>      svBitVec64 svGetBits64(const svBitPackedArrRef s, int i, int w);
I like this one.
> or, alternatively,
> 
>      SV_GET_UNSIGNED_BITS32()
>      SV_GET_SIGNED_BITS32()
>      svBitVec32 svGetBits32(const svBitPackedArrRef s, int i, int w);
> 
>      SV_GET_UNSIGNED_BITS64()
>      SV_GET_SIGNED_BITS64()
>      svBitVec64 svGetBits64(const svBitPackedArrRef s, int i, int w);
> 
> or even this (new wordwidth arg added to macros can consolidate them):
> 
>      #define SV_GET_UNSIGNED_BITS(VALUE,N,WORDWIDTH) \
>          ((N)==(WORDWIDTH)?(VALUE):((VALUE)&SV_MASK(N)))
>      #define SV_GET_SIGNED_BITS(VALUE,N,WORDWIDTH) \
>           ((N)==(WORDWIDTH)?(VALUE):\
>           (((VALUE)&(1<<((N)1)))?((VALUE)|~SV_MASK(N)):((VALUE)&SV_MASK(N))))
>      svBitVec32 svGetBits32(const svBitPackedArrRef s, int i, int w);
>      svBitVec64 svGetBits64(const svBitPackedArrRef s, int i, int w);
Andrzej
This archive was generated by hypermail 2b28 : Wed Mar 19 2003 - 15:52:21 PST