ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
sfmInt.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "misc/vec/vec.h"
#include "sat/bsat/satSolver.h"
#include "misc/util/utilNam.h"
#include "map/scl/sclLib.h"
#include "map/scl/sclCon.h"
#include "misc/st/st.h"
#include "map/mio/mio.h"
#include "base/abc/abc.h"
#include "misc/util/utilTruth.h"
#include "sfm.h"
Include dependency graph for sfmInt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Sfm_Ntk_t_
 

Macros

#define SFM_FANIN_MAX   12
 INCLUDES ///.
 
#define SFM_WORDS_MAX   ((SFM_FANIN_MAX>6) ? (1<<(SFM_FANIN_MAX-6)) : 1)
 
#define SFM_SAT_UNDEC   0x1234567812345678
 
#define SFM_SAT_SAT   0x8765432187654321
 
#define SFM_SUPP_MAX   8
 
#define SFM_WORD_MAX   ((SFM_SUPP_MAX>6) ? (1<<(SFM_SUPP_MAX-6)) : 1)
 
#define SFM_WIN_MAX   1000
 
#define SFM_DEC_MAX   4
 
#define SFM_SIM_WORDS   8
 
#define Sfm_NtkForEachPi(p, i)
 MACRO DEFINITIONS ///.
 
#define Sfm_NtkForEachPo(p, i)
 
#define Sfm_NtkForEachNode(p, i)
 
#define Sfm_NtkForEachNodeReverse(p, i)
 
#define Sfm_ObjForEachFanin(p, Node, Fan, i)
 
#define Sfm_ObjForEachFanout(p, Node, Fan, i)
 

Typedefs

typedef struct Sfm_Fun_t_ Sfm_Fun_t
 BASIC TYPES ///.
 
typedef struct Sfm_Lib_t_ Sfm_Lib_t
 
typedef struct Sfm_Tim_t_ Sfm_Tim_t
 
typedef struct Sfm_Mit_t_ Sfm_Mit_t
 

Functions

void Kit_DsdPrintFromTruth (unsigned *pTruth, int nVars)
 
void Sfm_PrintCnf (Vec_Str_t *vCnf)
 FUNCTION DECLARATIONS ///.
 
int Sfm_TruthToCnf (word Truth, word *pTruth, int nVars, Vec_Int_t *vCover, Vec_Str_t *vCnf)
 
Vec_Wec_tSfm_CreateCnf (Sfm_Ntk_t *p)
 
void Sfm_TranslateCnf (Vec_Wec_t *vRes, Vec_Str_t *vCnf, Vec_Int_t *vFaninMap, int iPivotVar)
 
int Sfm_LibFindComplInputGate (Vec_Wrd_t *vFuncs, int iGate, int nFanins, int iFanin, int *piFaninNew)
 
Sfm_Lib_tSfm_LibPrepare (int nVars, int fTwo, int fDelay, int fVerbose, int fLibVerbose)
 
void Sfm_LibPrint (Sfm_Lib_t *p)
 
void Sfm_LibStop (Sfm_Lib_t *p)
 
int Sfm_LibFindAreaMatch (Sfm_Lib_t *p, word *pTruth, int nFanins, int *piObj)
 
int Sfm_LibFindDelayMatches (Sfm_Lib_t *p, word *pTruth, int *pFanins, int nFanins, Vec_Ptr_t *vGates, Vec_Ptr_t *vFans)
 
int Sfm_LibImplementSimple (Sfm_Lib_t *p, word *pTruth, int *pFanins, int nFanins, Vec_Int_t *vGates, Vec_Wec_t *vFanins)
 
int Sfm_LibImplementGatesArea (Sfm_Lib_t *p, int *pFanins, int nFanins, int iObj, Vec_Int_t *vGates, Vec_Wec_t *vFanins)
 
int Sfm_LibImplementGatesDelay (Sfm_Lib_t *p, int *pFanins, Mio_Gate_t *pGateB, Mio_Gate_t *pGateT, char *pFansB, char *pFansT, Vec_Int_t *vGates, Vec_Wec_t *vFanins)
 
Sfm_Ntk_tSfm_ConstructNetwork (Vec_Wec_t *vFanins, int nPis, int nPos)
 
void Sfm_NtkPrepare (Sfm_Ntk_t *p)
 
void Sfm_NtkUpdate (Sfm_Ntk_t *p, int iNode, int f, int iFaninNew, word uTruth, word *pTruth)
 
int Sfm_NtkWindowToSolver (Sfm_Ntk_t *p)
 DECLARATIONS ///.
 
word Sfm_ComputeInterpolant (Sfm_Ntk_t *p)
 
word Sfm_ComputeInterpolant2 (Sfm_Ntk_t *p)
 
Sfm_Tim_tSfm_TimStart (Mio_Library_t *pLib, Scl_Con_t *pExt, Abc_Ntk_t *pNtk, int DeltaCrit)
 
void Sfm_TimStop (Sfm_Tim_t *p)
 
int Sfm_TimReadNtkDelay (Sfm_Tim_t *p)
 
int Sfm_TimReadObjDelay (Sfm_Tim_t *p, int iObj)
 
void Sfm_TimUpdateTiming (Sfm_Tim_t *p, Vec_Int_t *vTimeNodes)
 
int Sfm_TimSortArrayByArrival (Sfm_Tim_t *p, Vec_Int_t *vNodes, int iPivot)
 
int Sfm_TimPriorityNodes (Sfm_Tim_t *p, Vec_Int_t *vCands, int Window)
 
int Sfm_TimNodeIsNonCritical (Sfm_Tim_t *p, Abc_Obj_t *pPivot, Abc_Obj_t *pNode)
 
int Sfm_TimEvalRemapping (Sfm_Tim_t *p, Vec_Int_t *vFanins, Vec_Int_t *vMap, Mio_Gate_t *pGate1, char *pFans1, Mio_Gate_t *pGate2, char *pFans2)
 
Sfm_Mit_tSfm_MitStart (Mio_Library_t *pLib, SC_Lib *pScl, Scl_Con_t *pExt, Abc_Ntk_t *pNtk, int DeltaCrit)
 FUNCTION DEFINITIONS ///.
 
void Sfm_MitStop (Sfm_Mit_t *p)
 
int Sfm_MitReadNtkDelay (Sfm_Mit_t *p)
 
int Sfm_MitReadNtkMinSlack (Sfm_Mit_t *p)
 
int Sfm_MitReadObjDelay (Sfm_Mit_t *p, int iObj)
 
void Sfm_MitTransferLoad (Sfm_Mit_t *p, Abc_Obj_t *pNew, Abc_Obj_t *pOld)
 
void Sfm_MitTimingGrow (Sfm_Mit_t *p)
 
void Sfm_MitUpdateLoad (Sfm_Mit_t *p, Vec_Int_t *vTimeNodes, int fAdd)
 
void Sfm_MitUpdateTiming (Sfm_Mit_t *p, Vec_Int_t *vTimeNodes)
 
int Sfm_MitSortArrayByArrival (Sfm_Mit_t *p, Vec_Int_t *vNodes, int iPivot)
 
int Sfm_MitPriorityNodes (Sfm_Mit_t *p, Vec_Int_t *vCands, int Window)
 
int Sfm_MitNodeIsNonCritical (Sfm_Mit_t *p, Abc_Obj_t *pPivot, Abc_Obj_t *pNode)
 
int Sfm_MitEvalRemapping (Sfm_Mit_t *p, Vec_Int_t *vMffc, Abc_Obj_t *pObj, Vec_Int_t *vFanins, Vec_Int_t *vMap, Mio_Gate_t *pGate1, char *pFans1, Mio_Gate_t *pGate2, char *pFans2)
 
int Sfm_ObjMffcSize (Sfm_Ntk_t *p, int iObj)
 
int Sfm_NtkCreateWindow (Sfm_Ntk_t *p, int iNode, int fVerbose)
 

Macro Definition Documentation

◆ SFM_DEC_MAX

#define SFM_DEC_MAX   4

Definition at line 59 of file sfmInt.h.

◆ SFM_FANIN_MAX

#define SFM_FANIN_MAX   12

INCLUDES ///.

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

FileName [rsbInt.h]

SystemName [ABC: Logic synthesis and verification system.]

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

Synopsis [Internal declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

] PARAMETERS ///

Definition at line 51 of file sfmInt.h.

◆ Sfm_NtkForEachNode

#define Sfm_NtkForEachNode ( p,
i )
Value:
for ( i = p->nPis; i + p->nPos < p->nObjs; i++ )
Cube * p
Definition exorList.c:222

Definition at line 197 of file sfmInt.h.

◆ Sfm_NtkForEachNodeReverse

#define Sfm_NtkForEachNodeReverse ( p,
i )
Value:
for ( i = p->nObjs - p->nPos - 1; i >= p->nPis; i-- )

Definition at line 198 of file sfmInt.h.

◆ Sfm_NtkForEachPi

#define Sfm_NtkForEachPi ( p,
i )
Value:
for ( i = 0; i < p->nPis; i++ )

MACRO DEFINITIONS ///.

Definition at line 195 of file sfmInt.h.

◆ Sfm_NtkForEachPo

#define Sfm_NtkForEachPo ( p,
i )
Value:
for ( i = p->nObjs - p->nPos; i < p->nObjs; i++ )

Definition at line 196 of file sfmInt.h.

◆ Sfm_ObjForEachFanin

#define Sfm_ObjForEachFanin ( p,
Node,
Fan,
i )
Value:
for ( i = 0; i < Sfm_ObjFaninNum(p, Node) && ((Fan = Sfm_ObjFanin(p, Node, i)), 1); i++ )

Definition at line 199 of file sfmInt.h.

◆ Sfm_ObjForEachFanout

#define Sfm_ObjForEachFanout ( p,
Node,
Fan,
i )
Value:
for ( i = 0; i < Sfm_ObjFanoutNum(p, Node) && ((Fan = Sfm_ObjFanout(p, Node, i)), 1); i++ )

Definition at line 200 of file sfmInt.h.

◆ SFM_SAT_SAT

#define SFM_SAT_SAT   0x8765432187654321

Definition at line 54 of file sfmInt.h.

◆ SFM_SAT_UNDEC

#define SFM_SAT_UNDEC   0x1234567812345678

Definition at line 53 of file sfmInt.h.

◆ SFM_SIM_WORDS

#define SFM_SIM_WORDS   8

Definition at line 60 of file sfmInt.h.

◆ SFM_SUPP_MAX

#define SFM_SUPP_MAX   8

Definition at line 56 of file sfmInt.h.

◆ SFM_WIN_MAX

#define SFM_WIN_MAX   1000

Definition at line 58 of file sfmInt.h.

◆ SFM_WORD_MAX

#define SFM_WORD_MAX   ((SFM_SUPP_MAX>6) ? (1<<(SFM_SUPP_MAX-6)) : 1)

Definition at line 57 of file sfmInt.h.

◆ SFM_WORDS_MAX

#define SFM_WORDS_MAX   ((SFM_FANIN_MAX>6) ? (1<<(SFM_FANIN_MAX-6)) : 1)

Definition at line 52 of file sfmInt.h.

Typedef Documentation

◆ Sfm_Fun_t

typedef struct Sfm_Fun_t_ Sfm_Fun_t

BASIC TYPES ///.

Definition at line 66 of file sfmInt.h.

◆ Sfm_Lib_t

typedef struct Sfm_Lib_t_ Sfm_Lib_t

Definition at line 67 of file sfmInt.h.

◆ Sfm_Mit_t

typedef struct Sfm_Mit_t_ Sfm_Mit_t

Definition at line 69 of file sfmInt.h.

◆ Sfm_Tim_t

typedef struct Sfm_Tim_t_ Sfm_Tim_t

Definition at line 68 of file sfmInt.h.

Function Documentation

◆ Kit_DsdPrintFromTruth()

void Kit_DsdPrintFromTruth ( unsigned * pTruth,
int nVars )
extern

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

Synopsis [Print the DSD formula.]

Description []

SideEffects []

SeeAlso []

Definition at line 491 of file kitDsd.c.

492{
493 Kit_DsdNtk_t * pTemp, * pTemp2;
494// pTemp = Kit_DsdDecomposeMux( pTruth, nVars, 5 );
495 pTemp = Kit_DsdDecomposeMux( pTruth, nVars, 8 );
496// Kit_DsdPrintExpanded( pTemp );
497 pTemp2 = Kit_DsdExpand( pTemp );
498 Kit_DsdPrint( stdout, pTemp2 );
499 Kit_DsdVerify( pTemp2, pTruth, nVars );
500 Kit_DsdNtkFree( pTemp2 );
501 Kit_DsdNtkFree( pTemp );
502}
void Kit_DsdVerify(Kit_DsdNtk_t *pNtk, unsigned *pTruth, int nVars)
Definition kitDsd.c:2493
void Kit_DsdPrint(FILE *pFile, Kit_DsdNtk_t *pNtk)
Definition kitDsd.c:375
void Kit_DsdNtkFree(Kit_DsdNtk_t *pNtk)
Definition kitDsd.c:164
Kit_DsdNtk_t * Kit_DsdDecomposeMux(unsigned *pTruth, int nVars, int nDecMux)
Definition kitDsd.c:2351
Kit_DsdNtk_t * Kit_DsdExpand(Kit_DsdNtk_t *p)
Definition kitDsd.c:1452
struct Kit_DsdNtk_t_ Kit_DsdNtk_t
Definition kit.h:124

◆ Sfm_ComputeInterpolant()

word Sfm_ComputeInterpolant ( Sfm_Ntk_t * p)
extern

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

Synopsis [Takes SAT solver and returns interpolant.]

Description [If interpolant does not exist, records difference variables.]

SideEffects []

SeeAlso []

Definition at line 154 of file sfmSat.c.

155{
156 word * pSign;
157 int status, i, Div, iVar, nFinal, * pFinal, nIter = 0;
158 int pLits[2], nVars = sat_solver_nvars( p->pSat );
159 int nWords = Abc_Truth6WordNum( Vec_IntSize(p->vDivIds) );
160 sat_solver_setnvars( p->pSat, nVars + 1 );
161 pLits[0] = Abc_Var2Lit( Sfm_ObjSatVar(p, p->iPivotNode), 0 ); // F = 1
162 pLits[1] = Abc_Var2Lit( nVars, 0 ); // iNewLit
163 assert( Vec_IntSize(p->vDivIds) <= SFM_FANIN_MAX );
164 Abc_TtClear( p->pTruth, nWords );
165 while ( 1 )
166 {
167 // find onset minterm
168 p->nSatCalls++;
169 status = sat_solver_solve( p->pSat, pLits, pLits + 2, p->pPars->nBTLimit, 0, 0, 0 );
170 if ( status == l_Undef )
171 return SFM_SAT_UNDEC;
172 if ( status == l_False )
173 return p->pTruth[0];
174 assert( status == l_True );
175 // remember variable values
176 Vec_IntClear( p->vValues );
177 Vec_IntForEachEntry( p->vDivVars, iVar, i )
178 Vec_IntPush( p->vValues, sat_solver_var_value(p->pSat, iVar) );
179 // collect divisor literals
180 Vec_IntClear( p->vLits );
181 Vec_IntPush( p->vLits, Abc_LitNot(pLits[0]) ); // F = 0
182 Vec_IntForEachEntry( p->vDivIds, Div, i )
183 Vec_IntPush( p->vLits, sat_solver_var_literal(p->pSat, Div) );
184 // check against offset
185 p->nSatCalls++;
186 status = sat_solver_solve( p->pSat, Vec_IntArray(p->vLits), Vec_IntArray(p->vLits) + Vec_IntSize(p->vLits), p->pPars->nBTLimit, 0, 0, 0 );
187 if ( status == l_Undef )
188 return SFM_SAT_UNDEC;
189 if ( status == l_True )
190 break;
191 assert( status == l_False );
192 // compute cube and add clause
193 nFinal = sat_solver_final( p->pSat, &pFinal );
194 Abc_TtFill( p->pCube, nWords );
195 Vec_IntClear( p->vLits );
196 Vec_IntPush( p->vLits, Abc_LitNot(pLits[1]) ); // NOT(iNewLit)
197 for ( i = 0; i < nFinal; i++ )
198 {
199 if ( pFinal[i] == pLits[0] )
200 continue;
201 Vec_IntPush( p->vLits, pFinal[i] );
202 iVar = Vec_IntFind( p->vDivIds, Abc_Lit2Var(pFinal[i]) ); assert( iVar >= 0 );
203 Abc_TtAndSharp( p->pCube, p->pCube, p->pTtElems[iVar], nWords, !Abc_LitIsCompl(pFinal[i]) );
204 }
205 Abc_TtOr( p->pTruth, p->pTruth, p->pCube, nWords );
206 status = sat_solver_addclause( p->pSat, Vec_IntArray(p->vLits), Vec_IntArray(p->vLits) + Vec_IntSize(p->vLits) );
207 assert( status );
208 nIter++;
209 }
210 assert( status == l_True );
211 // store the counter-example
212 Vec_IntForEachEntry( p->vDivVars, iVar, i )
213 if ( Vec_IntEntry(p->vValues, i) ^ sat_solver_var_value(p->pSat, iVar) ) // insert 1
214 {
215 pSign = Vec_WrdEntryP( p->vDivCexes, i );
216 assert( !Abc_TtGetBit( pSign, p->nCexes) );
217 Abc_TtXorBit( pSign, p->nCexes );
218 }
219 p->nCexes++;
220 return SFM_SAT_SAT;
221}
int nWords
Definition abcNpn.c:127
#define l_True
Definition bmcBmcS.c:35
#define l_Undef
Definition bmcBmcS.c:34
#define l_False
Definition bmcBmcS.c:36
#define sat_solver_addclause
Definition cecSatG2.c:37
#define sat_solver_solve
Definition cecSatG2.c:45
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
void sat_solver_setnvars(sat_solver *s, int n)
Definition satSolver.c:1272
int sat_solver_nvars(sat_solver *s)
Definition satSolver.c:2369
#define SFM_SAT_SAT
Definition sfmInt.h:54
#define SFM_FANIN_MAX
INCLUDES ///.
Definition sfmInt.h:51
#define SFM_SAT_UNDEC
Definition sfmInt.h:53
#define assert(ex)
Definition util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_ComputeInterpolant2()

word Sfm_ComputeInterpolant2 ( Sfm_Ntk_t * p)
extern

Definition at line 294 of file sfmSat.c.

295{
296 word Res, ResP, ResN, Truth[2];
297 int nCubesP = 0, nCubesN = 0;
298 int RetValue = Sfm_ComputeInterpolantInt( p, Truth );
299 if ( RetValue == l_Undef )
300 return SFM_SAT_UNDEC;
301 if ( RetValue == l_True )
302 return SFM_SAT_SAT;
303 assert( RetValue == l_False );
304 //printf( "Offset = %2d. Onset = %2d. DC = %2d. Total = %2d.\n",
305 // Abc_TtCountOnes(Truth[0]), Abc_TtCountOnes(Truth[1]),
306 // (1<<Vec_IntSize(p->vDivIds)) - (Abc_TtCountOnes(Truth[0]) + Abc_TtCountOnes(Truth[1])),
307 // 1<<Vec_IntSize(p->vDivIds) );
308 Truth[0] = Abc_Tt6Stretch( Truth[0], Vec_IntSize(p->vDivIds) );
309 Truth[1] = Abc_Tt6Stretch( Truth[1], Vec_IntSize(p->vDivIds) );
310 ResP = Abc_Tt6Isop( Truth[1], ~Truth[0], Vec_IntSize(p->vDivIds), &nCubesP );
311 ResN = Abc_Tt6Isop( Truth[0], ~Truth[1], Vec_IntSize(p->vDivIds), &nCubesN );
312 Res = nCubesP <= nCubesN ? ResP : ~ResN;
313 //Dau_DsdPrintFromTruth( &Res, Vec_IntSize(p->vDivIds) );
314 return Res;
315}
int Sfm_ComputeInterpolantInt(Sfm_Ntk_t *p, word Truth[2])
Definition sfmSat.c:234
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_ConstructNetwork()

Sfm_Ntk_t * Sfm_ConstructNetwork ( Vec_Wec_t * vFanins,
int nPis,
int nPos )
extern

◆ Sfm_CreateCnf()

Vec_Wec_t * Sfm_CreateCnf ( Sfm_Ntk_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 168 of file sfmCnf.c.

169{
170 Vec_Wec_t * vCnfs;
171 Vec_Str_t * vCnf, * vCnfBase;
172 word uTruth;
173 int i, nCubes;
174 vCnf = Vec_StrAlloc( 100 );
175 vCnfs = Vec_WecStart( p->nObjs );
176 Vec_WrdForEachEntryStartStop( p->vTruths, uTruth, i, p->nPis, Vec_WrdSize(p->vTruths)-p->nPos )
177 {
178 int Offset = Vec_IntEntry( p->vStarts, i );
179 word * pRes = Vec_WrdSize(p->vTruths2) ? Vec_WrdEntryP( p->vTruths2, Offset ) : NULL;
180 nCubes = Sfm_TruthToCnf( uTruth, pRes, Sfm_ObjFaninNum(p, i), p->vCover, vCnf );
181 vCnfBase = (Vec_Str_t *)Vec_WecEntry( vCnfs, i );
182 Vec_StrGrow( vCnfBase, Vec_StrSize(vCnf) );
183 memcpy( Vec_StrArray(vCnfBase), Vec_StrArray(vCnf), (size_t)Vec_StrSize(vCnf) );
184 vCnfBase->nSize = Vec_StrSize(vCnf);
185 }
186 Vec_StrFree( vCnf );
187 return vCnfs;
188}
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46
int Sfm_TruthToCnf(word Truth, word *pTruth, int nVars, Vec_Int_t *vCover, Vec_Str_t *vCnf)
Definition sfmCnf.c:71
int nSize
Definition bblif.c:50
char * memcpy()
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition vecWec.h:42
#define Vec_WrdForEachEntryStartStop(vVec, Entry, i, Start, Stop)
Definition vecWrd.h:60
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_LibFindAreaMatch()

int Sfm_LibFindAreaMatch ( Sfm_Lib_t * p,
word * pTruth,
int nFanins,
int * piObj )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 613 of file sfmLib.c.

614{
615 Sfm_Fun_t * pObj = NULL;
616 int iFunc = *Vec_MemHashLookup( p->vTtMem, pTruth );
617 if ( iFunc == -1 )
618 return -1;
619 Sfm_LibForEachSuper( p, pObj, iFunc )
620 break;
621 if ( piObj )
622 *piObj = pObj - p->pObjs;
623 return pObj->Area;
624}
struct Sfm_Fun_t_ Sfm_Fun_t
BASIC TYPES ///.
Definition sfmInt.h:66
#define Sfm_LibForEachSuper(p, pObj, Func)
Definition sfmLib.c:70
int Area
Definition sfmLib.c:41
Here is the caller graph for this function:

◆ Sfm_LibFindComplInputGate()

int Sfm_LibFindComplInputGate ( Vec_Wrd_t * vFuncs,
int iGate,
int nFanins,
int iFanin,
int * piFaninNew )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 161 of file sfmLib.c.

162{
163 word uTruthGate = Vec_WrdEntry( vFuncs, iGate );
164 word uTruthFlip = Abc_Tt6Flip( uTruthGate, iFanin );
165 word uTruth, uTruthSwap; int i;
166 assert( iFanin >= 0 && iFanin < nFanins );
167 if ( piFaninNew ) *piFaninNew = iFanin;
168 Vec_WrdForEachEntry( vFuncs, uTruth, i )
169 if ( uTruth == uTruthFlip )
170 return i;
171 if ( iFanin-1 >= 0 )
172 {
173 if ( piFaninNew ) *piFaninNew = iFanin-1;
174 uTruthSwap = Abc_Tt6SwapAdjacent( uTruthFlip, iFanin-1 );
175 Vec_WrdForEachEntry( vFuncs, uTruth, i )
176 if ( uTruth == uTruthSwap )
177 return i;
178 }
179 if ( iFanin+1 < nFanins )
180 {
181 if ( piFaninNew ) *piFaninNew = iFanin+1;
182 uTruthSwap = Abc_Tt6SwapAdjacent( uTruthFlip, iFanin );
183 Vec_WrdForEachEntry( vFuncs, uTruth, i )
184 if ( uTruth == uTruthSwap )
185 return i;
186 }
187 // add checking for complemeting control input of a MUX
188 if ( piFaninNew ) *piFaninNew = -1;
189 return -1;
190}
#define Vec_WrdForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecWrd.h:54
Here is the caller graph for this function:

◆ Sfm_LibFindDelayMatches()

int Sfm_LibFindDelayMatches ( Sfm_Lib_t * p,
word * pTruth,
int * pFanins,
int nFanins,
Vec_Ptr_t * vGates,
Vec_Ptr_t * vFans )
extern

Definition at line 625 of file sfmLib.c.

626{
627 Sfm_Fun_t * pObj;
628 Mio_Cell2_t * pCellB, * pCellT;
629 int iFunc;
630 if ( nFanins > 6 )
631 {
632 word pCopy[4];
633 Abc_TtCopy( pCopy, pTruth, 4, 0 );
634 Dau_DsdPrintFromTruth( pCopy, p->nVars );
635 }
636 Vec_PtrClear( vGates );
637 Vec_PtrClear( vFans );
638 // look for gate
639 assert( !Abc_TtIsConst0(pTruth, p->nWords) &&
640 !Abc_TtIsConst1(pTruth, p->nWords) &&
641 !Abc_TtEqual(pTruth, s_Truth8[0], p->nWords) &&
642 !Abc_TtOpposite(pTruth, s_Truth8[0], p->nWords) );
643 iFunc = *Vec_MemHashLookup( p->vTtMem, pTruth );
644 if ( iFunc == -1 )
645 {
646 // print functions not found in the library
647 if ( p->fVerbose || nFanins > 6 )
648 {
649 printf( "Not found in the precomputed library: " );
650 Dau_DsdPrintFromTruth( pTruth, nFanins );
651 }
652 return 0;
653 }
654 Vec_IntAddToEntry( &p->vHits, iFunc, 1 );
655 // collect matches
656 Sfm_LibForEachSuper( p, pObj, iFunc )
657 {
658 pCellB = p->pCells + (int)pObj->pFansB[0];
659 pCellT = p->pCells + (int)pObj->pFansT[0];
660 Vec_PtrPush( vGates, pCellB->pMioGate );
661 Vec_PtrPush( vGates, pCellT == p->pCells ? NULL : pCellT->pMioGate );
662 Vec_PtrPush( vFans, pObj->pFansB + 1 );
663 Vec_PtrPush( vFans, pCellT == p->pCells ? NULL : pObj->pFansT + 1 );
664 }
665 return Vec_PtrSize(vGates) / 2;
666}
void Dau_DsdPrintFromTruth(word *pTruth, int nVarsInit)
Definition dauDsd.c:1968
struct Mio_Cell2_t_ Mio_Cell2_t
Definition mio.h:57
void * pMioGate
Definition mio.h:70
char pFansB[SFM_SUPP_MAX+1]
Definition sfmLib.c:43
char pFansT[SFM_SUPP_MAX+1]
Definition sfmLib.c:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_LibImplementGatesArea()

int Sfm_LibImplementGatesArea ( Sfm_Lib_t * p,
int * pFanins,
int nFanins,
int iObj,
Vec_Int_t * vGates,
Vec_Wec_t * vFanins )
extern

Definition at line 704 of file sfmLib.c.

705{
707 Sfm_Fun_t * pObjMin = p->pObjs + iObj;
708 Mio_Cell2_t * pCellB, * pCellT;
709 Mio_Gate_t * pGate;
710 Vec_Int_t * vLevel;
711 int i;
712 // get the gates
713 pCellB = p->pCells + (int)pObjMin->pFansB[0];
714 pCellT = p->pCells + (int)pObjMin->pFansT[0];
715 // create bottom gate
716 pGate = Mio_LibraryReadGateByName( pLib, pCellB->pName, NULL );
717 assert( pGate == pCellB->pMioGate );
718 Vec_IntPush( vGates, Mio_GateReadValue(pGate) );
719 vLevel = Vec_WecPushLevel( vFanins );
720 for ( i = 0; i < (int)pCellB->nFanins; i++ )
721 Vec_IntPush( vLevel, pFanins[(int)pObjMin->pFansB[i+1]] );
722 if ( pCellT == p->pCells )
723 return 1;
724 // create top gate
725 pGate = Mio_LibraryReadGateByName( pLib, pCellT->pName, NULL );
726 assert( pGate == pCellT->pMioGate );
727 Vec_IntPush( vGates, Mio_GateReadValue(pGate) );
728 vLevel = Vec_WecPushLevel( vFanins );
729 for ( i = 0; i < (int)pCellT->nFanins; i++ )
730 if ( pObjMin->pFansT[i+1] == (char)16 )
731 Vec_IntPush( vLevel, Vec_WecSize(vFanins)-2 );
732 else
733 Vec_IntPush( vLevel, pFanins[(int)pObjMin->pFansT[i+1]] );
734 return 2;
735}
ABC_DLL void * Abc_FrameReadLibGen()
Definition mainFrame.c:59
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
struct Mio_LibraryStruct_t_ Mio_Library_t
Definition mio.h:42
Mio_Gate_t * Mio_LibraryReadGateByName(Mio_Library_t *pLib, char *pName, char *pOutName)
Definition mioApi.c:105
int Mio_GateReadValue(Mio_Gate_t *pGate)
Definition mioApi.c:183
struct Mio_GateStruct_t_ Mio_Gate_t
Definition mio.h:43
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_LibImplementGatesDelay()

int Sfm_LibImplementGatesDelay ( Sfm_Lib_t * p,
int * pFanins,
Mio_Gate_t * pGateB,
Mio_Gate_t * pGateT,
char * pFansB,
char * pFansT,
Vec_Int_t * vGates,
Vec_Wec_t * vFanins )
extern

Definition at line 736 of file sfmLib.c.

737{
738 Vec_Int_t * vLevel;
739 int i, nFanins;
740 // create bottom gate
741 Vec_IntPush( vGates, Mio_GateReadValue(pGateB) );
742 vLevel = Vec_WecPushLevel( vFanins );
743 nFanins = Mio_GateReadPinNum( pGateB );
744 for ( i = 0; i < nFanins; i++ )
745 Vec_IntPush( vLevel, pFanins[(int)pFansB[i]] );
746 if ( pGateT == NULL )
747 return 1;
748 // create top gate
749 Vec_IntPush( vGates, Mio_GateReadValue(pGateT) );
750 vLevel = Vec_WecPushLevel( vFanins );
751 nFanins = Mio_GateReadPinNum( pGateT );
752 for ( i = 0; i < nFanins; i++ )
753 if ( pFansT[i] == (char)16 )
754 Vec_IntPush( vLevel, Vec_WecSize(vFanins)-2 );
755 else
756 Vec_IntPush( vLevel, pFanins[(int)pFansT[i]] );
757 return 2;
758}
int Mio_GateReadPinNum(Mio_Gate_t *pGate)
Definition mioApi.c:177
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_LibImplementSimple()

int Sfm_LibImplementSimple ( Sfm_Lib_t * p,
word * pTruth,
int * pFanins,
int nFanins,
Vec_Int_t * vGates,
Vec_Wec_t * vFanins )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 679 of file sfmLib.c.

680{
682 Mio_Gate_t * pGate;
683 Vec_Int_t * vLevel;
684 if ( Abc_TtIsConst0(pTruth, p->nWords) || Abc_TtIsConst1(pTruth, p->nWords) )
685 {
686 assert( nFanins == 0 );
687 pGate = Abc_TtIsConst1(pTruth, p->nWords) ? Mio_LibraryReadConst1(pLib) : Mio_LibraryReadConst0(pLib);
688 Vec_IntPush( vGates, Mio_GateReadValue(pGate) );
689 vLevel = Vec_WecPushLevel( vFanins );
690 return 1;
691 }
692 if ( Abc_TtEqual(pTruth, s_Truth8[0], p->nWords) || Abc_TtOpposite(pTruth, s_Truth8[0], p->nWords) )
693 {
694 assert( nFanins == 1 );
695 pGate = Abc_TtEqual(pTruth, s_Truth8[0], p->nWords) ? Mio_LibraryReadBuf(pLib) : Mio_LibraryReadInv(pLib);
696 Vec_IntPush( vGates, Mio_GateReadValue(pGate) );
697 vLevel = Vec_WecPushLevel( vFanins );
698 Vec_IntPush( vLevel, pFanins[0] );
699 return 1;
700 }
701 assert( 0 );
702 return -1;
703}
Mio_Gate_t * Mio_LibraryReadConst0(Mio_Library_t *pLib)
Definition mioApi.c:51
Mio_Gate_t * Mio_LibraryReadConst1(Mio_Library_t *pLib)
Definition mioApi.c:52
Mio_Gate_t * Mio_LibraryReadInv(Mio_Library_t *pLib)
Definition mioApi.c:50
Mio_Gate_t * Mio_LibraryReadBuf(Mio_Library_t *pLib)
Definition mioApi.c:49
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_LibPrepare()

Sfm_Lib_t * Sfm_LibPrepare ( int nVars,
int fTwo,
int fDelay,
int fVerbose,
int fLibVerbose )
extern

Definition at line 438 of file sfmLib.c.

439{
440 abctime clk = Abc_Clock();
441 Sfm_Lib_t * p = Sfm_LibStart( nVars, fDelay, fLibVerbose );
442 Mio_Cell2_t * pCell1, * pCell2, * pLimit;
443 int * pPerm[SFM_SUPP_MAX+1], * Perm1, * Perm2, Perm[SFM_SUPP_MAX];
444 int nPerms[SFM_SUPP_MAX+1], i, f, n;
445 word tTemp1[4], tCur[4];
446 char pRes[1000];
447 assert( nVars <= SFM_SUPP_MAX );
448 // precompute gates
449 p->pCells = Mio_CollectRootsNewDefault2( Abc_MinInt(6, nVars), &p->nCells, 0 );
450 pLimit = p->pCells + p->nCells;
451 // find useful ones
452 for ( pCell1 = p->pCells + 4; pCell1 < pLimit; pCell1++ )
453 {
454 word uTruth = pCell1->uTruth;
455 pCell1->Type = 0;
456 if ( Abc_Tt6IsAndType(uTruth, pCell1->nFanins) || Abc_Tt6IsOrType(uTruth, pCell1->nFanins) )
457 pCell1->Type = 1;
458 else if ( Dau_DsdDecompose(&uTruth, pCell1->nFanins, 0, 0, pRes) <= 3 )
459 pCell1->Type = 2;
460 else if ( fLibVerbose )
461 printf( "Skipping gate \"%s\" with non-DSD function %s\n", pCell1->pName, pRes );
462 }
463 // generate permutations
464 for ( i = 2; i <= nVars; i++ )
465 pPerm[i] = Extra_PermSchedule( i );
466 for ( i = 2; i <= nVars; i++ )
467 nPerms[i] = Extra_Factorial( i );
468 // add single cells
469 for ( pCell1 = p->pCells + 4; pCell1 < pLimit; pCell1++ )
470 {
471 int nFanins = pCell1->nFanins;
472 assert( nFanins >= 2 && nFanins <= nVars );
473 for ( i = 0; i < nFanins; i++ )
474 Perm[i] = i;
475 // permute truth table
476 tCur[0] = tTemp1[0] = pCell1->uTruth;
477 if ( p->nVars > 6 )
478 tTemp1[1] = tTemp1[2] = tTemp1[3] = tCur[1] = tCur[2] = tCur[3] = tCur[0];
479 for ( n = 0; n < nPerms[nFanins]; n++ )
480 {
481 Sfm_LibPrepareAdd( p, tCur, Perm, nFanins, pCell1, NULL, -1 );
482 // update
483 Abc_TtSwapAdjacent( tCur, p->nWords, pPerm[nFanins][n] );
484 Perm1 = Perm + pPerm[nFanins][n];
485 Perm2 = Perm1 + 1;
486 ABC_SWAP( int, *Perm1, *Perm2 );
487 }
488 assert( Abc_TtEqual(tTemp1, tCur, p->nWords) );
489 }
490 // add double cells
491 if ( fTwo )
492 for ( pCell1 = p->pCells + 4; pCell1 < pLimit; pCell1++ ) // Bot
493 if ( pCell1->Type > 0 )
494 for ( pCell2 = p->pCells + 4; pCell2 < pLimit; pCell2++ ) // Top
495 if ( pCell2->Type > 0 )//&& pCell1->Type + pCell2->Type <= 2 )
496 if ( (int)pCell1->nFanins + (int)pCell2->nFanins <= nVars + 1 )
497 for ( f = 0; f < (int)pCell2->nFanins; f++ )
498 {
499 int nFanins = pCell1->nFanins + pCell2->nFanins - 1;
500 assert( nFanins >= 2 && nFanins <= nVars );
501 for ( i = 0; i < nFanins; i++ )
502 Perm[i] = i;
503 // permute truth table
504 if ( p->nVars > 6 )
505 {
506 Sfm_LibTruth8Two( pCell1, pCell2, f, tCur );
507 Abc_TtCopy( tTemp1, tCur, p->nWords, 0 );
508 }
509 else
510 tCur[0] = tTemp1[0] = Sfm_LibTruth6Two( pCell1, pCell2, f );
511 for ( n = 0; n < nPerms[nFanins]; n++ )
512 {
513 Sfm_LibPrepareAdd( p, tCur, Perm, nFanins, pCell1, pCell2, f );
514 if ( nFanins > 5 )
515 break;
516 // update
517 Abc_TtSwapAdjacent( tCur, p->nWords, pPerm[nFanins][n] );
518 Perm1 = Perm + pPerm[nFanins][n];
519 Perm2 = Perm1 + 1;
520 ABC_SWAP( int, *Perm1, *Perm2 );
521 }
522 assert( Abc_TtEqual(tTemp1, tCur, p->nWords) );
523 }
524 // cleanup
525 for ( i = 2; i <= nVars; i++ )
526 ABC_FREE( pPerm[i] );
527 if ( fVerbose )
528 {
529 printf( "Library processing: Var = %d. Cell = %d. Fun = %d. Obj = %d. Ave = %.2f. Skip = %d. Rem = %d. ",
530 nVars, p->nCells, Vec_MemEntryNum(p->vTtMem)-2,
531 p->nObjs-p->nObjRemoved, 1.0*(p->nObjs-p->nObjRemoved)/(Vec_MemEntryNum(p->vTtMem)-2),
532 p->nObjSkipped, p->nObjRemoved );
533 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
534 }
535 return p;
536}
#define ABC_SWAP(Type, a, b)
Definition abc_global.h:253
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_FREE(obj)
Definition abc_global.h:267
int Dau_DsdDecompose(word *pTruth, int nVarsInit, int fSplitPrime, int fWriteTruth, char *pRes)
Definition dauDsd.c:1912
int * Extra_PermSchedule(int n)
int Extra_Factorial(int n)
Mio_Cell2_t * Mio_CollectRootsNewDefault2(int nInputs, int *pnGates, int fVerbose)
Definition mioUtils.c:877
#define SFM_SUPP_MAX
Definition sfmInt.h:56
struct Sfm_Lib_t_ Sfm_Lib_t
Definition sfmInt.h:67
void Sfm_LibPrepareAdd(Sfm_Lib_t *p, word *pTruth, int *Perm, int nFanins, Mio_Cell2_t *pCellBot, Mio_Cell2_t *pCellTop, int InTop)
Definition sfmLib.c:335
word Sfm_LibTruth6Two(Mio_Cell2_t *pCellBot, Mio_Cell2_t *pCellTop, int InTop)
Definition sfmLib.c:252
Sfm_Lib_t * Sfm_LibStart(int nVars, int fDelay, int fVerbose)
Definition sfmLib.c:204
void Sfm_LibTruth8Two(Mio_Cell2_t *pCellBot, Mio_Cell2_t *pCellTop, int InTop, word *pRes)
Definition sfmLib.c:266
unsigned Type
Definition mio.h:63
word uTruth
Definition mio.h:67
char * pName
Definition mio.h:60
unsigned nFanins
Definition mio.h:64
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_LibPrint()

void Sfm_LibPrint ( Sfm_Lib_t * p)
extern

Definition at line 567 of file sfmLib.c.

568{
569 Sfm_Fun_t * pObj; word * pTruth; int i, nFanins;
570 Vec_MemForEachEntry( p->vTtMem, pTruth, i )
571 {
572 if ( i < 2 || Vec_IntEntry(&p->vHits, i) == 0 )
573 continue;
574 nFanins = Abc_TtSupportSize(pTruth, p->nVars);
575 printf( "%8d : ", i );
576 printf( "Num =%5d ", Vec_IntEntry(&p->vCounts, i) );
577 printf( "Hit =%4d ", Vec_IntEntry(&p->vHits, i) );
578 Sfm_LibForEachSuper( p, pObj, i )
579 {
580 Sfm_LibPrintObj( p, pObj );
581 break;
582 }
583 printf( " " );
584 Dau_DsdPrintFromTruth( pTruth, nFanins );
585 }
586}
void Sfm_LibPrintObj(Sfm_Lib_t *p, Sfm_Fun_t *pObj)
Definition sfmLib.c:548
#define Vec_MemForEachEntry(p, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecMem.h:68
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_LibStop()

void Sfm_LibStop ( Sfm_Lib_t * p)
extern

Definition at line 226 of file sfmLib.c.

227{
228 Vec_MemHashFree( p->vTtMem );
229 Vec_MemFree( p->vTtMem );
230 Vec_IntErase( &p->vLists );
231 Vec_IntErase( &p->vCounts );
232 Vec_IntErase( &p->vHits );
233 Vec_IntErase( &p->vProfs );
234 Vec_IntErase( &p->vStore );
235 Vec_IntErase( &p->vTemp );
236 ABC_FREE( p->pCells );
237 ABC_FREE( p->pObjs );
238 ABC_FREE( p );
239}
Here is the caller graph for this function:

◆ Sfm_MitEvalRemapping()

int Sfm_MitEvalRemapping ( Sfm_Mit_t * p,
Vec_Int_t * vMffc,
Abc_Obj_t * pObj,
Vec_Int_t * vFanins,
Vec_Int_t * vMap,
Mio_Gate_t * pGate1,
char * pFans1,
Mio_Gate_t * pGate2,
char * pFans2 )
extern

Definition at line 64 of file sfmMit.c.

64{ return 0;}
Here is the caller graph for this function:

◆ Sfm_MitNodeIsNonCritical()

int Sfm_MitNodeIsNonCritical ( Sfm_Mit_t * p,
Abc_Obj_t * pPivot,
Abc_Obj_t * pNode )
extern

Definition at line 63 of file sfmMit.c.

63{ return 0;}

◆ Sfm_MitPriorityNodes()

int Sfm_MitPriorityNodes ( Sfm_Mit_t * p,
Vec_Int_t * vCands,
int Window )
extern

Definition at line 62 of file sfmMit.c.

62{ return 0;}
Here is the caller graph for this function:

◆ Sfm_MitReadNtkDelay()

int Sfm_MitReadNtkDelay ( Sfm_Mit_t * p)
extern

Definition at line 54 of file sfmMit.c.

54{ return 0;}

◆ Sfm_MitReadNtkMinSlack()

int Sfm_MitReadNtkMinSlack ( Sfm_Mit_t * p)
extern

Definition at line 55 of file sfmMit.c.

55{ return 0;}

◆ Sfm_MitReadObjDelay()

int Sfm_MitReadObjDelay ( Sfm_Mit_t * p,
int iObj )
extern

Definition at line 56 of file sfmMit.c.

56{ return 0;}

◆ Sfm_MitSortArrayByArrival()

int Sfm_MitSortArrayByArrival ( Sfm_Mit_t * p,
Vec_Int_t * vNodes,
int iPivot )
extern

Definition at line 61 of file sfmMit.c.

61{ return 0;}
Here is the caller graph for this function:

◆ Sfm_MitStart()

Sfm_Mit_t * Sfm_MitStart ( Mio_Library_t * pLib,
SC_Lib * pScl,
Scl_Con_t * pExt,
Abc_Ntk_t * pNtk,
int DeltaCrit )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Temporary place holders.]

Description []

SideEffects []

SeeAlso []

Definition at line 52 of file sfmMit.c.

52{ return NULL; }
Here is the caller graph for this function:

◆ Sfm_MitStop()

void Sfm_MitStop ( Sfm_Mit_t * p)
extern

Definition at line 53 of file sfmMit.c.

53{}
Here is the caller graph for this function:

◆ Sfm_MitTimingGrow()

void Sfm_MitTimingGrow ( Sfm_Mit_t * p)
extern

Definition at line 58 of file sfmMit.c.

58{};
Here is the caller graph for this function:

◆ Sfm_MitTransferLoad()

void Sfm_MitTransferLoad ( Sfm_Mit_t * p,
Abc_Obj_t * pNew,
Abc_Obj_t * pOld )
extern

Definition at line 57 of file sfmMit.c.

57{};
Here is the caller graph for this function:

◆ Sfm_MitUpdateLoad()

void Sfm_MitUpdateLoad ( Sfm_Mit_t * p,
Vec_Int_t * vTimeNodes,
int fAdd )
extern

Definition at line 59 of file sfmMit.c.

59{}
Here is the caller graph for this function:

◆ Sfm_MitUpdateTiming()

void Sfm_MitUpdateTiming ( Sfm_Mit_t * p,
Vec_Int_t * vTimeNodes )
extern

Definition at line 60 of file sfmMit.c.

60{}
Here is the caller graph for this function:

◆ Sfm_NtkCreateWindow()

int Sfm_NtkCreateWindow ( Sfm_Ntk_t * p,
int iNode,
int fVerbose )
extern

Definition at line 340 of file sfmWin.c.

341{
342 int i, k, iTemp;
343 abctime clkDiv, clkWin = Abc_Clock();
344
345 assert( Sfm_ObjIsNode( p, iNode ) );
346 p->iPivotNode = iNode;
347 Vec_IntClear( p->vNodes ); // internal
348 Vec_IntClear( p->vDivs ); // divisors
349 Vec_IntClear( p->vRoots ); // roots
350 Vec_IntClear( p->vTfo ); // roots
351 Vec_IntClear( p->vOrder ); // variable order
352
353 // collect transitive fanin
354 Sfm_NtkIncrementTravId( p );
355 if ( Sfm_NtkCollectTfi_rec( p, iNode, p->vNodes ) )
356 {
357 p->nMaxDivs++;
358 p->timeWin += Abc_Clock() - clkWin;
359 return 0;
360 }
361
362 // create divisors
363 clkDiv = Abc_Clock();
364 Vec_IntClear( p->vDivs );
365 Vec_IntAppend( p->vDivs, p->vNodes );
366 Vec_IntPop( p->vDivs );
367 // add non-topological divisors
368 if ( !p->pPars->nWinSizeMax || Vec_IntSize(p->vDivs) < p->pPars->nWinSizeMax + 0 )
369 {
370 Sfm_NtkIncrementTravId2( p );
371 Vec_IntForEachEntry( p->vDivs, iTemp, i )
372 if ( !p->pPars->nWinSizeMax || Vec_IntSize(p->vDivs) < p->pPars->nWinSizeMax + 0 )
373// Sfm_NtkAddDivisors( p, iTemp, Sfm_ObjLevel(p, iNode) - 1 );
374 Sfm_NtkAddDivisors( p, iTemp, p->nLevelMax - Sfm_ObjLevelR(p, iNode) );
375 }
376 if ( p->pPars->nWinSizeMax && Vec_IntSize(p->vDivs) > p->pPars->nWinSizeMax )
377 {
378/*
379 k = 0;
380 Vec_IntForEachEntryStart( p->vDivs, iTemp, i, Vec_IntSize(p->vDivs) - p->pPars->nWinSizeMax )
381 Vec_IntWriteEntry( p->vDivs, k++, iTemp );
382 assert( k == p->pPars->nWinSizeMax );
383*/
384 Vec_IntShrink( p->vDivs, p->pPars->nWinSizeMax );
385 }
386 assert( !p->pPars->nWinSizeMax || Vec_IntSize(p->vDivs) <= p->pPars->nWinSizeMax );
387 p->nMaxDivs += (int)(p->pPars->nWinSizeMax && Vec_IntSize(p->vDivs) == p->pPars->nWinSizeMax);
388 // remove node/fanins from divisors
389 // mark fanins
390 Sfm_NtkIncrementTravId2( p );
391 Sfm_ObjSetTravIdCurrent2( p, iNode );
392 Sfm_ObjForEachFanin( p, iNode, iTemp, i )
393 Sfm_ObjSetTravIdCurrent2( p, iTemp );
394 // compact divisors
395 k = 0;
396 Vec_IntForEachEntry( p->vDivs, iTemp, i )
397 if ( !Sfm_ObjIsTravIdCurrent2(p, iTemp) && Sfm_ObjIsUseful(p, iTemp) )
398 Vec_IntWriteEntry( p->vDivs, k++, iTemp );
399 Vec_IntShrink( p->vDivs, k );
400 assert( !p->pPars->nWinSizeMax || Vec_IntSize(p->vDivs) <= p->pPars->nWinSizeMax );
401 clkDiv = Abc_Clock() - clkDiv;
402 p->timeDiv += clkDiv;
403 p->nTotalDivs += Vec_IntSize(p->vDivs);
404
405 // collect TFO and window roots
406 if ( p->pPars->nTfoLevMax > 0 && !Sfm_NtkCheckRoot(p, iNode, Sfm_ObjLevel(p, iNode) + p->pPars->nTfoLevMax) )
407 {
408 // explore transitive fanout
409 Sfm_NtkIncrementTravId( p );
410 Sfm_NtkComputeRoots_rec( p, iNode, Sfm_ObjLevel(p, iNode) + p->pPars->nTfoLevMax, p->vRoots, p->vTfo );
411 assert( Vec_IntSize(p->vRoots) > 0 );
412 assert( Vec_IntSize(p->vTfo) > 0 );
413 // compute new leaves and nodes
414 Sfm_NtkIncrementTravId( p );
415 Vec_IntForEachEntry( p->vRoots, iTemp, i )
416 if ( Sfm_NtkCollectTfi_rec( p, iTemp, p->vOrder ) )
417 {
418 Vec_IntClear( p->vRoots );
419 Vec_IntClear( p->vTfo );
420 Vec_IntClear( p->vOrder );
421 break;
422 }
423 if ( Vec_IntSize(p->vRoots) > 0 )
424 Vec_IntForEachEntry( p->vTfo, iTemp, i )
425 if ( Sfm_NtkCollectTfi_rec( p, iTemp, p->vOrder ) )
426 {
427 Vec_IntClear( p->vRoots );
428 Vec_IntClear( p->vTfo );
429 Vec_IntClear( p->vOrder );
430 break;
431 }
432 if ( Vec_IntSize(p->vRoots) > 0 )
433 Vec_IntForEachEntry( p->vDivs, iTemp, i )
434 if ( Sfm_NtkCollectTfi_rec( p, iTemp, p->vOrder ) )
435 {
436 Vec_IntClear( p->vRoots );
437 Vec_IntClear( p->vTfo );
438 Vec_IntClear( p->vOrder );
439 break;
440 }
441 }
442
443 if ( Vec_IntSize(p->vOrder) == 0 )
444 {
445 int Temp = p->pPars->nWinSizeMax;
446 p->pPars->nWinSizeMax = 0;
447 Sfm_NtkIncrementTravId( p );
448 Sfm_NtkCollectTfi_rec( p, iNode, p->vOrder );
449 Vec_IntForEachEntry( p->vDivs, iTemp, i )
450 Sfm_NtkCollectTfi_rec( p, iTemp, p->vOrder );
451 p->pPars->nWinSizeMax = Temp;
452 }
453
454 // statistics
455 p->timeWin += Abc_Clock() - clkWin - clkDiv;
456 if ( !fVerbose )
457 return 1;
458
459 // print stats about the window
460 printf( "%6d : ", iNode );
461 printf( "Leaves = %5d. ", 0 );
462 printf( "Nodes = %5d. ", Vec_IntSize(p->vNodes) );
463 printf( "Roots = %5d. ", Vec_IntSize(p->vRoots) );
464 printf( "Divs = %5d. ", Vec_IntSize(p->vDivs) );
465 printf( "\n" );
466 return 1;
467}
#define Sfm_ObjForEachFanin(p, Node, Fan, i)
Definition sfmInt.h:199
int Sfm_NtkCollectTfi_rec(Sfm_Ntk_t *p, int iNode, Vec_Int_t *vNodes)
Definition sfmWin.c:328
void Sfm_NtkComputeRoots_rec(Sfm_Ntk_t *p, int iNode, int nLevelMax, Vec_Int_t *vRoots, Vec_Int_t *vTfo)
Definition sfmWin.c:240
void Sfm_NtkAddDivisors(Sfm_Ntk_t *p, int iNode, int nLevelMax)
Definition sfmWin.c:268
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_NtkPrepare()

void Sfm_NtkPrepare ( Sfm_Ntk_t * p)
extern

Definition at line 201 of file sfmNtk.c.

202{
203 p->nLevelMax = Vec_IntFindMax(&p->vLevels) + p->pPars->nGrowthLevel;
204 p->vNodes = Vec_IntAlloc( 1000 );
205 p->vDivs = Vec_IntAlloc( 100 );
206 p->vRoots = Vec_IntAlloc( 1000 );
207 p->vTfo = Vec_IntAlloc( 1000 );
208 p->vDivCexes = Vec_WrdStart( p->pPars->nWinSizeMax );
209 p->vOrder = Vec_IntAlloc( 100 );
210 p->vDivVars = Vec_IntAlloc( 100 );
211 p->vDivIds = Vec_IntAlloc( 1000 );
212 p->vLits = Vec_IntAlloc( 100 );
213 p->vValues = Vec_IntAlloc( 100 );
214 p->vClauses = Vec_WecAlloc( 100 );
215 p->vFaninMap = Vec_IntAlloc( 10 );
216 p->pSat = sat_solver_new();
217 sat_solver_setnvars( p->pSat, p->pPars->nWinSizeMax );
218}
sat_solver * sat_solver_new(void)
Definition satSolver.c:1137
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_NtkUpdate()

void Sfm_NtkUpdate ( Sfm_Ntk_t * p,
int iNode,
int f,
int iFaninNew,
word uTruth,
word * pTruth )
extern

Definition at line 322 of file sfmNtk.c.

323{
324 int iFanin = Sfm_ObjFanin( p, iNode, f );
325 int nWords = Abc_Truth6WordNum( Sfm_ObjFaninNum(p, iNode) - (int)(iFaninNew == -1) );
326 assert( Sfm_ObjIsNode(p, iNode) );
327 assert( iFanin != iFaninNew );
328 assert( Sfm_ObjFaninNum(p, iNode) <= SFM_FANIN_MAX );
329 if ( Abc_TtIsConst0(pTruth, nWords) || Abc_TtIsConst1(pTruth, nWords) )
330 {
331 Sfm_ObjForEachFanin( p, iNode, iFanin, f )
332 {
333 int RetValue = Vec_IntRemove( Sfm_ObjFoArray(p, iFanin), iNode ); assert( RetValue );
334 Sfm_NtkDeleteObj_rec( p, iFanin );
335 }
336 Vec_IntClear( Sfm_ObjFiArray(p, iNode) );
337 }
338 else
339 {
340 // replace old fanin by new fanin
341 Sfm_NtkRemoveFanin( p, iNode, iFanin );
342 Sfm_NtkAddFanin( p, iNode, iFaninNew );
343 // recursively remove MFFC
344 Sfm_NtkDeleteObj_rec( p, iFanin );
345 }
346 // update logic level
347 Sfm_NtkUpdateLevel_rec( p, iNode );
348 if ( iFaninNew != -1 )
349 Sfm_NtkUpdateLevelR_rec( p, iFaninNew );
350 if ( Sfm_ObjFanoutNum(p, iFanin) > 0 )
351 Sfm_NtkUpdateLevelR_rec( p, iFanin );
352 // update truth table
353 Vec_WrdWriteEntry( p->vTruths, iNode, uTruth );
354 if ( p->vTruths2 && Vec_WrdSize(p->vTruths2) )
355 Abc_TtCopy( Vec_WrdEntryP(p->vTruths2, Vec_IntEntry(p->vStarts, iNode)), pTruth, nWords, 0 );
356 Sfm_TruthToCnf( uTruth, pTruth, Sfm_ObjFaninNum(p, iNode), p->vCover, (Vec_Str_t *)Vec_WecEntry(p->vCnfs, iNode) );
357}
void Sfm_NtkAddFanin(Sfm_Ntk_t *p, int iNode, int iFanin)
Definition sfmNtk.c:277
void Sfm_NtkDeleteObj_rec(Sfm_Ntk_t *p, int iNode)
Definition sfmNtk.c:288
void Sfm_NtkRemoveFanin(Sfm_Ntk_t *p, int iNode, int iFanin)
Definition sfmNtk.c:267
void Sfm_NtkUpdateLevel_rec(Sfm_Ntk_t *p, int iNode)
Definition sfmNtk.c:302
void Sfm_NtkUpdateLevelR_rec(Sfm_Ntk_t *p, int iNode)
Definition sfmNtk.c:312
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_NtkWindowToSolver()

int Sfm_NtkWindowToSolver ( Sfm_Ntk_t * p)
extern

DECLARATIONS ///.

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

FileName [sfmSat.c]

SystemName [ABC: Logic synthesis and verification system.]

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

Synopsis [SAT-based procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Converts a window into a SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file sfmSat.c.

47{
48 // p->vOrder contains all variables in the window in a good order
49 // p->vDivs is a subset of nodes in p->vOrder used as divisor candidates
50 // p->vTfo contains TFO of the node (does not include node)
51 // p->vRoots contains roots of the TFO of the node (may include node)
52 Vec_Int_t * vClause;
53 int RetValue, iNode = -1, iFanin, i, k;
54 abctime clk = Abc_Clock();
55// if ( p->pSat )
56// printf( "%d ", p->pSat->stats.learnts );
57 sat_solver_restart( p->pSat );
58 sat_solver_setnvars( p->pSat, 1 + Vec_IntSize(p->vOrder) + Vec_IntSize(p->vTfo) + Vec_IntSize(p->vRoots) + 10 );
59 // create SAT variables
60 Sfm_NtkCleanVars( p );
61 p->nSatVars = 1;
62 Vec_IntForEachEntry( p->vOrder, iNode, i )
63 Sfm_ObjSetSatVar( p, iNode, p->nSatVars++ );
64 // collect divisor variables
65 Vec_IntClear( p->vDivVars );
66 Vec_IntForEachEntry( p->vDivs, iNode, i )
67 Vec_IntPush( p->vDivVars, Sfm_ObjSatVar(p, iNode) );
68 // add CNF clauses for the TFI
69 Vec_IntForEachEntry( p->vOrder, iNode, i )
70 {
71 if ( Sfm_ObjIsPi(p, iNode) )
72 continue;
73 // collect fanin variables
74 Vec_IntClear( p->vFaninMap );
75 Sfm_ObjForEachFanin( p, iNode, iFanin, k )
76 Vec_IntPush( p->vFaninMap, Sfm_ObjSatVar(p, iFanin) );
77 Vec_IntPush( p->vFaninMap, Sfm_ObjSatVar(p, iNode) );
78 // generate CNF
79 Sfm_TranslateCnf( p->vClauses, (Vec_Str_t *)Vec_WecEntry(p->vCnfs, iNode), p->vFaninMap, -1 );
80 // add clauses
81 Vec_WecForEachLevel( p->vClauses, vClause, k )
82 {
83 if ( Vec_IntSize(vClause) == 0 )
84 break;
85 RetValue = sat_solver_addclause( p->pSat, Vec_IntArray(vClause), Vec_IntArray(vClause) + Vec_IntSize(vClause) );
86 if ( RetValue == 0 )
87 return 0;
88 }
89 }
90 if ( Vec_IntSize(p->vTfo) > 0 )
91 {
92 assert( p->pPars->nTfoLevMax > 0 );
93 assert( Vec_IntSize(p->vRoots) > 0 );
94 assert( Vec_IntEntry(p->vTfo, 0) != p->iPivotNode );
95 // collect variables of root nodes
96 Vec_IntClear( p->vLits );
97 Vec_IntForEachEntry( p->vRoots, iNode, i )
98 Vec_IntPush( p->vLits, Sfm_ObjSatVar(p, iNode) );
99 // assign new variables to the TFO nodes
100 Vec_IntForEachEntry( p->vTfo, iNode, i )
101 {
102 Sfm_ObjCleanSatVar( p, Sfm_ObjSatVar(p, iNode) );
103 Sfm_ObjSetSatVar( p, iNode, p->nSatVars++ );
104 }
105 // add CNF clauses for the TFO
106 Vec_IntForEachEntry( p->vTfo, iNode, i )
107 {
108 assert( Sfm_ObjIsNode(p, iNode) );
109 // collect fanin variables
110 Vec_IntClear( p->vFaninMap );
111 Sfm_ObjForEachFanin( p, iNode, iFanin, k )
112 Vec_IntPush( p->vFaninMap, Sfm_ObjSatVar(p, iFanin) );
113 Vec_IntPush( p->vFaninMap, Sfm_ObjSatVar(p, iNode) );
114 // generate CNF
115 Sfm_TranslateCnf( p->vClauses, (Vec_Str_t *)Vec_WecEntry(p->vCnfs, iNode), p->vFaninMap, Sfm_ObjSatVar(p, p->iPivotNode) );
116 // add clauses
117 Vec_WecForEachLevel( p->vClauses, vClause, k )
118 {
119 if ( Vec_IntSize(vClause) == 0 )
120 break;
121 RetValue = sat_solver_addclause( p->pSat, Vec_IntArray(vClause), Vec_IntArray(vClause) + Vec_IntSize(vClause) );
122 if ( RetValue == 0 )
123 return 0;
124 }
125 }
126 // create XOR clauses for the roots
127 Vec_IntForEachEntry( p->vRoots, iNode, i )
128 {
129 sat_solver_add_xor( p->pSat, Vec_IntEntry(p->vLits, i), Sfm_ObjSatVar(p, iNode), p->nSatVars++, 0 );
130 Vec_IntWriteEntry( p->vLits, i, Abc_Var2Lit(p->nSatVars-1, 0) );
131 }
132 // make OR clause for the last nRoots variables
133 RetValue = sat_solver_addclause( p->pSat, Vec_IntArray(p->vLits), Vec_IntArray(p->vLits) + Vec_IntSize(p->vLits) );
134 if ( RetValue == 0 )
135 return 0;
136 }
137 // finalize
138 RetValue = sat_solver_simplify( p->pSat );
139 p->timeCnf += Abc_Clock() - clk;
140 return RetValue;
141}
#define sat_solver_add_xor
Definition cecSatG2.c:39
int sat_solver_simplify(sat_solver *s)
Definition satSolver.c:1515
void sat_solver_restart(sat_solver *s)
Definition satSolver.c:1389
void Sfm_TranslateCnf(Vec_Wec_t *vRes, Vec_Str_t *vCnf, Vec_Int_t *vFaninMap, int iPivotVar)
Definition sfmCnf.c:201
#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_ObjMffcSize()

int Sfm_ObjMffcSize ( Sfm_Ntk_t * p,
int iObj )
extern

Definition at line 89 of file sfmWin.c.

90{
91 int Count1, Count2;
92 if ( Sfm_ObjIsPi(p, iObj) )
93 return 0;
94 if ( Sfm_ObjFanoutNum(p, iObj) != 1 )
95 return 0;
96 assert( Sfm_ObjIsNode( p, iObj ) );
97 Count1 = Sfm_ObjDeref( p, iObj );
98 Count2 = Sfm_ObjRef( p, iObj );
99 assert( Count1 == Count2 );
100 return Count1;
101}
int Sfm_ObjDeref(Sfm_Ntk_t *p, int iObj)
Definition sfmWin.c:82
int Sfm_ObjRef(Sfm_Ntk_t *p, int iObj)
Definition sfmWin.c:60
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_PrintCnf()

void Sfm_PrintCnf ( Vec_Str_t * vCnf)
extern

FUNCTION DECLARATIONS ///.

FUNCTION DECLARATIONS ///.

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

FileName [sfmCnf.c]

SystemName [ABC: Logic synthesis and verification system.]

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

Synopsis [CNF computation.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file sfmCnf.c.

47{
48 signed char Entry;
49 int i, Lit;
50 Vec_StrForEachEntry( vCnf, Entry, i )
51 {
52 Lit = (int)Entry;
53 if ( Lit == -1 )
54 printf( "\n" );
55 else
56 printf( "%s%d ", Abc_LitIsCompl(Lit) ? "-":"", Abc_Lit2Var(Lit) );
57 }
58}
#define Vec_StrForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecStr.h:54

◆ Sfm_TimEvalRemapping()

int Sfm_TimEvalRemapping ( Sfm_Tim_t * p,
Vec_Int_t * vFanins,
Vec_Int_t * vMap,
Mio_Gate_t * pGate1,
char * pFans1,
Mio_Gate_t * pGate2,
char * pFans2 )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 428 of file sfmTim.c.

429{
430 int TimeOut[2][2];
431 int * pTimesIn1[6], * pTimesIn2[6];
432 int i, nFanins1, nFanins2;
433 // process the first gate
434 nFanins1 = Mio_GateReadPinNum( pGate1 );
435 for ( i = 0; i < nFanins1; i++ )
436 pTimesIn1[i] = Sfm_TimArrId( p, Vec_IntEntry(vMap, Vec_IntEntry(vFanins, (int)pFans1[i])) );
437 Sfm_TimGateArrival( p, pGate1, pTimesIn1, TimeOut[0] );
438 if ( pGate2 == NULL )
439 return Abc_MaxInt(TimeOut[0][0], TimeOut[0][1]);
440 // process the second gate
441 nFanins2 = Mio_GateReadPinNum( pGate2 );
442 for ( i = 0; i < nFanins2; i++ )
443 if ( (int)pFans2[i] == 16 )
444 pTimesIn2[i] = TimeOut[0];
445 else
446 pTimesIn2[i] = Sfm_TimArrId( p, Vec_IntEntry(vMap, Vec_IntEntry(vFanins, (int)pFans2[i])) );
447 Sfm_TimGateArrival( p, pGate2, pTimesIn2, TimeOut[1] );
448 return Abc_MaxInt(TimeOut[1][0], TimeOut[1][1]);
449}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_TimNodeIsNonCritical()

int Sfm_TimNodeIsNonCritical ( Sfm_Tim_t * p,
Abc_Obj_t * pPivot,
Abc_Obj_t * pNode )
extern

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

Synopsis [Returns 1 if node is relatively non-critical compared to the pivot.]

Description []

SideEffects []

SeeAlso []

Definition at line 412 of file sfmTim.c.

413{
414 return Sfm_TimArrMax(p, pNode) + p->DeltaCrit <= Sfm_TimArrMax(p, pPivot);
415}

◆ Sfm_TimPriorityNodes()

int Sfm_TimPriorityNodes ( Sfm_Tim_t * p,
Vec_Int_t * vCands,
int Window )
extern

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

Synopsis [Priority of nodes to try remapping for delay.]

Description []

SideEffects []

SeeAlso []

Definition at line 374 of file sfmTim.c.

375{
376 Vec_Int_t * vLevel;
377 Abc_Obj_t * pObj;
378 int i, k;
379 assert( Window >= 0 && Window <= 100 );
380 // collect critical path
381 Sfm_TimCriticalPath( p, Window );
382 // add nodes to the levelized structure
383 Sfm_TimUpdateClean( p );
384 Abc_NtkForEachObjVec( &p->vPath, p->pNtk, pObj, i )
385 {
386 assert( pObj->fMarkC == 0 );
387 pObj->fMarkC = 1;
388 Vec_WecPush( &p->vLevels, Abc_ObjLevel(pObj), Abc_ObjId(pObj) );
389 }
390 // prioritize nodes by expected gain
391 Vec_WecSort( &p->vLevels, 0 );
392 Vec_IntClear( vCands );
393 Vec_WecForEachLevel( &p->vLevels, vLevel, i )
394 Abc_NtkForEachObjVec( vLevel, p->pNtk, pObj, k )
395 if ( !pObj->fMarkA )
396 Vec_IntPush( vCands, Abc_ObjId(pObj) );
397// printf( "Path = %5d Cand = %5d\n", Vec_IntSize(&p->vPath) );
398 return Vec_IntSize(vCands) > 0;
399}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Definition abc.h:455
int Sfm_TimCriticalPath(Sfm_Tim_t *p, int Window)
Definition sfmTim.c:172
unsigned fMarkC
Definition abc.h:136
unsigned fMarkA
Definition abc.h:134
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_TimReadNtkDelay()

int Sfm_TimReadNtkDelay ( Sfm_Tim_t * p)
extern

Definition at line 251 of file sfmTim.c.

252{
253 return p->Delay;
254}

◆ Sfm_TimReadObjDelay()

int Sfm_TimReadObjDelay ( Sfm_Tim_t * p,
int iObj )
extern

Definition at line 255 of file sfmTim.c.

256{
257 return Sfm_TimArrMaxId(p, iObj);
258}

◆ Sfm_TimSortArrayByArrival()

int Sfm_TimSortArrayByArrival ( Sfm_Tim_t * p,
Vec_Int_t * vNodes,
int iPivot )
extern

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

Synopsis [Sort an array of nodes using their max arrival times.]

Description [Returns the number of new divisor nodes.]

SideEffects []

SeeAlso []

Definition at line 336 of file sfmTim.c.

337{
338 word Entry;
339 int i, Id, Time, nDivNew = -1;
340 int MaxDelay = ABC_INFINITY/2+Sfm_TimArrMaxId(p, iPivot);
341 assert( p->DeltaCrit > 0 );
342 // collect nodes
343 Vec_WrdClear( &p->vSortData );
344 Vec_IntForEachEntry( vNodes, Id, i )
345 {
346 Time = Sfm_TimArrMaxId( p, Id );
347 assert( -ABC_INFINITY/2 < Time && Time < ABC_INFINITY/2 );
348 Vec_WrdPush( &p->vSortData, ((word)Id << 32) | (ABC_INFINITY/2+Time) );
349 }
350 // sort nodes by delay
351 Abc_QuickSort3( Vec_WrdArray(&p->vSortData), Vec_WrdSize(&p->vSortData), 0 );
352 // collect sorted nodes and find place where divisors end
353 Vec_IntClear( vNodes );
354 Vec_WrdForEachEntry( &p->vSortData, Entry, i )
355 {
356 Vec_IntPush( vNodes, (int)(Entry >> 32) );
357 if ( nDivNew == -1 && ((int)Entry) + p->DeltaCrit > MaxDelay )
358 nDivNew = i;
359 }
360 return nDivNew;
361}
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
void Abc_QuickSort3(word *pData, int nSize, int fDecrease)
Definition utilSort.c:884
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_TimStart()

Sfm_Tim_t * Sfm_TimStart ( Mio_Library_t * pLib,
Scl_Con_t * pExt,
Abc_Ntk_t * pNtk,
int DeltaCrit )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 229 of file sfmTim.c.

230{
232 p->pLib = pLib;
233 p->pExt = pExt;
234 p->pNtk = pNtk;
235 Vec_IntFill( &p->vTimArrs, 3*Abc_NtkObjNumMax(pNtk), 0 );
236 Vec_IntFill( &p->vTimReqs, 3*Abc_NtkObjNumMax(pNtk), 0 );
237 p->Delay = Sfm_TimTrace( p );
238 assert( DeltaCrit > 0 && DeltaCrit < Scl_Flt2Int(1000.0) );
239 p->DeltaCrit = DeltaCrit;
240 return p;
241}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
struct Sfm_Tim_t_ Sfm_Tim_t
Definition sfmInt.h:68
int Sfm_TimTrace(Sfm_Tim_t *p)
Definition sfmTim.c:201
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_TimStop()

void Sfm_TimStop ( Sfm_Tim_t * p)
extern

Definition at line 242 of file sfmTim.c.

243{
244 Vec_IntErase( &p->vTimArrs );
245 Vec_IntErase( &p->vTimReqs );
246 Vec_WecErase( &p->vLevels );
247 Vec_IntErase( &p->vPath );
248 Vec_WrdErase( &p->vSortData );
249 ABC_FREE( p );
250}
Here is the caller graph for this function:

◆ Sfm_TimUpdateTiming()

void Sfm_TimUpdateTiming ( Sfm_Tim_t * p,
Vec_Int_t * vTimeNodes )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 317 of file sfmTim.c.

318{
319 assert( Vec_IntSize(vTimeNodes) > 0 && Vec_IntSize(vTimeNodes) <= 2 );
320 Vec_IntFillExtra( &p->vTimArrs, 2*Abc_NtkObjNumMax(p->pNtk), 0 );
321 Vec_IntFillExtra( &p->vTimReqs, 2*Abc_NtkObjNumMax(p->pNtk), 0 );
322 p->Delay = Sfm_TimTrace( p );
323}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sfm_TranslateCnf()

void Sfm_TranslateCnf ( Vec_Wec_t * vRes,
Vec_Str_t * vCnf,
Vec_Int_t * vFaninMap,
int iPivotVar )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 201 of file sfmCnf.c.

202{
203 Vec_Int_t * vClause;
204 signed char Entry;
205 int i, Lit;
206 assert( Vec_StrEntry(vCnf, 1) != -1 || Vec_IntSize(vFaninMap) == 1 );
207 Vec_WecClear( vRes );
208 vClause = Vec_WecPushLevel( vRes );
209 Vec_StrForEachEntry( vCnf, Entry, i )
210 {
211 if ( (int)Entry == -1 )
212 {
213 vClause = Vec_WecPushLevel( vRes );
214 continue;
215 }
216 Lit = Abc_Lit2LitV( Vec_IntArray(vFaninMap), (int)Entry );
217 Lit = Abc_LitNotCond( Lit, Abc_Lit2Var(Lit) == iPivotVar );
218 Vec_IntPush( vClause, Lit );
219 }
220}
Here is the caller graph for this function:

◆ Sfm_TruthToCnf()

int Sfm_TruthToCnf ( word Truth,
word * pTruth,
int nVars,
Vec_Int_t * vCover,
Vec_Str_t * vCnf )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 71 of file sfmCnf.c.

72{
73 int w, nWords = Abc_Truth6WordNum( nVars );
74 Vec_StrClear( vCnf );
75 if ( nVars <= 6 )
76 {
77 if ( Truth == 0 || ~Truth == 0 )
78 {
79 assert( nVars == 0 );
80 Vec_StrPush( vCnf, (char)(Truth == 0) );
81 Vec_StrPush( vCnf, (char)-1 );
82 return 1;
83 }
84 }
85 else
86 {
87 // const0
88 for ( w = 0; w < nWords; w++ )
89 if ( pTruth[w] )
90 break;
91 if ( w == nWords )
92 {
93 Vec_StrPush( vCnf, (char)1 );
94 Vec_StrPush( vCnf, (char)-1 );
95 assert( 0 );
96 return 1;
97 }
98 // const1
99 for ( w = 0; w < nWords; w++ )
100 if ( ~pTruth[w] )
101 break;
102 if ( w == nWords )
103 {
104 Vec_StrPush( vCnf, (char)0 );
105 Vec_StrPush( vCnf, (char)-1 );
106 assert( 0 );
107 return 1;
108 }
109 }
110 {
111 int i, k, c, RetValue, Literal, Cube, nCubes = 0;
112 assert( nVars > 0 );
113
114 Abc_TtFlipVar5( &Truth, nVars );
115 Abc_TtFlipVar5( pTruth, nVars );
116 for ( c = 0; c < 2; c ++ )
117 {
118 if ( nVars <= 6 )
119 {
120 Truth = c ? ~Truth : Truth;
121 RetValue = Kit_TruthIsop( (unsigned *)&Truth, nVars, vCover, 0 );
122 }
123 else
124 {
125 if ( c )
126 for ( k = 0; k < nWords; k++ )
127 pTruth[k] = ~pTruth[k];
128 RetValue = Kit_TruthIsop( (unsigned *)pTruth, nVars, vCover, 0 );
129 if ( c )
130 for ( k = 0; k < nWords; k++ )
131 pTruth[k] = ~pTruth[k];
132 }
133 assert( RetValue == 0 );
134 nCubes += Vec_IntSize( vCover );
135 Vec_IntForEachEntry( vCover, Cube, i )
136 {
137 for ( k = 0; k < nVars; k++ )
138 {
139 Literal = 3 & (Cube >> (k << 1));
140 if ( Literal == 1 ) // '0' -> pos lit
141 Vec_StrPush( vCnf, (char)Abc_Var2Lit(k, 0) );
142 else if ( Literal == 2 ) // '1' -> neg lit
143 Vec_StrPush( vCnf, (char)Abc_Var2Lit(k, 1) );
144 else if ( Literal != 0 )
145 assert( 0 );
146 }
147 Vec_StrPush( vCnf, (char)Abc_Var2Lit(nVars, c) );
148 Vec_StrPush( vCnf, (char)-1 );
149 }
150 }
151 Abc_TtFlipVar5( pTruth, nVars );
152
153 return nCubes;
154 }
155}
struct cube Cube
int Kit_TruthIsop(unsigned *puTruth, int nVars, Vec_Int_t *vMemory, int fTryBoth)
Definition kitIsop.c:134
Here is the call graph for this function:
Here is the caller graph for this function: