713 char * pFileName =
"dsdfuncs6.dat";
715 Vec_Wrd_t * vTruthRes = Vec_WrdAlloc( size );
716 Vec_Int_t * vConfgRes = Vec_IntAlloc( size );
719 pFile = fopen( pFileName,
"rb" );
720 RetValue = fread( Vec_WrdArray(vTruthRes),
sizeof(
word), size, pFile );
721 RetValue = fread( Vec_IntArray(vConfgRes),
sizeof(
int), size, pFile );
722 vTruthRes->nSize = size;
723 vConfgRes->nSize = size;
725 pHash = Hsh_WrdManHashArrayStart( vTruthRes, 1 );
728 *pvConfgRes = vConfgRes;
730 Vec_IntFree( vConfgRes );
731 Vec_WrdFree( vTruthRes );
751 int nClasses[7] = { 1, 2, 4, 10, 33, 131, 595 };
754 int * pComp, * pPerm;
755 int i, k, x, One, OneCopy, Num;
759 p->pDsd6 = s_DsdClass6;
764 p->vMap2Perm = Vec_IntStartFull( (1<<(3*nVars)) );
767 for ( x = 0; x < nVars; x++ )
769 p->Perm6[0][x] = (char)x;
774 for ( k = 0; k < nPerms; k++ )
777 for ( x = 0; x < nVars; x++ )
778 p->Perm6[k][x] =
p->Perm6[k-1][x];
779 ABC_SWAP(
char,
p->Perm6[k][pPerm[k]],
p->Perm6[k][pPerm[k]+1] );
781 Num = ( (One >> (3*(pPerm[k] ))) ^ (One >> (3*(pPerm[k]+1))) ) & 7;
782 One ^= (Num << (3*(pPerm[k] )));
783 One ^= (Num << (3*(pPerm[k]+1)));
785 Vec_IntWriteEntry(
p->vMap2Perm, One, k );
794 vVars = Vec_IntAlloc( 6 );
800 Vec_IntFill( vVars, 6, 0 );
801 for ( k = 0; k < nVars; k++ )
803 int iVar = ((One >> (3*k)) & 7);
804 if ( iVar >= nVars && iVar < 7 )
808 if ( Vec_IntEntry( vVars, iVar ) == 1 )
810 Vec_IntWriteEntry( vVars, iVar, 1 );
815 if ( k < nVars || Count == nVars )
818 for ( x = k = 0; k < 6; k++ )
819 if ( Vec_IntEntry(vVars, k) == 0 )
820 Vec_IntWriteEntry( vVars, x++, k );
821 Vec_IntShrink( vVars, x );
824 for ( k = 0; k < nVars; k++ )
826 int iVar = ((One >> (3*k)) & 7);
828 One ^= ((Vec_IntEntry(vVars, x++) ^ 7) << (3*k));
830 assert( x == Vec_IntSize(vVars) );
832 assert( Vec_IntEntry(
p->vMap2Perm, One ) != -1 );
833 Vec_IntWriteEntry(
p->vMap2Perm, i, Vec_IntEntry(
p->vMap2Perm, One) );
842 Vec_IntFree( vVars );
847 for ( i = 0; i < nClasses[nVars]; i++ )
849 word uTruth = s_DsdClass6[i].uTruth;
850 for ( k = 0; k < nPerms; k++ )
852 uTruth = Abc_Tt6SwapAdjacent( uTruth, pPerm[k] );
853 Vec_WrdPush(
p->vPerm6, uTruth );
855 assert( uTruth == s_DsdClass6[i].uTruth );
861 Abc_PrintTime( 1,
"Setting up DSD information", Abc_Clock() - clk );
923 int i, Config, iClass, fCompl, Res;
924 int PermMask = uMask & 0x3FFFF;
925 int ComplMask = uMask >> 18;
926 word Truth0, Truth1p, t0, t1, t;
932 Truth0 =
p->pDsd6[Abc_Lit2Var(iDsdLit0)].uTruth;
933 Truth1p = Vec_WrdEntry(
p->vPerm6, Abc_Lit2Var(iDsdLit1) * 720 + Vec_IntEntry(
p->vMap2Perm, PermMask ) );
935 for ( i = 0; i < 6; i++ )
936 if ( (ComplMask >> i) & 1 )
937 Truth1p = Abc_Tt6Flip( Truth1p, i );
938 t0 = Abc_LitIsCompl(iDsdLit0) ? ~Truth0 : Truth0;
939 t1 = Abc_LitIsCompl(iDsdLit1) ? ~Truth1p : Truth1p;
940 t = fXor ? t0 ^ t1 : t0 & t1;
960 iClass = Config >> 17;
961 fCompl = (Config >> 16) & 1;
965 Res = Abc_Var2Lit( iClass, fCompl );
968 assert( (Config >> 6) < 720 );
971 int pLeavesNew[6] = { -1, -1, -1, -1, -1, -1 };
973 for ( i = 0; i < pCut[0]; i++ )
974 pLeavesNew[(
int)(
p->Perm6[Config >> 6][i])] = Abc_LitNotCond( pCut[i+1], (Config >> i) & 1 );
975 pCut[0] =
p->pDsd6[iClass].nVars;
976 for ( i = 0; i < pCut[0]; i++ )
977 assert( pLeavesNew[i] != -1 );
978 for ( i = 0; i < pCut[0]; i++ )
979 pCut[i+1] = pLeavesNew[i];
982 p->nCountDsd[iClass]++;
1169 int i, Config, Counter = 0;
1172 if ( Config != -1 && (Config >> 17) < 2 )
1174 for ( i = 0; i < 6; i++ )
1176 if ( !Abc_Tt6HasVar( t, i ) )
1182 if ( Config != -1 && Counter >= 2 && Counter <= 4 )
1184 Vec_WrdPush( pvDivs[Counter], (t & 1) ? ~t : t );
1195 Vec_Wrd_t * vDivs = Vec_WrdAlloc( 100 );
1199 for ( i = 2; i <= 4; i++ )
1200 pvDivs[i] = Vec_WrdAlloc( 100 );
1202 for ( i = 2; i <= 4; i++ )
1203 Vec_WrdUniqify( pvDivs[i] );
1206 vDivs = Vec_WrdAlloc( 100 );
1207 for ( i = 0; i < 6; i++ )
1208 Vec_WrdPush( vDivs, s_Truths6[i] );
1209 for ( i = 2; i <= 4; i++ )
1210 Vec_WrdAppend( vDivs, pvDivs[i] );
1211 for ( i = 2; i <= 4; i++ )
1212 Vec_WrdFree( pvDivs[i] );
1216 printf(
"%2d : ", i );
1226 printf(
"Decomposition exits.\n" );
1230 Vec_WrdFree( vDivs );
int Rsb_ManPerformResub6(Rsb_Man_t *p, int nVars, word uTruth, Vec_Wrd_t *vDivTruths, word *puTruth0, word *puTruth1, int fVerbose)