abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
extraUtilDsd.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "extra.h"
#include "misc/vec/vec.h"
#include "misc/vec/vecHsh.h"
#include "misc/util/utilTruth.h"
#include "bool/rsb/rsb.h"

Go to the source code of this file.

Data Structures

struct  Sdm_Dsd_t_
 
struct  Sdm_Man_t_
 

Macros

#define DSD_CLASS_NUM   595
 

Typedefs

typedef
typedefABC_NAMESPACE_IMPL_START
struct Sdm_Dsd_t_ 
Sdm_Dsd_t
 DECLARATIONS ///. More...
 

Functions

void Sdm_ManPrintDsdStats (Sdm_Man_t *p, int fVerbose)
 FUNCTION DEFINITIONS ///. More...
 
Hsh_IntMan_tSdm_ManBuildHashTable (Vec_Int_t **pvConfgRes)
 
void Sdm_ManPrecomputePerms (Sdm_Man_t *p)
 
void Sdm_ManPrintPerm (unsigned s)
 
int Sdm_ManCheckDsd6 (Sdm_Man_t *p, word t)
 
int Sdm_ManComputeFunc (Sdm_Man_t *p, int iDsdLit0, int iDsdLit1, int *pCut, int uMask, int fXor)
 
int Sdm_ManReadDsdVarNum (Sdm_Man_t *p, int iDsd)
 
int Sdm_ManReadDsdAndNum (Sdm_Man_t *p, int iDsd)
 
int Sdm_ManReadDsdClauseNum (Sdm_Man_t *p, int iDsd)
 
word Sdm_ManReadDsdTruth (Sdm_Man_t *p, int iDsd)
 
char * Sdm_ManReadDsdStr (Sdm_Man_t *p, int iDsd)
 
void Sdm_ManReadCnfCosts (Sdm_Man_t *p, int *pCosts, int nCosts)
 
Sdm_Man_tSdm_ManAlloc ()
 
void Sdm_ManFree (Sdm_Man_t *p)
 
Sdm_Man_tSdm_ManRead ()
 
void Sdm_ManQuit ()
 
int Sdm_ManCanRead ()
 
void Sdm_ManTest ()
 
void Sdm_ManDivCollect_rec (word t, Vec_Wrd_t **pvDivs)
 
void Sdm_ManDivTest ()
 

Variables

static Sdm_Dsd_t s_DsdClass6 [DSD_CLASS_NUM]
 
static Sdm_Man_ts_SdmMan = NULL
 

Macro Definition Documentation

#define DSD_CLASS_NUM   595

Definition at line 48 of file extraUtilDsd.c.

Typedef Documentation

typedef typedefABC_NAMESPACE_IMPL_START struct Sdm_Dsd_t_ Sdm_Dsd_t

DECLARATIONS ///.

CFile****************************************************************

FileName [extraUtilDsd.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [extra]

Synopsis [File management utilities.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
extraUtilDsd.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]

Definition at line 38 of file extraUtilDsd.c.

Function Documentation

Sdm_Man_t* Sdm_ManAlloc ( )

Function*************************************************************

Synopsis [Manager manipulation.]

Description []

SideEffects []

SeeAlso []

Definition at line 1038 of file extraUtilDsd.c.

1039 {
1040  Sdm_Man_t * p;
1041  p = ABC_CALLOC( Sdm_Man_t, 1 );
1043  return p;
1044 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Sdm_ManPrecomputePerms(Sdm_Man_t *p)
Definition: extraUtilDsd.c:747
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Hsh_IntMan_t* Sdm_ManBuildHashTable ( Vec_Int_t **  pvConfgRes)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 710 of file extraUtilDsd.c.

711 {
712  FILE * pFile;
713  char * pFileName = "dsdfuncs6.dat";
714  int RetValue, size = Extra_FileSize( pFileName ) / 12; // 2866420
715  Vec_Wrd_t * vTruthRes = Vec_WrdAlloc( size );
716  Vec_Int_t * vConfgRes = Vec_IntAlloc( size );
717  Hsh_IntMan_t * pHash;
718 
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;
724  // create hash table
725  pHash = Hsh_WrdManHashArrayStart( vTruthRes, 1 );
726  // cleanup
727  if ( pvConfgRes )
728  *pvConfgRes = vConfgRes;
729  else
730  Vec_IntFree( vConfgRes );
731  Vec_WrdFree( vTruthRes );
732 // Hsh_IntManStop( pHash );
733  return pHash;
734 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Hsh_IntMan_t * Hsh_WrdManHashArrayStart(Vec_Wrd_t *vDataW, int nSize)
Definition: vecHsh.h:217
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
int Extra_FileSize(char *pFileName)
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Vec_WrdFree(Vec_Wrd_t *p)
Definition: vecWrd.h:260
static int size
Definition: cuddSign.c:86
static Vec_Wrd_t * Vec_WrdAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecWrd.h:80
static word * Vec_WrdArray(Vec_Wrd_t *p)
Definition: vecWrd.h:316
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
int Sdm_ManCanRead ( )

Definition at line 1080 of file extraUtilDsd.c.

1081 {
1082  char * pFileName = "dsdfuncs6.dat";
1083  FILE * pFile = fopen( pFileName, "rb" );
1084  if ( pFile == NULL )
1085  return 0;
1086  fclose( pFile );
1087  return 1;
1088 }
int Sdm_ManCheckDsd6 ( Sdm_Man_t p,
word  t 
)

Function*************************************************************

Synopsis [Checks hash table for DSD class.]

Description []

SideEffects []

SeeAlso []

Definition at line 895 of file extraUtilDsd.c.

896 {
897  int fCompl, Entry, Config;
898  if ( (fCompl = (t & 1)) )
899  t = ~t;
900  Entry = *Hsh_IntManLookup( p->pHash, (unsigned *)&t );
901  if ( Entry == -1 )
902  return -1;
903  Config = Vec_IntEntry( p->vConfgRes, Entry );
904  if ( fCompl )
905  Config ^= (1 << 16);
906  return Config;
907 }
Vec_Int_t * vConfgRes
Definition: extraUtilDsd.c:652
static int * Hsh_IntManLookup(Hsh_IntMan_t *p, unsigned *pData)
Definition: vecHsh.h:147
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Hsh_IntMan_t * pHash
Definition: extraUtilDsd.c:651
int Sdm_ManComputeFunc ( Sdm_Man_t p,
int  iDsdLit0,
int  iDsdLit1,
int *  pCut,
int  uMask,
int  fXor 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 920 of file extraUtilDsd.c.

921 {
922 // int fVerbose = 0;
923  int i, Config, iClass, fCompl, Res;
924  int PermMask = uMask & 0x3FFFF;
925  int ComplMask = uMask >> 18;
926  word Truth0, Truth1p, t0, t1, t;
927  p->nAllDsd++;
928 
929  assert( uMask > 1 );
930  assert( iDsdLit0 < DSD_CLASS_NUM * 2 );
931  assert( iDsdLit1 < DSD_CLASS_NUM * 2 );
932  Truth0 = p->pDsd6[Abc_Lit2Var(iDsdLit0)].uTruth;
933  Truth1p = Vec_WrdEntry( p->vPerm6, Abc_Lit2Var(iDsdLit1) * 720 + Vec_IntEntry(p->vMap2Perm, PermMask ) );
934  if ( ComplMask )
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;
941 /*
942 if ( fVerbose )
943 {
944 Sdm_ManPrintPerm( PermMask ); printf( "\n" );
945 Extra_PrintBinary( stdout, &ComplMask, 6 ); printf( "\n" );
946 Kit_DsdPrintFromTruth( (unsigned *)&Truth0, 6 ); printf( "\n" );
947 Kit_DsdPrintFromTruth( (unsigned *)&Truth1p, 6 ); printf( "\n" );
948 Kit_DsdPrintFromTruth( (unsigned *)&t, 6 ); printf( "\n" );
949 }
950 */
951  // find configuration
952  Config = Sdm_ManCheckDsd6( p, t );
953  if ( Config == -1 )
954  {
955  p->nNonDsd++;
956  return -1;
957  }
958 
959  // get the class
960  iClass = Config >> 17;
961  fCompl = (Config >> 16) & 1;
962  Config &= 0xFFFF;
963 
964  // set the function
965  Res = Abc_Var2Lit( iClass, fCompl );
966 
967  // update cut
968  assert( (Config >> 6) < 720 );
969  if ( pCut )
970  {
971  int pLeavesNew[6] = { -1, -1, -1, -1, -1, -1 };
972  assert( pCut[0] <= 6 );
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];
980  }
981  assert( iClass < DSD_CLASS_NUM );
982  p->nCountDsd[iClass]++;
983  return Res;
984 }
Vec_Int_t * vMap2Perm
Definition: extraUtilDsd.c:654
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
Sdm_Dsd_t * pDsd6
Definition: extraUtilDsd.c:650
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
Vec_Wrd_t * vPerm6
Definition: extraUtilDsd.c:653
#define DSD_CLASS_NUM
Definition: extraUtilDsd.c:48
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
int Sdm_ManCheckDsd6(Sdm_Man_t *p, word t)
Definition: extraUtilDsd.c:895
int nCountDsd[DSD_CLASS_NUM]
Definition: extraUtilDsd.c:656
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
char Perm6[720][6]
Definition: extraUtilDsd.c:655
static word Abc_Tt6Flip(word Truth, int iVar)
Definition: utilTruth.h:1126
static word Vec_WrdEntry(Vec_Wrd_t *p, int i)
Definition: vecWrd.h:384
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
void Sdm_ManDivCollect_rec ( word  t,
Vec_Wrd_t **  pvDivs 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso [] Function*************************************************************

Synopsis [Collect DSD divisors of the function.]

Description []

SideEffects []

SeeAlso []

Definition at line 1167 of file extraUtilDsd.c.

1168 {
1169  int i, Config, Counter = 0;
1170  // check if function is decomposable
1171  Config = Sdm_ManCheckDsd6( s_SdmMan, t );
1172  if ( Config != -1 && (Config >> 17) < 2 )
1173  return;
1174  for ( i = 0; i < 6; i++ )
1175  {
1176  if ( !Abc_Tt6HasVar( t, i ) )
1177  continue;
1178  Sdm_ManDivCollect_rec( Abc_Tt6Cofactor0(t, i), pvDivs );
1179  Sdm_ManDivCollect_rec( Abc_Tt6Cofactor1(t, i), pvDivs );
1180  Counter++;
1181  }
1182  if ( Config != -1 && Counter >= 2 && Counter <= 4 )
1183  {
1184  Vec_WrdPush( pvDivs[Counter], (t & 1) ? ~t : t );
1185 // Kit_DsdPrintFromTruth( (unsigned *)&t, 6 ); printf( "\n" );
1186  }
1187 }
static int Abc_Tt6HasVar(word t, int iVar)
Definition: utilTruth.h:949
static void Vec_WrdPush(Vec_Wrd_t *p, word Entry)
Definition: vecWrd.h:618
static word Abc_Tt6Cofactor0(word t, int iVar)
Definition: utilTruth.h:370
static word Abc_Tt6Cofactor1(word t, int iVar)
Definition: utilTruth.h:375
int Sdm_ManCheckDsd6(Sdm_Man_t *p, word t)
Definition: extraUtilDsd.c:895
static int Counter
void Sdm_ManDivCollect_rec(word t, Vec_Wrd_t **pvDivs)
static Sdm_Man_t * s_SdmMan
void Sdm_ManDivTest ( )

Definition at line 1188 of file extraUtilDsd.c.

1189 {
1190 // word u, t0, t1, t = ABC_CONST(0xB0F0BBFFB0F0BAFE);
1191 // word u, t0, t1, t = ABC_CONST(0x3F1F3F13FFDFFFD3);
1192  word u, t0, t1, t = ABC_CONST(0x3F3FFFFF37003700);
1193  Rsb_Man_t * pManRsb = Rsb_ManAlloc( 6, 200, 3, 1 );
1194  Vec_Wrd_t * pvDivs[7] = { NULL };
1195  Vec_Wrd_t * vDivs = Vec_WrdAlloc( 100 );
1196  int i, RetValue;
1197 
1198  // collect divisors
1199  for ( i = 2; i <= 4; i++ )
1200  pvDivs[i] = Vec_WrdAlloc( 100 );
1201  Sdm_ManDivCollect_rec( t, pvDivs );
1202  for ( i = 2; i <= 4; i++ )
1203  Vec_WrdUniqify( pvDivs[i] );
1204 
1205  // prepare the set
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] );
1213 
1214  Vec_WrdForEachEntry( vDivs, u, i )
1215  {
1216  printf( "%2d : ", i );
1217 // Kit_DsdPrintFromTruth( (unsigned *)&u, 6 );
1218  printf( "\n" );
1219  }
1220 
1221  RetValue = Rsb_ManPerformResub6( pManRsb, 6, t, vDivs, &t0, &t1, 1 );
1222  if ( RetValue )
1223  {
1224 // Kit_DsdPrintFromTruth( (unsigned *)&t0, 6 ); printf( "\n" );
1225 // Kit_DsdPrintFromTruth( (unsigned *)&t1, 6 ); printf( "\n" );
1226  printf( "Decomposition exits.\n" );
1227  }
1228 
1229 
1230  Vec_WrdFree( vDivs );
1231  Rsb_ManFree( pManRsb );
1232 }
static void Vec_WrdPush(Vec_Wrd_t *p, word Entry)
Definition: vecWrd.h:618
typedefABC_NAMESPACE_HEADER_START struct Rsb_Man_t_ Rsb_Man_t
INCLUDES ///.
Definition: rsb.h:39
#define Vec_WrdForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecWrd.h:54
static void Vec_WrdUniqify(Vec_Wrd_t *p)
Definition: vecWrd.h:1076
Rsb_Man_t * Rsb_ManAlloc(int nLeafMax, int nDivMax, int nDecMax, int fVerbose)
MACRO DEFINITIONS ///.
Definition: rsbMan.c:45
void Rsb_ManFree(Rsb_Man_t *p)
Definition: rsbMan.c:63
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Vec_WrdFree(Vec_Wrd_t *p)
Definition: vecWrd.h:260
static Vec_Wrd_t * Vec_WrdAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecWrd.h:80
void Sdm_ManDivCollect_rec(word t, Vec_Wrd_t **pvDivs)
static word s_Truths6[6]
#define ABC_CONST(number)
PARAMETERS ///.
Definition: abc_global.h:206
static void Vec_WrdAppend(Vec_Wrd_t *vVec1, Vec_Wrd_t *vVec2)
Definition: vecWrd.h:1161
int Rsb_ManPerformResub6(Rsb_Man_t *p, int nVars, word uTruth, Vec_Wrd_t *vDivTruths, word *puTruth0, word *puTruth1, int fVerbose)
Definition: rsbDec6.c:694
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
void Sdm_ManFree ( Sdm_Man_t p)

Definition at line 1045 of file extraUtilDsd.c.

1046 {
1047  Vec_WrdFree( p->vPerm6 );
1048  Vec_IntFree( p->vMap2Perm );
1049  Vec_IntFree( p->vConfgRes );
1050  Vec_IntFree( p->pHash->vData );
1051  Hsh_IntManStop( p->pHash );
1052  ABC_FREE( p );
1053 }
Vec_Int_t * vConfgRes
Definition: extraUtilDsd.c:652
Vec_Int_t * vMap2Perm
Definition: extraUtilDsd.c:654
Vec_Wrd_t * vPerm6
Definition: extraUtilDsd.c:653
Vec_Int_t * vData
Definition: vecHsh.h:60
static void Vec_WrdFree(Vec_Wrd_t *p)
Definition: vecWrd.h:260
static void Hsh_IntManStop(Hsh_IntMan_t *p)
Definition: vecHsh.h:119
#define ABC_FREE(obj)
Definition: abc_global.h:232
Hsh_IntMan_t * pHash
Definition: extraUtilDsd.c:651
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
void Sdm_ManPrecomputePerms ( Sdm_Man_t p)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 747 of file extraUtilDsd.c.

748 {
749  int nVars = 6;
750  // 0(1:1) 1(2:1) 2(4:2) 3(10:6) 4(33:23) 5(131:98) 6(595:464)
751  int nClasses[7] = { 1, 2, 4, 10, 33, 131, 595 };
752  int nPerms = Extra_Factorial( nVars );
753 // int nSwaps = (1 << nVars);
754  int * pComp, * pPerm;
755  int i, k, x, One, OneCopy, Num;
756  Vec_Int_t * vVars;
757  abctime clk = Abc_Clock();
758  assert( p->pDsd6 == NULL );
759  p->pDsd6 = s_DsdClass6;
760  // precompute schedules
761  pComp = Extra_GreyCodeSchedule( nVars );
762  pPerm = Extra_PermSchedule( nVars );
763  // map numbers into perms
764  p->vMap2Perm = Vec_IntStartFull( (1<<(3*nVars)) );
765  // store permutations
766  One = 0;
767  for ( x = 0; x < nVars; x++ )
768  {
769  p->Perm6[0][x] = (char)x;
770  One |= (x << (3*x));
771  }
772 // Vec_IntWriteEntry( p->vMap2Perm, One, 0 );
773  OneCopy = One;
774  for ( k = 0; k < nPerms; k++ )
775  {
776  if ( k > 0 )
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] );
780 
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)));
784 
785  Vec_IntWriteEntry( p->vMap2Perm, One, k );
786 
787 // Sdm_ManPrintPerm( One );
788 // for ( x = 0; x < nVars; x++ )
789 // printf( "%d ", p->Perm6[k][x] );
790 // printf( "\n" );
791  }
792  assert( OneCopy == One );
793  // fill in the gaps
794  vVars = Vec_IntAlloc( 6 );
795  Vec_IntForEachEntry( p->vMap2Perm, Num, i )
796  {
797  // mark used variables
798  int Count = 0;
799  One = i;
800  Vec_IntFill( vVars, 6, 0 );
801  for ( k = 0; k < nVars; k++ )
802  {
803  int iVar = ((One >> (3*k)) & 7);
804  if ( iVar >= nVars && iVar < 7 )
805  break;
806  if ( iVar != 7 )
807  {
808  if ( Vec_IntEntry( vVars, iVar ) == 1 )
809  break;
810  Vec_IntWriteEntry( vVars, iVar, 1 );
811  Count++;
812  }
813  }
814  // skip ones with dups and complete
815  if ( k < nVars || Count == nVars )
816  continue;
817  // find unused variables
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 );
822  // fill in used variables
823  x = 0;
824  for ( k = 0; k < nVars; k++ )
825  {
826  int iVar = ((One >> (3*k)) & 7);
827  if ( iVar == 7 )
828  One ^= ((Vec_IntEntry(vVars, x++) ^ 7) << (3*k));
829  }
830  assert( x == Vec_IntSize(vVars) );
831  // save this one
832  assert( Vec_IntEntry( p->vMap2Perm, One ) != -1 );
834 /*
835  // mapping
836  Sdm_ManPrintPerm( i );
837  printf( "-> " );
838  Sdm_ManPrintPerm( One );
839  printf( "\n" );
840 */
841  }
842  Vec_IntFree( vVars );
843 
844  // store permuted truth tables
845  assert( p->vPerm6 == NULL );
846  p->vPerm6 = Vec_WrdAlloc( nPerms * DSD_CLASS_NUM );
847  for ( i = 0; i < nClasses[nVars]; i++ )
848  {
849  word uTruth = s_DsdClass6[i].uTruth;
850  for ( k = 0; k < nPerms; k++ )
851  {
852  uTruth = Abc_Tt6SwapAdjacent( uTruth, pPerm[k] );
853  Vec_WrdPush( p->vPerm6, uTruth );
854  }
855  assert( uTruth == s_DsdClass6[i].uTruth );
856  }
857  ABC_FREE( pPerm );
858  ABC_FREE( pComp );
859  // build hash table
861  Abc_PrintTime( 1, "Setting up DSD information", Abc_Clock() - clk );
862 }
Vec_Int_t * vConfgRes
Definition: extraUtilDsd.c:652
int * Extra_GreyCodeSchedule(int n)
int * Extra_PermSchedule(int n)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Vec_WrdPush(Vec_Wrd_t *p, word Entry)
Definition: vecWrd.h:618
Vec_Int_t * vMap2Perm
Definition: extraUtilDsd.c:654
Sdm_Dsd_t * pDsd6
Definition: extraUtilDsd.c:650
static abctime Abc_Clock()
Definition: abc_global.h:279
static Vec_Int_t * Vec_IntStartFull(int nSize)
Definition: vecInt.h:119
#define ABC_SWAP(Type, a, b)
Definition: abc_global.h:218
Vec_Wrd_t * vPerm6
Definition: extraUtilDsd.c:653
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
#define DSD_CLASS_NUM
Definition: extraUtilDsd.c:48
static word Abc_Tt6SwapAdjacent(word Truth, int iVar)
Definition: utilTruth.h:1186
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
char Perm6[720][6]
Definition: extraUtilDsd.c:655
static int pPerm[13719]
Definition: rwrTemp.c:32
Hsh_IntMan_t * Sdm_ManBuildHashTable(Vec_Int_t **pvConfgRes)
Definition: extraUtilDsd.c:710
static Vec_Wrd_t * Vec_WrdAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecWrd.h:80
static Sdm_Dsd_t s_DsdClass6[DSD_CLASS_NUM]
Definition: extraUtilDsd.c:50
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
Definition: bblif.c:435
#define ABC_FREE(obj)
Definition: abc_global.h:232
Hsh_IntMan_t * pHash
Definition: extraUtilDsd.c:651
int Extra_Factorial(int n)
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_INT64_T abctime
Definition: abc_global.h:278
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
void Sdm_ManPrintDsdStats ( Sdm_Man_t p,
int  fVerbose 
)

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 676 of file extraUtilDsd.c.

677 {
678  int i, Absent = 0;
679  for ( i = 0; i < DSD_CLASS_NUM; i++ )
680  {
681  if ( p->nCountDsd[i] == 0 )
682  {
683  Absent++;
684  continue;
685  }
686  if ( fVerbose )
687  {
688  printf( "%5d : ", i );
689  printf( "%-20s ", p->pDsd6[i].pStr );
690  printf( "%8d ", p->nCountDsd[i] );
691  printf( "\n" );
692  }
693  }
694  printf( "Unused classes = %d (%.2f %%). ", Absent, 100.0 * Absent / DSD_CLASS_NUM );
695  printf( "Non-DSD cuts = %d (%.2f %%). ", p->nNonDsd, 100.0 * p->nNonDsd / Abc_MaxInt(1, p->nAllDsd) );
696  printf( "\n" );
697 }
Sdm_Dsd_t * pDsd6
Definition: extraUtilDsd.c:650
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
#define DSD_CLASS_NUM
Definition: extraUtilDsd.c:48
int nCountDsd[DSD_CLASS_NUM]
Definition: extraUtilDsd.c:656
void Sdm_ManPrintPerm ( unsigned  s)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 876 of file extraUtilDsd.c.

877 {
878  int i;
879  for ( i = 0; i < 6; i++ )
880  printf( "%d ", (s >> (3*i)) & 7 );
881  printf( " " );
882 }
void Sdm_ManQuit ( )

Definition at line 1074 of file extraUtilDsd.c.

1075 {
1076  if ( s_SdmMan != NULL )
1077  Sdm_ManFree( s_SdmMan );
1078  s_SdmMan = NULL;
1079 }
void Sdm_ManFree(Sdm_Man_t *p)
static Sdm_Man_t * s_SdmMan
Sdm_Man_t* Sdm_ManRead ( )

Definition at line 1067 of file extraUtilDsd.c.

1068 {
1069  if ( s_SdmMan == NULL )
1070  s_SdmMan = Sdm_ManAlloc();
1071  memset( s_SdmMan->nCountDsd, 0, sizeof(int) * DSD_CLASS_NUM );
1072  return s_SdmMan;
1073 }
char * memset()
Sdm_Man_t * Sdm_ManAlloc()
#define DSD_CLASS_NUM
Definition: extraUtilDsd.c:48
int nCountDsd[DSD_CLASS_NUM]
Definition: extraUtilDsd.c:656
static Sdm_Man_t * s_SdmMan
void Sdm_ManReadCnfCosts ( Sdm_Man_t p,
int *  pCosts,
int  nCosts 
)

Definition at line 1017 of file extraUtilDsd.c.

1018 {
1019  int i;
1020  assert( nCosts == DSD_CLASS_NUM );
1021  pCosts[0] = pCosts[1] = 0;
1022  for ( i = 2; i < DSD_CLASS_NUM; i++ )
1023  pCosts[i] = Sdm_ManReadDsdClauseNum( p, i );
1024 }
int Sdm_ManReadDsdClauseNum(Sdm_Man_t *p, int iDsd)
#define DSD_CLASS_NUM
Definition: extraUtilDsd.c:48
#define assert(ex)
Definition: util_old.h:213
int Sdm_ManReadDsdAndNum ( Sdm_Man_t p,
int  iDsd 
)

Definition at line 1001 of file extraUtilDsd.c.

1002 {
1003  return p->pDsd6[iDsd].nAnds;
1004 }
Sdm_Dsd_t * pDsd6
Definition: extraUtilDsd.c:650
int Sdm_ManReadDsdClauseNum ( Sdm_Man_t p,
int  iDsd 
)

Definition at line 1005 of file extraUtilDsd.c.

1006 {
1007  return p->pDsd6[iDsd].nClauses;
1008 }
Sdm_Dsd_t * pDsd6
Definition: extraUtilDsd.c:650
char* Sdm_ManReadDsdStr ( Sdm_Man_t p,
int  iDsd 
)

Definition at line 1013 of file extraUtilDsd.c.

1014 {
1015  return p->pDsd6[iDsd].pStr;
1016 }
Sdm_Dsd_t * pDsd6
Definition: extraUtilDsd.c:650
word Sdm_ManReadDsdTruth ( Sdm_Man_t p,
int  iDsd 
)

Definition at line 1009 of file extraUtilDsd.c.

1010 {
1011  return p->pDsd6[iDsd].uTruth;
1012 }
Sdm_Dsd_t * pDsd6
Definition: extraUtilDsd.c:650
int Sdm_ManReadDsdVarNum ( Sdm_Man_t p,
int  iDsd 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 997 of file extraUtilDsd.c.

998 {
999  return p->pDsd6[iDsd].nVars;
1000 }
Sdm_Dsd_t * pDsd6
Definition: extraUtilDsd.c:650
void Sdm_ManTest ( )

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1101 of file extraUtilDsd.c.

1102 {
1103  Sdm_Man_t * p;
1104  int iDsd0 = 4;
1105  int iDsd1 = 6;
1106  int iDsd;
1107  int uMask = 0x3FFFF ^ ((7 ^ 0) << 6) ^ ((7 ^ 1) << 9);
1108  int pCut[7] = { 4, 10, 20, 30, 40 };
1109 // Sdm_ManPrintPerm( uMask );
1110  p = Sdm_ManAlloc();
1111  iDsd = Sdm_ManComputeFunc( p, iDsd0, iDsd1, pCut, uMask, 0 );
1112  Sdm_ManFree( p );
1113 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Sdm_Man_t * Sdm_ManAlloc()
void Sdm_ManFree(Sdm_Man_t *p)
int Sdm_ManComputeFunc(Sdm_Man_t *p, int iDsdLit0, int iDsdLit1, int *pCut, int uMask, int fXor)
Definition: extraUtilDsd.c:920

Variable Documentation

Sdm_Dsd_t s_DsdClass6[DSD_CLASS_NUM]
static

Definition at line 50 of file extraUtilDsd.c.

Sdm_Man_t* s_SdmMan = NULL
static

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1066 of file extraUtilDsd.c.