ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
sfm.h File Reference
#include "misc/vec/vecWec.h"
Include dependency graph for sfm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Sfm_Par_t_
 

Typedefs

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

Functions

void Sfm_ParSetDefault (Sfm_Par_t *pPars)
 MACRO DEFINITIONS ///.
 
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, Vec_Int_t *vStarts, Vec_Wrd_t *vTruths2)
 
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, int fAllBoxes)
 

Typedef Documentation

◆ Sfm_Ntk_t

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.

◆ Sfm_Par_t

typedef struct Sfm_Par_t_ Sfm_Par_t

Definition at line 42 of file sfm.h.

Function Documentation

◆ Sfm_NodeReadFanins()

Vec_Int_t * Sfm_NodeReadFanins ( Sfm_Ntk_t * p,
int i )
extern

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

Synopsis [Public APIs of this network.]

Description []

SideEffects []

SeeAlso []

Definition at line 370 of file sfmNtk.c.

371{
372 return Vec_WecEntry( &p->vFanins, i );
373}
Cube * p
Definition exorList.c:222
Here is the caller graph for this function:

◆ Sfm_NodeReadFixed()

int Sfm_NodeReadFixed ( Sfm_Ntk_t * p,
int i )
extern

Definition at line 378 of file sfmNtk.c.

379{
380 return (int)Vec_StrEntry( p->vFixed, i );
381}
Here is the caller graph for this function:

◆ Sfm_NodeReadTruth()

word * Sfm_NodeReadTruth ( Sfm_Ntk_t * p,
int i )
extern

Definition at line 374 of file sfmNtk.c.

375{
376 return Sfm_ObjFaninNum(p, i) <= 6 ? Vec_WrdEntryP( p->vTruths, i ) : Vec_WrdEntryP( p->vTruths2, Vec_IntEntry(p->vStarts, i) );
377}
Here is the caller graph for this function:

◆ Sfm_NodeReadUsed()

int Sfm_NodeReadUsed ( Sfm_Ntk_t * p,
int i )
extern

Definition at line 382 of file sfmNtk.c.

383{
384 return (Sfm_ObjFaninNum(p, i) > 0) || (Sfm_ObjFanoutNum(p, i) > 0);
385}
Here is the caller graph for this function:

◆ Sfm_NtkConstruct()

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,
Vec_Int_t * vStarts,
Vec_Wrd_t * vTruths2 )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 167 of file sfmNtk.c.

168{
169 Sfm_Ntk_t * p; int i;
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 p->vStarts = vStarts;
182 p->vTruths2 = vTruths2;
183 ABC_FREE( vFanins );
184 // attributes
185 Sfm_CreateFanout( &p->vFanins, &p->vFanouts );
186 Sfm_CreateLevel( &p->vFanins, &p->vLevels, vEmpty );
187 Sfm_CreateLevelR( &p->vFanouts, &p->vLevelsR, vEmpty );
188 Vec_IntFill( &p->vCounts, p->nObjs, 0 );
189 Vec_IntFill( &p->vTravIds, p->nObjs, 0 );
190 Vec_IntFill( &p->vTravIds2, p->nObjs, 0 );
191 Vec_IntFill( &p->vId2Var, 2*p->nObjs, -1 );
192 Vec_IntFill( &p->vVar2Id, 2*p->nObjs, -1 );
193 p->vCover = Vec_IntAlloc( 1 << 16 );
194 p->vCnfs = Sfm_CreateCnf( p );
195 // elementary truth tables
196 for ( i = 0; i < SFM_FANIN_MAX; i++ )
197 p->pTtElems[i] = p->TtElems[i];
198 Abc_TtElemInit( p->pTtElems, SFM_FANIN_MAX );
199 return p;
200}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define ABC_FREE(obj)
Definition abc_global.h:267
Vec_Wec_t * Sfm_CreateCnf(Sfm_Ntk_t *p)
Definition sfmCnf.c:168
#define SFM_FANIN_MAX
INCLUDES ///.
Definition sfmInt.h:51
void Sfm_CreateLevelR(Vec_Wec_t *vFanouts, Vec_Int_t *vLevelsR, Vec_Str_t *vEmpty)
Definition sfmNtk.c:146
ABC_NAMESPACE_IMPL_START void Sfm_CheckConsistency(Vec_Wec_t *vFanins, int nPis, int nPos, Vec_Str_t *vFixed)
DECLARATIONS ///.
Definition sfmNtk.c:45
void Sfm_CreateLevel(Vec_Wec_t *vFanins, Vec_Int_t *vLevels, Vec_Str_t *vEmpty)
Definition sfmNtk.c:118
void Sfm_CreateFanout(Vec_Wec_t *vFanins, Vec_Wec_t *vFanouts)
Definition sfmNtk.c:76
typedefABC_NAMESPACE_HEADER_START struct Sfm_Ntk_t_ Sfm_Ntk_t
INCLUDES ///.
Definition sfm.h:41
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_NtkDfs()

Vec_Int_t * Sfm_NtkDfs ( Sfm_Ntk_t * p,
Vec_Wec_t * vGroups,
Vec_Int_t * vGroupMap,
Vec_Int_t * vBoxesLeft,
int fAllBoxes )
extern

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 );
172 Sfm_NtkIncrementTravId( p );
173 if ( fAllBoxes )
174 {
175 Vec_Int_t * vGroup;
176 Vec_WecForEachLevel( vGroups, vGroup, i )
177 Sfm_NtkDfs_rec( p, Vec_IntEntry(vGroup, 0), vNodes, vGroups, vGroupMap, vBoxesLeft );
178 }
179 Sfm_NtkForEachPo( p, i )
180 Sfm_NtkDfs_rec( p, Sfm_ObjFanin(p, i, 0), vNodes, vGroups, vGroupMap, vBoxesLeft );
181 return vNodes;
182}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
#define Sfm_NtkForEachPo(p, i)
Definition sfmInt.h:196
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
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
Definition vecWec.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_NtkFree()

void Sfm_NtkFree ( Sfm_Ntk_t * p)
extern

Definition at line 219 of file sfmNtk.c.

220{
221 // user data
222 Vec_StrFree( p->vFixed );
223 Vec_StrFreeP( &p->vEmpty );
224 Vec_WrdFree( p->vTruths );
225 Vec_WecErase( &p->vFanins );
226 Vec_IntFree( p->vStarts );
227 Vec_WrdFree( p->vTruths2 );
228 // attributes
229 Vec_WecErase( &p->vFanouts );
230 ABC_FREE( p->vLevels.pArray );
231 ABC_FREE( p->vLevelsR.pArray );
232 ABC_FREE( p->vCounts.pArray );
233 ABC_FREE( p->vTravIds.pArray );
234 ABC_FREE( p->vTravIds2.pArray );
235 ABC_FREE( p->vId2Var.pArray );
236 ABC_FREE( p->vVar2Id.pArray );
237 Vec_WecFree( p->vCnfs );
238 Vec_IntFree( p->vCover );
239 // other data
240 Vec_IntFreeP( &p->vNodes );
241 Vec_IntFreeP( &p->vDivs );
242 Vec_IntFreeP( &p->vRoots );
243 Vec_IntFreeP( &p->vTfo );
244 Vec_WrdFreeP( &p->vDivCexes );
245 Vec_IntFreeP( &p->vOrder );
246 Vec_IntFreeP( &p->vDivVars );
247 Vec_IntFreeP( &p->vDivIds );
248 Vec_IntFreeP( &p->vLits );
249 Vec_IntFreeP( &p->vValues );
250 Vec_WecFreeP( &p->vClauses );
251 Vec_IntFreeP( &p->vFaninMap );
252 if ( p->pSat ) sat_solver_delete( p->pSat );
253 ABC_FREE( p );
254}
void sat_solver_delete(sat_solver *s)
Definition satSolver.c:1341
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_NtkPerform()

int Sfm_NtkPerform ( Sfm_Ntk_t * p,
Sfm_Par_t * pPars )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 367 of file sfmCore.c.

368{
369 int i, k, Counter = 0, CounterLarge = 0;
370 //Sfm_NtkPrint( p );
371 p->timeTotal = Abc_Clock();
372 if ( pPars->fVerbose )
373 {
374 int nFixed = p->vFixed ? Vec_StrSum(p->vFixed) : 0;
375 int nEmpty = p->vEmpty ? Vec_StrSum(p->vEmpty) : 0;
376 printf( "Performing MFS with %d PIs, %d POs, %d nodes (%d flexible, %d fixed, %d empty).\n",
377 p->nPis, p->nPos, p->nNodes, p->nNodes-nFixed, nFixed, nEmpty );
378 }
379 p->pPars = pPars;
380 Sfm_NtkPrepare( p );
381// Sfm_ComputeInterpolantCheck( p );
382// return 0;
383 p->nTotalNodesBeg = Vec_WecSizeUsedLimits( &p->vFanins, Sfm_NtkPiNum(p), Vec_WecSize(&p->vFanins) - Sfm_NtkPoNum(p) );
384 p->nTotalEdgesBeg = Vec_WecSizeSize(&p->vFanins) - Sfm_NtkPoNum(p);
386 {
387 if ( Sfm_ObjIsFixed( p, i ) )
388 continue;
389 if ( p->pPars->nDepthMax && Sfm_ObjLevel(p, i) > p->pPars->nDepthMax )
390 continue;
391 //if ( Sfm_ObjFaninNum(p, i) < 2 )
392 // continue;
393 if ( Sfm_ObjFaninNum(p, i) > SFM_SUPP_MAX )
394 {
395 CounterLarge++;
396 continue;
397 }
398 for ( k = 0; Sfm_NodeResub(p, i); k++ )
399 {
400// Counter++;
401// break;
402 }
403 Counter += (k > 0);
404 if ( pPars->nNodesMax && Counter >= pPars->nNodesMax )
405 break;
406 }
407 p->nTotalNodesEnd = Vec_WecSizeUsedLimits( &p->vFanins, Sfm_NtkPiNum(p), Vec_WecSize(&p->vFanins) - Sfm_NtkPoNum(p) );
408 p->nTotalEdgesEnd = Vec_WecSizeSize(&p->vFanins) - Sfm_NtkPoNum(p);
409 p->timeTotal = Abc_Clock() - p->timeTotal;
410 if ( pPars->fVerbose && CounterLarge )
411 printf( "MFS skipped %d (out of %d) nodes with more than %d fanins.\n", CounterLarge, p->nNodes, SFM_SUPP_MAX );
412 if ( pPars->fVerbose )
414 //Sfm_NtkPrint( p );
415 return Counter;
416}
int Sfm_NodeResub(Sfm_Ntk_t *p, int iNode)
Definition sfmCore.c:288
void Sfm_NtkPrintStats(Sfm_Ntk_t *p)
Definition sfmCore.c:74
#define Sfm_NtkForEachNode(p, i)
Definition sfmInt.h:197
void Sfm_NtkPrepare(Sfm_Ntk_t *p)
Definition sfmNtk.c:201
#define SFM_SUPP_MAX
Definition sfmInt.h:56
int nNodesMax
Definition sfm.h:56
int fVerbose
Definition sfm.h:74
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_ParSetDefault()

void Sfm_ParSetDefault ( Sfm_Par_t * pPars)
extern

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 46 of file sfmCore.c.

47{
48 memset( pPars, 0, sizeof(Sfm_Par_t) );
49 pPars->nTfoLevMax = 2; // the maximum fanout levels
50 pPars->nFanoutMax = 30; // the maximum number of fanouts
51 pPars->nDepthMax = 20; // the maximum depth to try
52 pPars->nWinSizeMax = 300; // the maximum window size
53 pPars->nGrowthLevel = 0; // the maximum allowed growth in level
54 pPars->nBTLimit = 5000; // the maximum number of conflicts in one SAT run
55 pPars->fRrOnly = 0; // perform redundancy removal
56 pPars->fArea = 0; // performs optimization for area
57 pPars->fMoreEffort = 0; // performs high-affort minimization
58 pPars->fAllBoxes = 0; // enable preserving all boxes
59 pPars->fVerbose = 0; // enable basic stats
60 pPars->fVeryVerbose = 0; // enable detailed stats
61}
struct Sfm_Par_t_ Sfm_Par_t
Definition sfm.h:42
int fRrOnly
Definition sfm.h:62
int nGrowthLevel
Definition sfm.h:54
int nTfoLevMax
Definition sfm.h:45
int fVeryVerbose
Definition sfm.h:75
int nFanoutMax
Definition sfm.h:47
int fMoreEffort
Definition sfm.h:65
int fAllBoxes
Definition sfm.h:71
int fArea
Definition sfm.h:63
int nWinSizeMax
Definition sfm.h:53
int nDepthMax
Definition sfm.h:48
int nBTLimit
Definition sfm.h:55
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function: