abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sfm.h File Reference
#include "misc/vec/vecWec.h"

Go to the source code of this file.

Data Structures

struct  Sfm_Par_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Sfm_Ntk_t_ 
Sfm_Ntk_t
 INCLUDES ///. More...
 
typedef struct Sfm_Par_t_ Sfm_Par_t
 

Functions

void Sfm_ParSetDefault (Sfm_Par_t *pPars)
 MACRO DEFINITIONS ///. More...
 
int Sfm_NtkPerform (Sfm_Ntk_t *p, Sfm_Par_t *pPars)
 
Sfm_Ntk_tSfm_NtkConstruct (Vec_Wec_t *vFanins, int nPis, int nPos, Vec_Str_t *vFixed, Vec_Str_t *vEmpty, Vec_Wrd_t *vTruths)
 
void Sfm_NtkFree (Sfm_Ntk_t *p)
 
Vec_Int_tSfm_NodeReadFanins (Sfm_Ntk_t *p, int i)
 
wordSfm_NodeReadTruth (Sfm_Ntk_t *p, int i)
 
int Sfm_NodeReadFixed (Sfm_Ntk_t *p, int i)
 
int Sfm_NodeReadUsed (Sfm_Ntk_t *p, int i)
 
Vec_Int_tSfm_NtkDfs (Sfm_Ntk_t *p, Vec_Wec_t *vGroups, Vec_Int_t *vGroupMap, Vec_Int_t *vBoxesLeft)
 

Typedef Documentation

typedef typedefABC_NAMESPACE_HEADER_START struct Sfm_Ntk_t_ Sfm_Ntk_t

INCLUDES ///.

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

FileName [sfm.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [SAT-based optimization using internal don't-cares.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id:
sfm.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

]PARAMETERS ///BASIC TYPES ///

Definition at line 41 of file sfm.h.

typedef struct Sfm_Par_t_ Sfm_Par_t

Definition at line 42 of file sfm.h.

Function Documentation

Vec_Int_t* Sfm_NodeReadFanins ( Sfm_Ntk_t p,
int  i 
)

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

Synopsis [Public APIs of this network.]

Description []

SideEffects []

SeeAlso []

Definition at line 358 of file sfmNtk.c.

359 {
360  return Vec_WecEntry( &p->vFanins, i );
361 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Vec_Int_t * Vec_WecEntry(Vec_Wec_t *p, int i)
Definition: vecWec.h:142
int Sfm_NodeReadFixed ( Sfm_Ntk_t p,
int  i 
)

Definition at line 366 of file sfmNtk.c.

367 {
368  return (int)Vec_StrEntry( p->vFixed, i );
369 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static char Vec_StrEntry(Vec_Str_t *p, int i)
Definition: vecStr.h:336
word* Sfm_NodeReadTruth ( Sfm_Ntk_t p,
int  i 
)

Definition at line 362 of file sfmNtk.c.

363 {
364  return Vec_WrdEntryP( p->vTruths, i );
365 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static word * Vec_WrdEntryP(Vec_Wrd_t *p, int i)
Definition: vecWrd.h:401
int Sfm_NodeReadUsed ( Sfm_Ntk_t p,
int  i 
)

Definition at line 370 of file sfmNtk.c.

371 {
372  return (Sfm_ObjFaninNum(p, i) > 0) || (Sfm_ObjFanoutNum(p, i) > 0);
373 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Sfm_ObjFaninNum(Sfm_Ntk_t *p, int i)
Definition: sfmInt.h:139
static int Sfm_ObjFanoutNum(Sfm_Ntk_t *p, int i)
Definition: sfmInt.h:140
Sfm_Ntk_t* Sfm_NtkConstruct ( Vec_Wec_t vFanins,
int  nPis,
int  nPos,
Vec_Str_t vFixed,
Vec_Str_t vEmpty,
Vec_Wrd_t vTruths 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 167 of file sfmNtk.c.

168 {
169  Sfm_Ntk_t * p;
170  Sfm_CheckConsistency( vFanins, nPis, nPos, vFixed );
171  p = ABC_CALLOC( Sfm_Ntk_t, 1 );
172  p->nObjs = Vec_WecSize( vFanins );
173  p->nPis = nPis;
174  p->nPos = nPos;
175  p->nNodes = p->nObjs - p->nPis - p->nPos;
176  // user data
177  p->vFixed = vFixed;
178  p->vEmpty = vEmpty;
179  p->vTruths = vTruths;
180  p->vFanins = *vFanins;
181  ABC_FREE( vFanins );
182  // attributes
183  Sfm_CreateFanout( &p->vFanins, &p->vFanouts );
184  Sfm_CreateLevel( &p->vFanins, &p->vLevels, vEmpty );
185  Sfm_CreateLevelR( &p->vFanouts, &p->vLevelsR, vEmpty );
186  Vec_IntFill( &p->vCounts, p->nObjs, 0 );
187  Vec_IntFill( &p->vTravIds, p->nObjs, 0 );
188  Vec_IntFill( &p->vTravIds2, p->nObjs, 0 );
189  Vec_IntFill( &p->vId2Var, 2*p->nObjs, -1 );
190  Vec_IntFill( &p->vVar2Id, 2*p->nObjs, -1 );
191  p->vCover = Vec_IntAlloc( 1 << 16 );
192  p->vCnfs = Sfm_CreateCnf( p );
193  return p;
194 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_HEADER_START struct Sfm_Ntk_t_ Sfm_Ntk_t
INCLUDES ///.
Definition: sfm.h:41
static int Vec_WecSize(Vec_Wec_t *p)
Definition: vecWec.h:193
void Sfm_CreateLevel(Vec_Wec_t *vFanins, Vec_Int_t *vLevels, Vec_Str_t *vEmpty)
Definition: sfmNtk.c:118
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
void Sfm_CreateFanout(Vec_Wec_t *vFanins, Vec_Wec_t *vFanouts)
Definition: sfmNtk.c:76
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
Vec_Wec_t * Sfm_CreateCnf(Sfm_Ntk_t *p)
Definition: sfmCnf.c:122
void Sfm_CreateLevelR(Vec_Wec_t *vFanouts, Vec_Int_t *vLevelsR, Vec_Str_t *vEmpty)
Definition: sfmNtk.c:146
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
ABC_NAMESPACE_IMPL_START void Sfm_CheckConsistency(Vec_Wec_t *vFanins, int nPis, int nPos, Vec_Str_t *vFixed)
DECLARATIONS ///.
Definition: sfmNtk.c:45
Vec_Int_t* Sfm_NtkDfs ( Sfm_Ntk_t p,
Vec_Wec_t vGroups,
Vec_Int_t vGroupMap,
Vec_Int_t vBoxesLeft 
)

Definition at line 166 of file sfmWin.c.

167 {
168  Vec_Int_t * vNodes;
169  int i;
170  Vec_IntClear( vBoxesLeft );
171  vNodes = Vec_IntAlloc( p->nObjs );
173  Sfm_NtkForEachPo( p, i )
174  Sfm_NtkDfs_rec( p, Sfm_ObjFanin(p, i, 0), vNodes, vGroups, vGroupMap, vBoxesLeft );
175  return vNodes;
176 }
void Sfm_NtkDfs_rec(Sfm_Ntk_t *p, int iNode, Vec_Int_t *vNodes, Vec_Wec_t *vGroups, Vec_Int_t *vGroupMap, Vec_Int_t *vBoxesLeft)
Definition: sfmWin.c:136
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
#define Sfm_NtkForEachPo(p, i)
Definition: sfmInt.h:169
static int Sfm_ObjFanin(Sfm_Ntk_t *p, int i, int k)
Definition: sfmInt.h:145
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Sfm_NtkIncrementTravId(Sfm_Ntk_t *p)
Definition: sfmWin.c:114
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
void Sfm_NtkFree ( Sfm_Ntk_t p)

Definition at line 213 of file sfmNtk.c.

214 {
215  // user data
216  Vec_StrFree( p->vFixed );
217  Vec_StrFreeP( &p->vEmpty );
218  Vec_WrdFree( p->vTruths );
219  Vec_WecErase( &p->vFanins );
220  // attributes
221  Vec_WecErase( &p->vFanouts );
222  ABC_FREE( p->vLevels.pArray );
223  ABC_FREE( p->vLevelsR.pArray );
224  ABC_FREE( p->vCounts.pArray );
225  ABC_FREE( p->vTravIds.pArray );
226  ABC_FREE( p->vTravIds2.pArray );
227  ABC_FREE( p->vId2Var.pArray );
228  ABC_FREE( p->vVar2Id.pArray );
229  Vec_WecFree( p->vCnfs );
230  Vec_IntFree( p->vCover );
231  // other data
232  Vec_IntFreeP( &p->vNodes );
233  Vec_IntFreeP( &p->vDivs );
234  Vec_IntFreeP( &p->vRoots );
235  Vec_IntFreeP( &p->vTfo );
236  Vec_WrdFreeP( &p->vDivCexes );
237  Vec_IntFreeP( &p->vOrder );
238  Vec_IntFreeP( &p->vDivVars );
239  Vec_IntFreeP( &p->vDivIds );
240  Vec_IntFreeP( &p->vLits );
241  Vec_IntFreeP( &p->vValues );
242  Vec_WecFreeP( &p->vClauses );
243  Vec_IntFreeP( &p->vFaninMap );
244  if ( p->pSat ) sat_solver_delete( p->pSat );
245  ABC_FREE( p );
246 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_WecFree(Vec_Wec_t *p)
Definition: vecWec.h:345
void sat_solver_delete(sat_solver *s)
Definition: satSolver.c:1141
Vec_Ptr_t * vRoots
Definition: llb3Image.c:51
static void Vec_WrdFreeP(Vec_Wrd_t **p)
Definition: vecWrd.h:277
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
static void Vec_WecErase(Vec_Wec_t *p)
Definition: vecWec.h:336
static void Vec_WrdFree(Vec_Wrd_t *p)
Definition: vecWrd.h:260
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_WecFreeP(Vec_Wec_t **p)
Definition: vecWec.h:350
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Vec_StrFreeP(Vec_Str_t **p)
Definition: vecStr.h:233
int Sfm_NtkPerform ( Sfm_Ntk_t p,
Sfm_Par_t pPars 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 257 of file sfmCore.c.

258 {
259  int i, k, Counter = 0;
260  p->timeTotal = Abc_Clock();
261  if ( pPars->fVerbose )
262  {
263  int nFixed = p->vFixed ? Vec_StrSum(p->vFixed) : 0;
264  int nEmpty = p->vEmpty ? Vec_StrSum(p->vEmpty) : 0;
265  printf( "Performing MFS with %d PIs, %d POs, %d nodes (%d flexible, %d fixed, %d empty).\n",
266  p->nPis, p->nPos, p->nNodes, p->nNodes-nFixed, nFixed, nEmpty );
267  }
268  p->pPars = pPars;
269  Sfm_NtkPrepare( p );
270 // Sfm_ComputeInterpolantCheck( p );
271 // return 0;
272  p->nTotalNodesBeg = Vec_WecSizeUsedLimits( &p->vFanins, Sfm_NtkPiNum(p), Vec_WecSize(&p->vFanins) - Sfm_NtkPoNum(p) );
273  p->nTotalEdgesBeg = Vec_WecSizeSize(&p->vFanins) - Sfm_NtkPoNum(p);
274  Sfm_NtkForEachNode( p, i )
275  {
276  if ( Sfm_ObjIsFixed( p, i ) )
277  continue;
278  if ( p->pPars->nDepthMax && Sfm_ObjLevel(p, i) > p->pPars->nDepthMax )
279  continue;
280  if ( Sfm_ObjFaninNum(p, i) < 2 || Sfm_ObjFaninNum(p, i) > 6 )
281  continue;
282  for ( k = 0; Sfm_NodeResub(p, i); k++ )
283  {
284 // Counter++;
285 // break;
286  }
287  Counter += (k > 0);
288  if ( pPars->nNodesMax && Counter >= pPars->nNodesMax )
289  break;
290  }
291  p->nTotalNodesEnd = Vec_WecSizeUsedLimits( &p->vFanins, Sfm_NtkPiNum(p), Vec_WecSize(&p->vFanins) - Sfm_NtkPoNum(p) );
292  p->nTotalEdgesEnd = Vec_WecSizeSize(&p->vFanins) - Sfm_NtkPoNum(p);
293  p->timeTotal = Abc_Clock() - p->timeTotal;
294  if ( pPars->fVerbose )
295  Sfm_NtkPrintStats( p );
296  return Counter;
297 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nNodesMax
Definition: sfm.h:51
static int Vec_StrSum(Vec_Str_t *p)
Definition: vecStr.h:689
static int Sfm_ObjFaninNum(Sfm_Ntk_t *p, int i)
Definition: sfmInt.h:139
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_WecSize(Vec_Wec_t *p)
Definition: vecWec.h:193
static int Sfm_ObjLevel(Sfm_Ntk_t *p, int iObj)
Definition: sfmInt.h:153
void Sfm_NtkPrintStats(Sfm_Ntk_t *p)
Definition: sfmCore.c:72
static int Counter
int Sfm_NodeResub(Sfm_Ntk_t *p, int iNode)
Definition: sfmCore.c:208
int fVerbose
Definition: sfm.h:56
static int Sfm_NtkPoNum(Sfm_Ntk_t *p)
Definition: sfmInt.h:126
void Sfm_NtkPrepare(Sfm_Ntk_t *p)
Definition: sfmNtk.c:195
static int Sfm_ObjIsFixed(Sfm_Ntk_t *p, int i)
Definition: sfmInt.h:132
#define Sfm_NtkForEachNode(p, i)
Definition: sfmInt.h:170
static int Vec_WecSizeUsedLimits(Vec_Wec_t *p, int iStart, int iStop)
Definition: vecWec.h:218
static int Vec_WecSizeSize(Vec_Wec_t *p)
Definition: vecWec.h:202
static int Sfm_NtkPiNum(Sfm_Ntk_t *p)
Definition: sfmInt.h:125
void Sfm_ParSetDefault ( Sfm_Par_t pPars)

MACRO DEFINITIONS ///.

FUNCTION DECLARATIONS ///

MACRO DEFINITIONS ///.

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

FileName [sfmCore.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [SAT-based optimization using internal don't-cares.]

Synopsis [Core procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Setup parameter structure.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file sfmCore.c.

46 {
47  memset( pPars, 0, sizeof(Sfm_Par_t) );
48  pPars->nTfoLevMax = 2; // the maximum fanout levels
49  pPars->nFanoutMax = 30; // the maximum number of fanouts
50  pPars->nDepthMax = 20; // the maximum depth to try
51  pPars->nWinSizeMax = 300; // the maximum window size
52  pPars->nGrowthLevel = 0; // the maximum allowed growth in level
53  pPars->nBTLimit = 5000; // the maximum number of conflicts in one SAT run
54  pPars->fRrOnly = 0; // perform redundancy removal
55  pPars->fArea = 0; // performs optimization for area
56  pPars->fMoreEffort = 0; // performs high-affort minimization
57  pPars->fVerbose = 0; // enable basic stats
58  pPars->fVeryVerbose = 0; // enable detailed stats
59 }
char * memset()
int fRrOnly
Definition: sfm.h:53
int nBTLimit
Definition: sfm.h:50
Definition: sfm.h:43
int fArea
Definition: sfm.h:54
int fMoreEffort
Definition: sfm.h:55
int nDepthMax
Definition: sfm.h:47
int nGrowthLevel
Definition: sfm.h:49
int nTfoLevMax
Definition: sfm.h:45
int fVerbose
Definition: sfm.h:56
int fVeryVerbose
Definition: sfm.h:57
int nWinSizeMax
Definition: sfm.h:48
int nFanoutMax
Definition: sfm.h:46