mirror of
https://github.com/YosysHQ/abc.git
synced 2026-09-08 03:46:07 +02:00
Version abc70330
This commit is contained in:
@@ -175,6 +175,45 @@ static inline Vec_Ptr_t * Vec_PtrAllocSimInfo( int nEntries, int nWords )
|
||||
return Vec_PtrAllocArray( pMemory, nEntries );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Allocates the array of truth tables for the given number of vars.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
static inline Vec_Ptr_t * Vec_PtrAllocTruthTables( int nVars )
|
||||
{
|
||||
Vec_Ptr_t * p;
|
||||
unsigned Masks[5] = { 0xAAAAAAAA, 0xCCCCCCCC, 0xF0F0F0F0, 0xFF00FF00, 0xFFFF0000 };
|
||||
unsigned * pTruth;
|
||||
int i, k, nWords;
|
||||
nWords = (nVars <= 5 ? 1 : (1 << (nVars - 5)));
|
||||
p = Vec_PtrAllocSimInfo( nVars, nWords );
|
||||
for ( i = 0; i < nVars; i++ )
|
||||
{
|
||||
pTruth = p->pArray[i];
|
||||
if ( i < 5 )
|
||||
{
|
||||
for ( k = 0; k < nWords; k++ )
|
||||
pTruth[k] = Masks[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( k = 0; k < nWords; k++ )
|
||||
if ( k & (1 << (i-5)) )
|
||||
pTruth[k] = ~(unsigned)0;
|
||||
else
|
||||
pTruth[k] = 0;
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Duplicates the integer array.]
|
||||
|
||||
Reference in New Issue
Block a user