702 char * pFileName =
"dsdfuncs6.dat";
704 Vec_Wrd_t * vTruthRes = Vec_WrdAlloc( size );
705 Vec_Int_t * vConfgRes = Vec_IntAlloc( size );
708 pFile = fopen( pFileName,
"rb" );
709 RetValue = fread( Vec_WrdArray(vTruthRes),
sizeof(
word), size, pFile );
710 RetValue = fread( Vec_IntArray(vConfgRes),
sizeof(
int), size, pFile );
711 vTruthRes->nSize = size;
712 vConfgRes->nSize = size;
714 pHash = Hsh_WrdManHashArrayStart( vTruthRes, 1 );
717 *pvConfgRes = vConfgRes;
719 Vec_IntFree( vConfgRes );
720 Vec_WrdFree( vTruthRes );
759 int nClasses[7] = { 1, 2, 4, 10, 33, 131, 595 };
762 int * pComp, * pPerm;
763 int i, k, x, One, OneCopy, Num;
767 p->pDsd6 = s_DsdClass6;
772 p->vMap2Perm = Vec_IntStartFull( (1<<(3*nVars)) );
775 for ( x = 0; x < nVars; x++ )
777 p->Perm6[0][x] = (char)x;
782 for ( k = 0; k < nPerms; k++ )
785 for ( x = 0; x < nVars; x++ )
786 p->Perm6[k][x] =
p->Perm6[k-1][x];
787 ABC_SWAP(
char,
p->Perm6[k][pPerm[k]],
p->Perm6[k][pPerm[k]+1] );
789 Num = ( (One >> (3*(pPerm[k] ))) ^ (One >> (3*(pPerm[k]+1))) ) & 7;
790 One ^= (Num << (3*(pPerm[k] )));
791 One ^= (Num << (3*(pPerm[k]+1)));
793 Vec_IntWriteEntry(
p->vMap2Perm, One, k );
802 vVars = Vec_IntAlloc( 6 );
808 Vec_IntFill( vVars, 6, 0 );
809 for ( k = 0; k < nVars; k++ )
811 int iVar = ((One >> (3*k)) & 7);
812 if ( iVar >= nVars && iVar < 7 )
816 if ( Vec_IntEntry( vVars, iVar ) == 1 )
818 Vec_IntWriteEntry( vVars, iVar, 1 );
823 if ( k < nVars || Count == nVars )
826 for ( x = k = 0; k < 6; k++ )
827 if ( Vec_IntEntry(vVars, k) == 0 )
828 Vec_IntWriteEntry( vVars, x++, k );
829 Vec_IntShrink( vVars, x );
832 for ( k = 0; k < nVars; k++ )
834 int iVar = ((One >> (3*k)) & 7);
836 One ^= ((Vec_IntEntry(vVars, x++) ^ 7) << (3*k));
838 assert( x == Vec_IntSize(vVars) );
840 assert( Vec_IntEntry(
p->vMap2Perm, One ) != -1 );
841 Vec_IntWriteEntry(
p->vMap2Perm, i, Vec_IntEntry(
p->vMap2Perm, One) );
850 Vec_IntFree( vVars );
854 p->vPerm6 = Vec_WrdAlloc( nPerms * 595 );
855 for ( i = 0; i < nClasses[nVars]; i++ )
857 word uTruth = s_DsdClass6[i].uTruth;
858 for ( k = 0; k < nPerms; k++ )
860 uTruth = Abc_Tt6SwapAdjacent( uTruth, pPerm[k] );
861 Vec_WrdPush(
p->vPerm6, uTruth );
863 assert( uTruth == s_DsdClass6[i].uTruth );
869 Abc_PrintTime( 1,
"Setting up DSD information", Abc_Clock() - clk );
933 int i, Config, iClass, fCompl;
934 int pLeavesNew[6] = { -1, -1, -1, -1, -1, -1 };
939 int iClass0 = Abc_Lit2Var(pCut0->
iFunc);
940 int iClass1 = Abc_Lit2Var(pCut1->
iFunc);
941 word Truth0 =
p->pDsd6[iClass0].uTruth;
942 int Perm1 = Vec_IntEntry(
p->vMap2Perm,
p->uPermMask[1] );
943 word Truth1p = Vec_WrdEntry(
p->vPerm6, iClass1 * 720 + Perm1 );
944 if (
p->uComplMask[1] )
946 for ( i = 0; i < 6; i++ )
947 if ( (
p->uComplMask[1] >> i) & 1 )
948 Truth1p = Abc_Tt6Flip( Truth1p, i );
950 t0 = (fCompl0 ^ pCut0->
fCompl ^ Abc_LitIsCompl(pCut0->
iFunc)) ? ~Truth0 : Truth0;
951 t1 = (fCompl1 ^ pCut1->
fCompl ^ Abc_LitIsCompl(pCut1->
iFunc)) ? ~Truth1p : Truth1p;
954 else if ( Type == 2 )
969 int iClass0 = Abc_Lit2Var(pCut0->
iFunc);
970 int iClass1 = Abc_Lit2Var(pCut1->
iFunc);
971 int iClassC = Abc_Lit2Var(pCutC->
iFunc);
972 word Truth0 =
p->pDsd6[iClass0].uTruth;
973 int Perm1 = Vec_IntEntry(
p->vMap2Perm,
p->uPermMask[1] );
974 int PermC = Vec_IntEntry(
p->vMap2Perm,
p->uPermMask[2] );
975 word Truth1p = Vec_WrdEntry(
p->vPerm6, iClass1 * 720 + Perm1 );
976 word TruthCp = Vec_WrdEntry(
p->vPerm6, iClassC * 720 + PermC );
977 if (
p->uComplMask[1] )
979 for ( i = 0; i < 6; i++ )
980 if ( (
p->uComplMask[1] >> i) & 1 )
981 Truth1p = Abc_Tt6Flip( Truth1p, i );
983 if (
p->uComplMask[2] )
985 for ( i = 0; i < 6; i++ )
986 if ( (
p->uComplMask[2] >> i) & 1 )
987 TruthCp = Abc_Tt6Flip( TruthCp, i );
989 t0 = (fCompl0 ^ pCut0->
fCompl ^ Abc_LitIsCompl(pCut0->
iFunc)) ? ~Truth0 : Truth0;
990 t1 = (fCompl1 ^ pCut1->
fCompl ^ Abc_LitIsCompl(pCut1->
iFunc)) ? ~Truth1p : Truth1p;
991 tC = (fComplC ^ pCutC->
fCompl ^ Abc_LitIsCompl(pCutC->
iFunc)) ? ~TruthCp : TruthCp;
992 t = (tC & t1) | (~tC & t0);
1004 iClass = Config >> 17;
1005 fCompl = (Config >> 16) & 1;
1009 if (
p->pPars->fMap4Gates )
1011 if ( Vec_IntSize(Vec_WecEntry(
p->vNpnConfigs, iClass)) == 0 )
1019 pCut->
iFunc = Abc_Var2Lit( iClass, fCompl );
1029 assert( (Config >> 6) < 720 );
1030 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
1031 pLeavesNew[(
int)(
p->Perm6[Config >> 6][i])] = Abc_LitNotCond( pCut->
pLeaves[i], (Config >> i) & 1 );
1032 pCut->
nLeaves =
p->pDsd6[iClass].nVars;
1033 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
1034 assert( pLeavesNew[i] != -1 );
1035 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
1036 pCut->
pLeaves[i] = pLeavesNew[i];
1037 p->nCountDsd[iClass]++;
1038 p->nSmallSupp += (int)(pCut->
nLeaves < 2);
1042printf(
"Computed " );
int Mpm_CutComputeDsd6(Mpm_Man_t *p, Mpm_Cut_t *pCut, Mpm_Cut_t *pCut0, Mpm_Cut_t *pCut1, Mpm_Cut_t *pCutC, int fCompl0, int fCompl1, int fComplC, int Type)