Updates to &if mapper.

This commit is contained in:
Alan Mishchenko 2026-03-19 20:18:08 -07:00
parent ca0fc3ed29
commit 24917213df
2 changed files with 23 additions and 3 deletions

View File

@ -2124,6 +2124,24 @@ void Gia_ManConfigPrint2( unsigned char * pConfigData, int nLeaves )
}
}
static inline word Gia_ManFromIfPermuteTruth4( word Truth, int nLeaves, word z )
{
word TruthNew = 0;
int i, k, x;
assert( nLeaves >= 1 && nLeaves <= 4 );
for ( i = 0; i < 16; i++ )
{
x = 0;
for ( k = 0; k < nLeaves; k++ )
{
int v = (int)((z >> (2 * k)) & 3);
x |= ((i >> k) & 1) << v;
}
TruthNew |= ((Truth >> x) & 1) << i;
}
return TruthNew;
}
/**Function*************************************************************
Synopsis [Derive configurations.]
@ -2145,6 +2163,7 @@ void Gia_ManFromIfGetConfig2( Vec_Str_t * vConfigs2, If_Man_t * pIfMan, word * p
{
word z = If_CutPerformDeriveJ( pIfMan, (unsigned *)pTruth, nLeaves, nLeaves, NULL, 1, fDelay );
int fHavePerm = (z != 0) && ((z & ABC_CONST(0x4000000000000000)) != 0);
word Truth = pTruth[0];
// Cell type 0: Simple LUT4
CellId = 0;
// Write CellId
@ -2158,7 +2177,8 @@ void Gia_ManFromIfGetConfig2( Vec_Str_t * vConfigs2, If_Man_t * pIfMan, word * p
for ( ; i < 4; i++ )
Vec_StrPush( vConfigs2, 0 );
// Write truth table (16 bits for LUT4)
word Truth = pTruth[0];
if ( fHavePerm )
Truth = Gia_ManFromIfPermuteTruth4( Truth, nLeaves, z );
Vec_StrPush( vConfigs2, (char)((Truth >> 8) & 0xFF) );
Vec_StrPush( vConfigs2, (char)(Truth & 0xFF) );
assert( startPos + 7 == Vec_StrSize(vConfigs2) );

View File

@ -57,7 +57,7 @@ static int Gia_ManConfig2GetBytePos( Gia_Man_t * p, int iObj )
}
return -1;
}
static int Gia_ManConfig2DerivePinDelays( Gia_Man_t * p, int iObj, If_LibCell_t * pCellLib, int * pPinDelay, int nLutSize )
int Gia_ManConfig2DerivePinDelays( Gia_Man_t * p, int iObj, If_LibCell_t * pCellLib, int * pPinDelay, int nLutSize )
{
int bytePos, i, nPins;
unsigned char CellId;
@ -76,7 +76,7 @@ static int Gia_ManConfig2DerivePinDelays( Gia_Man_t * p, int iObj, If_LibCell_t
{
int v = (unsigned char)Vec_StrEntry( p->vConfigs2, bytePos + 1 + i );
if ( v >= 2 && v < 2 + nLutSize )
pPinDelay[v - 2] = pCellLib->pCellPinDelays[CellId][i];
pPinDelay[v - 2] = Abc_MaxInt( pPinDelay[v - 2], pCellLib->pCellPinDelays[CellId][i] );
}
return 1;
}