abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sswPart.c File Reference
#include "sswInt.h"
#include "aig/ioa/ioa.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Aig_Man_t
Ssw_SignalCorrespondencePart (Aig_Man_t *pAig, Ssw_Pars_t *pPars)
 DECLARATIONS ///. More...
 

Function Documentation

ABC_NAMESPACE_IMPL_START Aig_Man_t* Ssw_SignalCorrespondencePart ( Aig_Man_t pAig,
Ssw_Pars_t pPars 
)

DECLARATIONS ///.

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

FileName [sswPart.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Inductive prover with constraints.]

Synopsis [Partitioned signal correspondence.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - September 1, 2008.]

Revision [

Id:
sswPart.c,v 1.00 2008/09/01 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Performs partitioned sequential SAT sweeping.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file sswPart.c.

47 {
48  int fPrintParts = 0;
49  char Buffer[100];
50  Aig_Man_t * pTemp, * pNew;
51  Vec_Ptr_t * vResult;
52  Vec_Int_t * vPart;
53  int * pMapBack;
54  int i, nCountPis, nCountRegs;
55  int nClasses, nPartSize, fVerbose;
56  abctime clk = Abc_Clock();
57  if ( pPars->fConstrs )
58  {
59  Abc_Print( 1, "Cannot use partitioned computation with constraints.\n" );
60  return NULL;
61  }
62  // save parameters
63  nPartSize = pPars->nPartSize; pPars->nPartSize = 0;
64  fVerbose = pPars->fVerbose; pPars->fVerbose = 0;
65  // generate partitions
66  if ( pAig->vClockDoms )
67  {
68  // divide large clock domains into separate partitions
69  vResult = Vec_PtrAlloc( 100 );
70  Vec_PtrForEachEntry( Vec_Int_t *, (Vec_Ptr_t *)pAig->vClockDoms, vPart, i )
71  {
72  if ( nPartSize && Vec_IntSize(vPart) > nPartSize )
73  Aig_ManPartDivide( vResult, vPart, nPartSize, pPars->nOverSize );
74  else
75  Vec_PtrPush( vResult, Vec_IntDup(vPart) );
76  }
77  }
78  else
79  vResult = Aig_ManRegPartitionSimple( pAig, nPartSize, pPars->nOverSize );
80 // vResult = Aig_ManPartitionSmartRegisters( pAig, nPartSize, 0 );
81 // vResult = Aig_ManRegPartitionSmart( pAig, nPartSize );
82  if ( fPrintParts )
83  {
84  // print partitions
85  Abc_Print( 1, "Simple partitioning. %d partitions are saved:\n", Vec_PtrSize(vResult) );
86  Vec_PtrForEachEntry( Vec_Int_t *, vResult, vPart, i )
87  {
88 // extern void Ioa_WriteAiger( Aig_Man_t * pMan, char * pFileName, int fWriteSymbols, int fCompact );
89  sprintf( Buffer, "part%03d.aig", i );
90  pTemp = Aig_ManRegCreatePart( pAig, vPart, &nCountPis, &nCountRegs, NULL );
91  Ioa_WriteAiger( pTemp, Buffer, 0, 0 );
92  Abc_Print( 1, "part%03d.aig : Reg = %4d. PI = %4d. (True = %4d. Regs = %4d.) And = %5d.\n",
93  i, Vec_IntSize(vPart), Aig_ManCiNum(pTemp)-Vec_IntSize(vPart), nCountPis, nCountRegs, Aig_ManNodeNum(pTemp) );
94  Aig_ManStop( pTemp );
95  }
96  }
97 
98  // perform SSW with partitions
99  Aig_ManReprStart( pAig, Aig_ManObjNumMax(pAig) );
100  Vec_PtrForEachEntry( Vec_Int_t *, vResult, vPart, i )
101  {
102  pTemp = Aig_ManRegCreatePart( pAig, vPart, &nCountPis, &nCountRegs, &pMapBack );
103  Aig_ManSetRegNum( pTemp, pTemp->nRegs );
104  // create the projection of 1-hot registers
105  if ( pAig->vOnehots )
106  pTemp->vOnehots = Aig_ManRegProjectOnehots( pAig, pTemp, pAig->vOnehots, fVerbose );
107  // run SSW
108  if (nCountPis>0) {
109  pNew = Ssw_SignalCorrespondence( pTemp, pPars );
110  nClasses = Aig_TransferMappedClasses( pAig, pTemp, pMapBack );
111  if ( fVerbose )
112  Abc_Print( 1, "%3d : Reg = %4d. PI = %4d. (True = %4d. Regs = %4d.) And = %5d. It = %3d. Cl = %5d.\n",
113  i, Vec_IntSize(vPart), Aig_ManCiNum(pTemp)-Vec_IntSize(vPart), nCountPis, nCountRegs, Aig_ManNodeNum(pTemp), pPars->nIters, nClasses );
114  Aig_ManStop( pNew );
115  }
116  Aig_ManStop( pTemp );
117  ABC_FREE( pMapBack );
118  }
119  // remap the AIG
120  pNew = Aig_ManDupRepr( pAig, 0 );
121  Aig_ManSeqCleanup( pNew );
122 // Aig_ManPrintStats( pAig );
123 // Aig_ManPrintStats( pNew );
124  Vec_VecFree( (Vec_Vec_t *)vResult );
125  pPars->nPartSize = nPartSize;
126  pPars->fVerbose = fVerbose;
127  if ( fVerbose )
128  {
129  ABC_PRT( "Total time", Abc_Clock() - clk );
130  }
131  return pNew;
132 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Aig_Man_t * Aig_ManRegCreatePart(Aig_Man_t *pAig, Vec_Int_t *vPart, int *pnCountPis, int *pnCountRegs, int **ppMapBack)
Definition: aigPartReg.c:308
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Aig_ManPartDivide(Vec_Ptr_t *vResult, Vec_Int_t *vDomain, int nPartSize, int nOverSize)
Definition: aigPartReg.c:513
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
int Aig_ManSeqCleanup(Aig_Man_t *p)
Definition: aigScl.c:158
Vec_Ptr_t * Aig_ManRegProjectOnehots(Aig_Man_t *pAig, Aig_Man_t *pPart, Vec_Ptr_t *vOnehots, int fVerbose)
Definition: aigPartReg.c:248
Aig_Man_t * Ssw_SignalCorrespondence(Aig_Man_t *pAig, Ssw_Pars_t *pPars)
Definition: sswCore.c:414
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
void Aig_ManReprStart(Aig_Man_t *p, int nIdMax)
DECLARATIONS ///.
Definition: aigRepr.c:45
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
int Aig_TransferMappedClasses(Aig_Man_t *pAig, Aig_Man_t *pPart, int *pMapBack)
Definition: aigRepr.c:533
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
char * sprintf()
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
void Ioa_WriteAiger(Aig_Man_t *pMan, char *pFileName, int fWriteSymbols, int fCompact)
Definition: ioaWriteAig.c:446
Aig_Man_t * Aig_ManDupRepr(Aig_Man_t *p, int fOrdered)
Definition: aigRepr.c:267
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_PRT(a, t)
Definition: abc_global.h:220
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278
Vec_Ptr_t * Aig_ManRegPartitionSimple(Aig_Man_t *pAig, int nPartSize, int nOverSize)
Definition: aigPartReg.c:474