ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
sbdInt.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 "misc/util/utilTruth.h"
#include "map/scl/sclLib.h"
#include "map/scl/sclCon.h"
#include "bool/kit/kit.h"
#include "misc/st/st.h"
#include "map/mio/mio.h"
#include "base/abc/abc.h"
#include "sbd.h"
Include dependency graph for sbdInt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Sbd_Str_t_
 

Macros

#define SBD_SAT_UNDEC   0x1234567812345678
 INCLUDES ///.
 
#define SBD_SAT_SAT   0x8765432187654321
 
#define SBD_LUTS_MAX   2
 
#define SBD_SIZE_MAX   4
 
#define SBD_DIV_MAX   10
 
#define SBD_FVAR_MAX   100
 

Typedefs

typedef struct Sbd_Sto_t_ Sbd_Sto_t
 BASIC TYPES ///.
 
typedef struct Sbd_Srv_t_ Sbd_Srv_t
 
typedef struct Sbd_Str_t_ Sbd_Str_t
 

Functions

Sbd_Sto_tSbd_StoAlloc (Gia_Man_t *pGia, Vec_Int_t *vMirrors, int nLutSize, int nCutSize, int nCutNum, int fCutMin, int fVerbose)
 MACRO DEFINITIONS ///.
 
void Sbd_StoFree (Sbd_Sto_t *p)
 
int Sbd_StoObjRefs (Sbd_Sto_t *p, int iObj)
 
void Sbd_StoRefObj (Sbd_Sto_t *p, int iObj, int iMirror)
 
void Sbd_StoDerefObj (Sbd_Sto_t *p, int iObj)
 
void Sbd_StoComputeCutsConst0 (Sbd_Sto_t *p, int iObj)
 
void Sbd_StoComputeCutsObj (Sbd_Sto_t *p, int iObj, int Delay, int Level)
 
void Sbd_StoComputeCutsCi (Sbd_Sto_t *p, int iObj, int Delay, int Level)
 
int Sbd_StoComputeCutsNode (Sbd_Sto_t *p, int iObj)
 
void Sbd_StoSaveBestDelayCut (Sbd_Sto_t *p, int iObj, int *pCut)
 
int Sbd_StoObjBestCut (Sbd_Sto_t *p, int iObj, int nSize, int *pLeaves)
 
Sbd_Srv_tSbd_ManCutServerStart (Gia_Man_t *pGia, Vec_Int_t *vMirrors, Vec_Int_t *vLutLevs, Vec_Int_t *vLevs, Vec_Int_t *vRefs, int nLutSize, int nCutSize, int nCutNum, int fVerbose)
 FUNCTION DEFINITIONS ///.
 
void Sbd_ManCutServerStop (Sbd_Srv_t *p)
 
int Sbd_ManCutServerFirst (Sbd_Srv_t *p, int iObj, int *pLeaves)
 
word Sbd_ManSolve (sat_solver *pSat, int PivotVar, int FreeVar, Vec_Int_t *vDivSet, Vec_Int_t *vDivVars, Vec_Int_t *vDivValues, Vec_Int_t *vTemp)
 
sat_solverSbd_ManSatSolver (sat_solver *pSat, Gia_Man_t *p, Vec_Int_t *vMirrors, int Pivot, Vec_Int_t *vWinObjs, Vec_Int_t *vObj2Var, Vec_Int_t *vTfo, Vec_Int_t *vRoots, int fQbf)
 DECLARATIONS ///.
 
int Sbd_ManCollectConstants (sat_solver *pSat, int nCareMints[2], int PivotVar, word *pVarSims[], Vec_Int_t *vInds)
 
int Sbd_ManCollectConstantsNew (sat_solver *pSat, Vec_Int_t *vDivVars, int nConsts, int PivotVar, word *pOnset, word *pOffset)
 
Vec_Bit_tSbc_ManCriticalPath (Gia_Man_t *p)
 
int Sbd_ProblemSolve (Gia_Man_t *p, Vec_Int_t *vMirrors, int Pivot, Vec_Int_t *vWinObjs, Vec_Int_t *vObj2Var, Vec_Int_t *vTfo, Vec_Int_t *vRoots, Vec_Int_t *vDivSet, int nStrs, Sbd_Str_t *pStr0)
 

Macro Definition Documentation

◆ SBD_DIV_MAX

#define SBD_DIV_MAX   10

Definition at line 57 of file sbdInt.h.

◆ SBD_FVAR_MAX

#define SBD_FVAR_MAX   100

Definition at line 58 of file sbdInt.h.

◆ SBD_LUTS_MAX

#define SBD_LUTS_MAX   2

Definition at line 55 of file sbdInt.h.

◆ SBD_SAT_SAT

#define SBD_SAT_SAT   0x8765432187654321

Definition at line 53 of file sbdInt.h.

◆ SBD_SAT_UNDEC

#define SBD_SAT_UNDEC   0x1234567812345678

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 52 of file sbdInt.h.

◆ SBD_SIZE_MAX

#define SBD_SIZE_MAX   4

Definition at line 56 of file sbdInt.h.

Typedef Documentation

◆ Sbd_Srv_t

typedef struct Sbd_Srv_t_ Sbd_Srv_t

Definition at line 65 of file sbdInt.h.

◆ Sbd_Sto_t

typedef struct Sbd_Sto_t_ Sbd_Sto_t

BASIC TYPES ///.

Definition at line 64 of file sbdInt.h.

◆ Sbd_Str_t

typedef struct Sbd_Str_t_ Sbd_Str_t

Definition at line 67 of file sbdInt.h.

Function Documentation

◆ Sbc_ManCriticalPath()

Vec_Bit_t * Sbc_ManCriticalPath ( Gia_Man_t * p)
extern

Definition at line 119 of file sbdPath.c.

120{
121 int * pLevels = NULL, k, iDriver, Slack = 1;
122 int nLevels = p->pManTime ? Gia_ManLutLevelWithBoxes(p) : Gia_ManLutLevel(p, &pLevels);
123 Vec_Bit_t * vPath = Vec_BitStart( Gia_ManObjNum(p) );
124 if ( p->pManTime )
125 pLevels = Vec_IntArray( p->vLevels );
127 Gia_ManForEachCoDriverId( p, iDriver, k )
128 if ( (pLevels[iDriver] == nLevels) && iDriver )
129 Sbc_ManCriticalPath_rec( p, pLevels, iDriver, pLevels[iDriver], vPath, Slack );
130 if ( !p->pManTime )
131 ABC_FREE( pLevels );
132 Sbc_ManAddInternalToPath( p, vPath );
133 return vPath;
134}
#define ABC_FREE(obj)
Definition abc_global.h:267
Cube * p
Definition exorList.c:222
int Gia_ManLutLevel(Gia_Man_t *p, int **ppLevels)
Definition giaIf.c:165
#define Gia_ManForEachCoDriverId(p, DriverId, i)
Definition gia.h:1246
int Gia_ManLutLevelWithBoxes(Gia_Man_t *p)
Definition giaTim.c:581
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition giaUtil.c:190
void Sbc_ManAddInternalToPath(Gia_Man_t *p, Vec_Bit_t *vPath)
Definition sbdPath.c:63
void Sbc_ManCriticalPath_rec(Gia_Man_t *p, int *pLevels, int iObj, int LevelFan, Vec_Bit_t *vPath, int Slack)
Definition sbdPath.c:88
typedefABC_NAMESPACE_HEADER_START struct Vec_Bit_t_ Vec_Bit_t
INCLUDES ///.
Definition vecBit.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sbd_ManCollectConstants()

int Sbd_ManCollectConstants ( sat_solver * pSat,
int nCareMints[2],
int PivotVar,
word * pVarSims[],
Vec_Int_t * vInds )
extern

Definition at line 411 of file sbdWin.c.

412{
413 int nBTLimit = 0;
414 int i, Ind;
415 assert( Vec_IntSize(vInds) == nCareMints[0] + nCareMints[1] );
416 Vec_IntForEachEntry( vInds, Ind, i )
417 {
418 int fOffSet = (int)(i < nCareMints[0]);
419 int status, k, iLit = Abc_Var2Lit( PivotVar, fOffSet );
420 sat_solver_random_polarity( pSat );
421 status = sat_solver_solve( pSat, &iLit, &iLit + 1, nBTLimit, 0, 0, 0 );
422 if ( status == l_Undef )
423 return -2;
424 if ( status == l_False )
425 return fOffSet;
426 for ( k = 0; k <= PivotVar; k++ )
427 if ( Abc_TtGetBit(pVarSims[k], Ind) != sat_solver_var_value(pSat, k) )
428 Abc_TtXorBit(pVarSims[k], Ind);
429 }
430 return -1;
431}
#define l_Undef
Definition bmcBmcS.c:34
#define l_False
Definition bmcBmcS.c:36
#define sat_solver_solve
Definition cecSatG2.c:45
#define assert(ex)
Definition util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the caller graph for this function:

◆ Sbd_ManCollectConstantsNew()

int Sbd_ManCollectConstantsNew ( sat_solver * pSat,
Vec_Int_t * vDivVars,
int nConsts,
int PivotVar,
word * pOnset,
word * pOffset )
extern

Definition at line 433 of file sbdWin.c.

434{
435 int nBTLimit = 0;
436 int n, i, k, status, iLit, iVar;
437 word * pPats[2] = {pOnset, pOffset};
438 assert( Vec_IntSize(vDivVars) < 64 );
439 for ( n = 0; n < 2; n++ )
440 for ( i = 0; i < nConsts; i++ )
441 {
442 sat_solver_random_polarity( pSat );
443 iLit = Abc_Var2Lit( PivotVar, n );
444 status = sat_solver_solve( pSat, &iLit, &iLit + 1, nBTLimit, 0, 0, 0 );
445 if ( status == l_Undef )
446 return -2;
447 if ( status == l_False )
448 return n;
449 pPats[n][i] = ((word)!n) << Vec_IntSize(vDivVars);
450 Vec_IntForEachEntry( vDivVars, iVar, k )
451 if ( sat_solver_var_value(pSat, iVar) )
452 Abc_TtXorBit(&pPats[n][i], k);
453 }
454 return -1;
455}
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
Here is the caller graph for this function:

◆ Sbd_ManCutServerFirst()

int Sbd_ManCutServerFirst ( Sbd_Srv_t * p,
int iObj,
int * pLeaves )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 308 of file sbdCut2.c.

309{
310 int RetValue, LevStop = Vec_IntEntry(p->vLutLevs, iObj) - 2;
311
312 Vec_IntClear( p->vCut );
313 Gia_ManIncrementTravId( p->pGia );
314 RetValue = Sbd_ManCutCollect_rec( p->pGia, p->vMirrors, iObj, LevStop, p->vLutLevs, p->vCut );
315 if ( RetValue == 0 ) // cannot build delay-improving cut
316 return -1;
317 // check if the current cut is good
318 Vec_IntSort( p->vCut, 0 );
319/*
320 Sbd_ManCutReload( p->vMirrors, p->vLutLevs, LevStop, p->vCut, p->vCutTop, p->vCutBot );
321 if ( Vec_IntSize(p->vCut) <= p->nCutSize && Vec_IntSize(p->vCutTop) <= p->nLutSize-1 )
322 {
323 //printf( "%d ", Vec_IntSize(p->vCut) );
324 memcpy( pLeaves, Vec_IntArray(p->vCut), sizeof(int) * Vec_IntSize(p->vCut) );
325 return Vec_IntSize(p->vCut);
326 }
327*/
328 // try to expand the cut
329 Sbd_ManCutExpand( p->pGia, p->vMirrors, p->vLutLevs, p->vCut );
330 Sbd_ManCutReload( p->vMirrors, p->vLutLevs, LevStop, p->vCut, p->vCutTop, p->vCutBot );
331 if ( Vec_IntSize(p->vCut) <= p->nCutSize && Vec_IntSize(p->vCutTop) <= p->nLutSize-1 )
332 {
333 //printf( "1=(%d,%d) ", Vec_IntSize(p->vCutTop), Vec_IntSize(p->vCutBot) );
334 //printf( "%d ", Vec_IntSize(p->vCut) );
335 memcpy( pLeaves, Vec_IntArray(p->vCut), sizeof(int) * Vec_IntSize(p->vCut) );
336 return Vec_IntSize(p->vCut);
337 }
338
339 // try to reduce the topmost
340 Vec_IntClear( p->vCut0 );
341 Vec_IntAppend( p->vCut0, p->vCut );
342 if ( Vec_IntSize(p->vCut) < p->nCutSize && Sbd_ManCutReduceTop( p->pGia, p->vMirrors, iObj, p->vLutLevs, p->vCut, p->vCutTop, p->nCutSize ) )
343 {
344 Sbd_ManCutExpand( p->pGia, p->vMirrors, p->vLutLevs, p->vCut );
345 Sbd_ManCutReload( p->vMirrors, p->vLutLevs, LevStop, p->vCut, p->vCutTop, p->vCutBot );
346 assert( Vec_IntSize(p->vCut) <= p->nCutSize );
347 if ( Vec_IntSize(p->vCutTop) <= p->nLutSize-1 )
348 {
349 //printf( "%d -> %d (%d + %d)\n", Vec_IntSize(p->vCut0), Vec_IntSize(p->vCut), Vec_IntSize(p->vCutTop), Vec_IntSize(p->vCutBot) );
350 memcpy( pLeaves, Vec_IntArray(p->vCut), sizeof(int) * Vec_IntSize(p->vCut) );
351 return Vec_IntSize(p->vCut);
352 }
353 // try again
354 if ( Vec_IntSize(p->vCut) < p->nCutSize && Sbd_ManCutReduceTop( p->pGia, p->vMirrors, iObj, p->vLutLevs, p->vCut, p->vCutTop, p->nCutSize ) )
355 {
356 Sbd_ManCutExpand( p->pGia, p->vMirrors, p->vLutLevs, p->vCut );
357 Sbd_ManCutReload( p->vMirrors, p->vLutLevs, LevStop, p->vCut, p->vCutTop, p->vCutBot );
358 assert( Vec_IntSize(p->vCut) <= p->nCutSize );
359 if ( Vec_IntSize(p->vCutTop) <= p->nLutSize-1 )
360 {
361 //printf( "* %d -> %d (%d + %d)\n", Vec_IntSize(p->vCut0), Vec_IntSize(p->vCut), Vec_IntSize(p->vCutTop), Vec_IntSize(p->vCutBot) );
362 memcpy( pLeaves, Vec_IntArray(p->vCut), sizeof(int) * Vec_IntSize(p->vCut) );
363 return Vec_IntSize(p->vCut);
364 }
365 // try again
366 if ( Vec_IntSize(p->vCut) < p->nCutSize && Sbd_ManCutReduceTop( p->pGia, p->vMirrors, iObj, p->vLutLevs, p->vCut, p->vCutTop, p->nCutSize ) )
367 {
368 Sbd_ManCutExpand( p->pGia, p->vMirrors, p->vLutLevs, p->vCut );
369 Sbd_ManCutReload( p->vMirrors, p->vLutLevs, LevStop, p->vCut, p->vCutTop, p->vCutBot );
370 assert( Vec_IntSize(p->vCut) <= p->nCutSize );
371 if ( Vec_IntSize(p->vCutTop) <= p->nLutSize-1 )
372 {
373 //printf( "** %d -> %d (%d + %d)\n", Vec_IntSize(p->vCut0), Vec_IntSize(p->vCut), Vec_IntSize(p->vCutTop), Vec_IntSize(p->vCutBot) );
374 memcpy( pLeaves, Vec_IntArray(p->vCut), sizeof(int) * Vec_IntSize(p->vCut) );
375 return Vec_IntSize(p->vCut);
376 }
377 // try again
378 if ( Vec_IntSize(p->vCut) < p->nCutSize && Sbd_ManCutReduceTop( p->pGia, p->vMirrors, iObj, p->vLutLevs, p->vCut, p->vCutTop, p->nCutSize ) )
379 {
380 Sbd_ManCutExpand( p->pGia, p->vMirrors, p->vLutLevs, p->vCut );
381 Sbd_ManCutReload( p->vMirrors, p->vLutLevs, LevStop, p->vCut, p->vCutTop, p->vCutBot );
382 assert( Vec_IntSize(p->vCut) <= p->nCutSize );
383 if ( Vec_IntSize(p->vCutTop) <= p->nLutSize-1 )
384 {
385 //printf( "*** %d -> %d (%d + %d)\n", Vec_IntSize(p->vCut0), Vec_IntSize(p->vCut), Vec_IntSize(p->vCutTop), Vec_IntSize(p->vCutBot) );
386 memcpy( pLeaves, Vec_IntArray(p->vCut), sizeof(int) * Vec_IntSize(p->vCut) );
387 return Vec_IntSize(p->vCut);
388 }
389 }
390 }
391 }
392 }
393
394 // recompute the cut
395 Vec_IntClear( p->vCut );
396 Gia_ManIncrementTravId( p->pGia );
397 RetValue = Sbd_ManCutCollect_rec( p->pGia, p->vMirrors, iObj, LevStop-1, p->vLutLevs, p->vCut );
398 if ( RetValue == 0 ) // cannot build delay-improving cut
399 return -1;
400 // check if the current cut is good
401 Vec_IntSort( p->vCut, 0 );
402/*
403 Sbd_ManCutReload( p->vMirrors, p->vLutLevs, LevStop, p->vCut, p->vCutTop, p->vCutBot );
404 if ( Vec_IntSize(p->vCut) <= p->nCutSize && Vec_IntSize(p->vCutTop) <= p->nLutSize-1 )
405 {
406 //printf( "%d ", Vec_IntSize(p->vCut) );
407 memcpy( pLeaves, Vec_IntArray(p->vCut), sizeof(int) * Vec_IntSize(p->vCut) );
408 return Vec_IntSize(p->vCut);
409 }
410*/
411 // try to expand the cut
412 Sbd_ManCutExpand( p->pGia, p->vMirrors, p->vLutLevs, p->vCut );
413 Sbd_ManCutReload( p->vMirrors, p->vLutLevs, LevStop, p->vCut, p->vCutTop, p->vCutBot );
414 if ( Vec_IntSize(p->vCut) <= p->nCutSize && Vec_IntSize(p->vCutTop) <= p->nLutSize-1 )
415 {
416 //printf( "2=(%d,%d) ", Vec_IntSize(p->vCutTop), Vec_IntSize(p->vCutBot) );
417 //printf( "%d ", Vec_IntSize(p->vCut) );
418 memcpy( pLeaves, Vec_IntArray(p->vCut), sizeof(int) * Vec_IntSize(p->vCut) );
419 return Vec_IntSize(p->vCut);
420 }
421
422 return -1;
423}
int Sbd_ManCutCollect_rec(Gia_Man_t *p, Vec_Int_t *vMirrors, int iObj, int LevStop, Vec_Int_t *vLutLevs, Vec_Int_t *vCut)
Definition sbdCut2.c:234
void Sbd_ManCutExpand(Gia_Man_t *p, Vec_Int_t *vMirrors, Vec_Int_t *vLutLevs, Vec_Int_t *vCut)
Definition sbdCut2.c:206
int Sbd_ManCutReduceTop(Gia_Man_t *p, Vec_Int_t *vMirrors, int iObj, Vec_Int_t *vLutLevs, Vec_Int_t *vCut, Vec_Int_t *vCutTop, int nCutSize)
Definition sbdCut2.c:266
void Sbd_ManCutReload(Vec_Int_t *vMirrors, Vec_Int_t *vLutLevs, int LevStop, Vec_Int_t *vCut, Vec_Int_t *vCutTop, Vec_Int_t *vCutBot)
Definition sbdCut2.c:217
char * memcpy()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sbd_ManCutServerStart()

Sbd_Srv_t * Sbd_ManCutServerStart ( Gia_Man_t * pGia,
Vec_Int_t * vMirrors,
Vec_Int_t * vLutLevs,
Vec_Int_t * vLevs,
Vec_Int_t * vRefs,
int nLutSize,
int nCutSize,
int nCutNum,
int fVerbose )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 84 of file sbdCut2.c.

87{
88 Sbd_Srv_t * p;
89 assert( nLutSize <= nCutSize );
90 assert( nCutSize < SBD_CUT_NO_LEAF );
91 assert( nCutSize > 1 && nCutSize <= SBD_MAX_CUTSIZE );
92 assert( nCutNum > 1 && nCutNum < SBD_MAX_CUTNUM );
93 p = ABC_CALLOC( Sbd_Srv_t, 1 );
94 p->clkStart = Abc_Clock();
95 p->nLutSize = nLutSize;
96 p->nCutSize = nCutSize;
97 p->nCutNum = nCutNum;
98 p->fVerbose = fVerbose;
99 p->pGia = pGia;
100 p->vMirrors = vMirrors;
101 p->vLutLevs = vLutLevs;
102 p->vLevs = vLevs;
103 p->vRefs = vRefs;
104 p->vCut0 = Vec_IntAlloc( 100 );
105 p->vCut = Vec_IntAlloc( 100 );
106 p->vCutTop = Vec_IntAlloc( 100 );
107 p->vCutBot = Vec_IntAlloc( 100 );
108 return p;
109}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define SBD_MAX_CUTSIZE
DECLARATIONS ///.
Definition sbdCut.c:30
#define SBD_CUT_NO_LEAF
Definition sbdCut.c:34
#define SBD_MAX_CUTNUM
Definition sbdCut.c:31
struct Sbd_Srv_t_ Sbd_Srv_t
Definition sbdInt.h:65
Here is the caller graph for this function:

◆ Sbd_ManCutServerStop()

void Sbd_ManCutServerStop ( Sbd_Srv_t * p)
extern

Definition at line 110 of file sbdCut2.c.

111{
112 Vec_IntFree( p->vCut0 );
113 Vec_IntFree( p->vCut );
114 Vec_IntFree( p->vCutTop );
115 Vec_IntFree( p->vCutBot );
116 ABC_FREE( p );
117}
Here is the caller graph for this function:

◆ Sbd_ManSatSolver()

sat_solver * Sbd_ManSatSolver ( sat_solver * pSat,
Gia_Man_t * p,
Vec_Int_t * vMirrors,
int Pivot,
Vec_Int_t * vWinObjs,
Vec_Int_t * vObj2Var,
Vec_Int_t * vTfo,
Vec_Int_t * vRoots,
int fQbf )
extern

DECLARATIONS ///.

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

FileName [sbd.c]

SystemName [ABC: Logic synthesis and verification system.]

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

Synopsis []

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Constructs SAT solver for the window.]

Description [The window for the pivot node (Pivot) is represented as a DFS ordered array of objects (vWinObjs) whose indexed in the array (which will be used as SAT variables) are given in array vObj2Var. The TFO nodes are listed as the last ones in vWinObjs. The root nodes are labeled with Abc_LitIsCompl() in vTfo and also given in vRoots. If fQbf is 1, returns the instance meant for QBF solving. It is using the last variable (LastVar) as the placeholder for the second copy of the pivot node.]

SideEffects []

SeeAlso []

Definition at line 52 of file sbdWin.c.

55{
56 Gia_Obj_t * pObj;
57 int i, iLit = 1, iObj, Fan0, Fan1, Lit0m, Lit1m, Node, fCompl0, fCompl1, RetValue;
58 int TfoStart = Vec_IntSize(vWinObjs) - Vec_IntSize(vTfo);
59 int PivotVar = Vec_IntEntry(vObj2Var, Pivot);
60 int LastVar = Vec_IntSize(vWinObjs) + Vec_IntSize(vTfo) + Vec_IntSize(vRoots);
61 //Vec_IntPrint( vWinObjs );
62 //Vec_IntPrint( vTfo );
63 //Vec_IntPrint( vRoots );
64 // create SAT solver
65 if ( pSat == NULL )
66 pSat = sat_solver_new();
67 else
68 sat_solver_restart( pSat );
69 sat_solver_setnvars( pSat, Vec_IntSize(vWinObjs) + Vec_IntSize(vTfo) + Vec_IntSize(vRoots) + SBD_FVAR_MAX );
70 // create constant 0 clause
71 sat_solver_addclause( pSat, &iLit, &iLit + 1 );
72 // add clauses for all nodes
73 Vec_IntForEachEntryStart( vWinObjs, iObj, i, 1 )
74 {
75 pObj = Gia_ManObj( p, iObj );
76 if ( Gia_ObjIsCi(pObj) )
77 continue;
78 assert( Gia_ObjIsAnd(pObj) );
79 assert( Vec_IntEntry( vMirrors, iObj ) < 0 );
80 Node = Vec_IntEntry( vObj2Var, iObj );
81 Lit0m = Vec_IntEntry( vMirrors, Gia_ObjFaninId0(pObj, iObj) );
82 Lit1m = Vec_IntEntry( vMirrors, Gia_ObjFaninId1(pObj, iObj) );
83 Fan0 = Lit0m >= 0 ? Abc_Lit2Var(Lit0m) : Gia_ObjFaninId0(pObj, iObj);
84 Fan1 = Lit1m >= 0 ? Abc_Lit2Var(Lit1m) : Gia_ObjFaninId1(pObj, iObj);
85 Fan0 = Vec_IntEntry( vObj2Var, Fan0 );
86 Fan1 = Vec_IntEntry( vObj2Var, Fan1 );
87 fCompl0 = Gia_ObjFaninC0(pObj) ^ (Lit0m >= 0 && Abc_LitIsCompl(Lit0m));
88 fCompl1 = Gia_ObjFaninC1(pObj) ^ (Lit1m >= 0 && Abc_LitIsCompl(Lit1m));
89 if ( Gia_ObjIsXor(pObj) )
90 sat_solver_add_xor( pSat, Node, Fan0, Fan1, fCompl0 ^ fCompl1 );
91 else
92 sat_solver_add_and( pSat, Node, Fan0, Fan1, fCompl0, fCompl1, 0 );
93 }
94 // add second clauses for the TFO
95 Vec_IntForEachEntryStart( vWinObjs, iObj, i, TfoStart )
96 {
97 pObj = Gia_ManObj( p, iObj );
98 assert( Gia_ObjIsAnd(pObj) );
99 assert( Vec_IntEntry( vMirrors, iObj ) < 0 );
100 Node = Vec_IntEntry( vObj2Var, iObj ) + Vec_IntSize(vTfo);
101 Lit0m = Vec_IntEntry( vMirrors, Gia_ObjFaninId0(pObj, iObj) );
102 Lit1m = Vec_IntEntry( vMirrors, Gia_ObjFaninId1(pObj, iObj) );
103 Fan0 = Lit0m >= 0 ? Abc_Lit2Var(Lit0m) : Gia_ObjFaninId0(pObj, iObj);
104 Fan1 = Lit1m >= 0 ? Abc_Lit2Var(Lit1m) : Gia_ObjFaninId1(pObj, iObj);
105 Fan0 = Vec_IntEntry( vObj2Var, Fan0 );
106 Fan1 = Vec_IntEntry( vObj2Var, Fan1 );
107 Fan0 = Fan0 < TfoStart ? Fan0 : Fan0 + Vec_IntSize(vTfo);
108 Fan1 = Fan1 < TfoStart ? Fan1 : Fan1 + Vec_IntSize(vTfo);
109 if ( fQbf )
110 {
111 Fan0 = Fan0 == PivotVar ? LastVar : Fan0;
112 Fan1 = Fan1 == PivotVar ? LastVar : Fan1;
113 }
114 fCompl0 = Gia_ObjFaninC0(pObj) ^ (!fQbf && Fan0 == PivotVar) ^ (Lit0m >= 0 && Abc_LitIsCompl(Lit0m));
115 fCompl1 = Gia_ObjFaninC1(pObj) ^ (!fQbf && Fan1 == PivotVar) ^ (Lit1m >= 0 && Abc_LitIsCompl(Lit1m));
116 if ( Gia_ObjIsXor(pObj) )
117 sat_solver_add_xor( pSat, Node, Fan0, Fan1, fCompl0 ^ fCompl1 );
118 else
119 sat_solver_add_and( pSat, Node, Fan0, Fan1, fCompl0, fCompl1, 0 );
120 }
121 if ( Vec_IntSize(vRoots) > 0 )
122 {
123 // create XOR clauses for the roots
124 int nVars = Vec_IntSize(vWinObjs) + Vec_IntSize(vTfo);
125 Vec_Int_t * vFaninVars = Vec_IntAlloc( Vec_IntSize(vRoots) );
126 Vec_IntForEachEntry( vRoots, iObj, i )
127 {
128 assert( Vec_IntEntry( vMirrors, iObj ) < 0 );
129 Node = Vec_IntEntry( vObj2Var, iObj );
130 Vec_IntPush( vFaninVars, Abc_Var2Lit(nVars, 0) );
131 sat_solver_add_xor( pSat, Node, Node + Vec_IntSize(vTfo), nVars++, 0 );
132 }
133 // make OR clause for the last nRoots variables
134 RetValue = sat_solver_addclause( pSat, Vec_IntArray(vFaninVars), Vec_IntLimit(vFaninVars) );
135 Vec_IntFree( vFaninVars );
136 if ( RetValue == 0 )
137 {
138 sat_solver_delete( pSat );
139 return NULL;
140 }
141 assert( sat_solver_nvars(pSat) == nVars + SBD_FVAR_MAX );
142 }
143 else if ( fQbf )
144 {
145 int n, pLits[2];
146 for ( n = 0; n < 2; n++ )
147 {
148 pLits[0] = Abc_Var2Lit( PivotVar, n );
149 pLits[1] = Abc_Var2Lit( LastVar, n );
150 RetValue = sat_solver_addclause( pSat, pLits, pLits + 2 );
151 assert( RetValue );
152 }
153 }
154 // finalize
155 RetValue = sat_solver_simplify( pSat );
156 if ( RetValue == 0 )
157 {
158 sat_solver_delete( pSat );
159 return NULL;
160 }
161 return pSat;
162}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
#define sat_solver_addclause
Definition cecSatG2.c:37
#define sat_solver_add_and
Definition cecSatG2.c:38
#define sat_solver_add_xor
Definition cecSatG2.c:39
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
sat_solver * sat_solver_new(void)
Definition satSolver.c:1137
int sat_solver_simplify(sat_solver *s)
Definition satSolver.c:1515
void sat_solver_restart(sat_solver *s)
Definition satSolver.c:1389
void sat_solver_setnvars(sat_solver *s, int n)
Definition satSolver.c:1272
int sat_solver_nvars(sat_solver *s)
Definition satSolver.c:2369
void sat_solver_delete(sat_solver *s)
Definition satSolver.c:1341
#define SBD_FVAR_MAX
Definition sbdInt.h:58
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition vecInt.h:56
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sbd_ManSolve()

word Sbd_ManSolve ( sat_solver * pSat,
int PivotVar,
int FreeVar,
Vec_Int_t * vDivSet,
Vec_Int_t * vDivVars,
Vec_Int_t * vDivValues,
Vec_Int_t * vTemp )
extern

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

Synopsis [Solves one SAT problem.]

Description [Computes node function for PivotVar with fanins in vDivSet using don't-care represented in the SAT solver. Uses array vValues to return the values of the first Vec_IntSize(vValues) SAT variables in case the implementation of the node with the given fanins does not exist.]

SideEffects []

SeeAlso []

Definition at line 178 of file sbdWin.c.

179{
180 int nBTLimit = 0;
181 word uCube, uTruth = 0;
182 int status, i, iVar, nFinal, * pFinal, pLits[2], nIter = 0;
183 assert( FreeVar < sat_solver_nvars(pSat) );
184 assert( Vec_IntSize(vDivVars) == Vec_IntSize(vDivValues) );
185 pLits[0] = Abc_Var2Lit( PivotVar, 0 ); // F = 1
186 pLits[1] = Abc_Var2Lit( FreeVar, 0 ); // iNewLit
187 while ( 1 )
188 {
189 // find onset minterm
190 status = sat_solver_solve( pSat, pLits, pLits + 2, nBTLimit, 0, 0, 0 );
191 if ( status == l_Undef )
192 return SBD_SAT_UNDEC;
193 if ( status == l_False )
194 return uTruth;
195 assert( status == l_True );
196 // remember variable values
197 Vec_IntForEachEntry( vDivVars, iVar, i )
198 Vec_IntWriteEntry( vDivValues, i, 2*sat_solver_var_value(pSat, iVar) );
199 // collect divisor literals
200 Vec_IntClear( vTemp );
201 Vec_IntPush( vTemp, Abc_LitNot(pLits[0]) ); // F = 0
202 Vec_IntForEachEntry( vDivSet, iVar, i )
203 Vec_IntPush( vTemp, sat_solver_var_literal(pSat, iVar) );
204 // check against offset
205 status = sat_solver_solve( pSat, Vec_IntArray(vTemp), Vec_IntArray(vTemp) + Vec_IntSize(vTemp), nBTLimit, 0, 0, 0 );
206 if ( status == l_Undef )
207 return SBD_SAT_UNDEC;
208 if ( status == l_True )
209 break;
210 assert( status == l_False );
211 // compute cube and add clause
212 nFinal = sat_solver_final( pSat, &pFinal );
213 uCube = ~(word)0;
214 Vec_IntClear( vTemp );
215 Vec_IntPush( vTemp, Abc_LitNot(pLits[1]) ); // NOT(iNewLit)
216 for ( i = 0; i < nFinal; i++ )
217 {
218 if ( pFinal[i] == pLits[0] )
219 continue;
220 Vec_IntPush( vTemp, pFinal[i] );
221 iVar = Vec_IntFind( vDivSet, Abc_Lit2Var(pFinal[i]) ); assert( iVar >= 0 );
222 uCube &= Abc_LitIsCompl(pFinal[i]) ? s_Truths6[iVar] : ~s_Truths6[iVar];
223 }
224 uTruth |= uCube;
225 status = sat_solver_addclause( pSat, Vec_IntArray(vTemp), Vec_IntArray(vTemp) + Vec_IntSize(vTemp) );
226 assert( status );
227 nIter++;
228 }
229 assert( status == l_True );
230 // store the counter-example
231 Vec_IntForEachEntry( vDivVars, iVar, i )
232 Vec_IntAddToEntry( vDivValues, i, sat_solver_var_value(pSat, iVar) );
233
234 for ( i = 0; i < Vec_IntSize(vDivValues); i++ )
235 Vec_IntAddToEntry( vDivValues, i, 0xC );
236/*
237 // reduce the counter example
238 for ( n = 0; n < 2; n++ )
239 {
240 Vec_IntClear( vTemp );
241 Vec_IntPush( vTemp, Abc_Var2Lit(PivotVar, n) ); // n = 0 => F = 1 (expanding offset against onset)
242 for ( i = 0; i < Vec_IntSize(vValues); i++ )
243 Vec_IntPush( vTemp, Abc_Var2Lit(i, !((Vec_IntEntry(vValues, i) >> n) & 1)) );
244 status = sat_solver_solve( pSat, Vec_IntArray(vTemp), Vec_IntArray(vTemp) + Vec_IntSize(vTemp), nBTLimit, 0, 0, 0 );
245 assert( status == l_False );
246 // compute cube and add clause
247 nFinal = sat_solver_final( pSat, &pFinal );
248 for ( i = 0; i < nFinal; i++ )
249 if ( Abc_Lit2Var(pFinal[i]) != PivotVar )
250 Vec_IntAddToEntry( vValues, Abc_Lit2Var(pFinal[i]), 1 << (n+2) );
251 }
252*/
253 return SBD_SAT_SAT;
254}
#define l_True
Definition bmcBmcS.c:35
#define SBD_SAT_SAT
Definition sbdInt.h:53
#define SBD_SAT_UNDEC
INCLUDES ///.
Definition sbdInt.h:52
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sbd_ProblemSolve()

int Sbd_ProblemSolve ( Gia_Man_t * p,
Vec_Int_t * vMirrors,
int Pivot,
Vec_Int_t * vWinObjs,
Vec_Int_t * vObj2Var,
Vec_Int_t * vTfo,
Vec_Int_t * vRoots,
Vec_Int_t * vDivSet,
int nStrs,
Sbd_Str_t * pStr0 )
extern

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

Synopsis [Solves QBF problem for the given window.]

Description []

SideEffects []

SeeAlso []

Definition at line 187 of file sbdLut.c.

191{
192 extern sat_solver * Sbd_ManSatSolver( sat_solver * pSat, Gia_Man_t * p, Vec_Int_t * vMirrors, int Pivot, Vec_Int_t * vWinObjs, Vec_Int_t * vObj2Var, Vec_Int_t * vTfo, Vec_Int_t * vRoots, int fQbf );
193
194 int fVerbose = 0;
195 abctime clk = Abc_Clock();
196 Vec_Int_t * vLits = Vec_IntAlloc( 100 );
197 sat_solver * pSatCec = Sbd_ManSatSolver( NULL, p, vMirrors, Pivot, vWinObjs, vObj2Var, vTfo, vRoots, 1 );
198 sat_solver * pSatQbf = sat_solver_new();
199
200 int nVars = Vec_IntSize( vDivSet );
201 int nPars = Sbd_ProblemCountParams( nStrs, pStr0 );
202
203 int VarCecOut = Vec_IntSize(vWinObjs) + Vec_IntSize(vTfo) + Vec_IntSize(vRoots);
204 int VarCecPar = VarCecOut + nStrs;
205
206 int VarQbfPar = 0;
207 int VarQbfFree = nPars;
208
209 int pVarsCec[256];
210 int pVarsQbf[256];
211 int i, iVar, iLit, nIters;
212 int RetValue = 0;
213
214 assert( Vec_IntSize(vDivSet) <= SBD_DIV_MAX );
215 assert( nVars + nStrs + nPars <= 256 );
216
217 // collect CEC variables
218 Vec_IntForEachEntry( vDivSet, iVar, i )
219 pVarsCec[i] = iVar;
220 for ( i = 0; i < nStrs; i++ )
221 pVarsCec[nVars + i] = VarCecOut + i;
222 for ( i = 0; i < nPars; i++ )
223 pVarsCec[nVars + nStrs + i] = VarCecPar + i;
224
225 // collect QBF variables
226 for ( i = 0; i < nVars + nStrs; i++ )
227 pVarsQbf[i] = -1;
228 for ( i = 0; i < nPars; i++ )
229 pVarsQbf[nVars + nStrs + i] = VarQbfPar + i;
230
231 // add clauses to the CEC problem
232 Sbd_ProblemAddClauses( pSatCec, nVars, nStrs, pVarsCec, pStr0 );
233
234 // create QBF solver
235 sat_solver_setnvars( pSatQbf, 1000 );
236 Sbd_ProblemAddClausesInit( pSatQbf, nVars, nStrs, pVarsQbf, pStr0 );
237
238 // assume all parameter variables are 0
239 Vec_IntClear( vLits );
240 for ( i = 0; i < nPars; i++ )
241 Vec_IntPush( vLits, Abc_Var2Lit(VarCecPar + i, 1) );
242 for ( nIters = 0; nIters < (1 << nVars); nIters++ )
243 {
244 // check if these parameters solve the problem
245 int status = sat_solver_solve( pSatCec, Vec_IntArray(vLits), Vec_IntLimit(vLits), 0, 0, 0, 0 );
246 if ( status == l_False ) // solution found
247 break;
248 assert( status == l_True );
249
250 if ( fVerbose )
251 {
252 printf( "Iter %3d : ", nIters );
253 for ( i = 0; i < nPars; i++ )
254 printf( "%d", !Abc_LitIsCompl(Vec_IntEntry(vLits, i)) );
255 printf( " " );
256 }
257
258 Vec_IntClear( vLits );
259 // create new QBF variables
260 for ( i = 0; i < nVars + nStrs; i++ )
261 pVarsQbf[i] = VarQbfFree++;
262 // set their values
263 Vec_IntForEachEntry( vDivSet, iVar, i )
264 {
265 iLit = Abc_Var2Lit( pVarsQbf[i], !sat_solver_var_value(pSatCec, iVar) );
266 status = sat_solver_addclause( pSatQbf, &iLit, &iLit + 1 );
267 assert( status );
268 if ( fVerbose )
269 printf( "%d", sat_solver_var_value(pSatCec, iVar) );
270 }
271 iLit = Abc_Var2Lit( pVarsQbf[nVars], sat_solver_var_value(pSatCec, VarCecOut) );
272 status = sat_solver_addclause( pSatQbf, &iLit, &iLit + 1 );
273 assert( status );
274 if ( fVerbose )
275 printf( " %d\n", !sat_solver_var_value(pSatCec, VarCecOut) );
276 // add clauses to the QBF problem
277 if ( !Sbd_ProblemAddClauses( pSatQbf, nVars, nStrs, pVarsQbf, pStr0 ) )
278 break; // solution does not exist
279 // check if solution still exists
280 status = sat_solver_solve( pSatQbf, NULL, NULL, 0, 0, 0, 0 );
281 if ( status == l_False ) // solution does not exist
282 break;
283 assert( status == l_True );
284 // find the new values of parameters
285 assert( Vec_IntSize(vLits) == 0 );
286 for ( i = 0; i < nPars; i++ )
287 Vec_IntPush( vLits, Abc_Var2Lit(VarCecPar + i, !sat_solver_var_value(pSatQbf, VarQbfPar + i)) );
288 }
289 if ( Vec_IntSize(vLits) > 0 )
290 {
291 //Sbd_ProblemPrintSolution( nStrs, pStr0, vLits );
292 Sbd_ProblemCollectSolution( nStrs, pStr0, vLits );
293 RetValue = 1;
294 }
295 sat_solver_delete( pSatCec );
296 sat_solver_delete( pSatQbf );
297 Vec_IntFree( vLits );
298
299 if ( fVerbose )
300 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
301 return RetValue;
302}
ABC_INT64_T abctime
Definition abc_global.h:332
#define sat_solver
Definition cecSatG2.c:34
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
sat_solver * Sbd_ManSatSolver(sat_solver *pSat, Gia_Man_t *p, Vec_Int_t *vMirrors, int Pivot, Vec_Int_t *vWinObjs, Vec_Int_t *vObj2Var, Vec_Int_t *vTfo, Vec_Int_t *vRoots, int fQbf)
DECLARATIONS ///.
Definition sbdWin.c:52
#define SBD_DIV_MAX
Definition sbdInt.h:57
void Sbd_ProblemCollectSolution(int nStrs, Sbd_Str_t *pStr0, Vec_Int_t *vLits)
Definition sbdLut.c:146
ABC_NAMESPACE_IMPL_START int Sbd_ProblemCountParams(int nStrs, Sbd_Str_t *pStr0)
DECLARATIONS ///.
Definition sbdLut.c:46
void Sbd_ProblemAddClausesInit(sat_solver *pSat, int nVars, int nStrs, int *pVars, Sbd_Str_t *pStr0)
Definition sbdLut.c:101
int Sbd_ProblemAddClauses(sat_solver *pSat, int nVars, int nStrs, int *pVars, Sbd_Str_t *pStr0)
Definition sbdLut.c:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sbd_StoAlloc()

Sbd_Sto_t * Sbd_StoAlloc ( Gia_Man_t * pGia,
Vec_Int_t * vMirrors,
int nLutSize,
int nCutSize,
int nCutNum,
int fCutMin,
int fVerbose )
extern

MACRO DEFINITIONS ///.

FUNCTION DECLARATIONS ///

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

Synopsis [Incremental cut computation.]

Description []

SideEffects []

SeeAlso []

Definition at line 667 of file sbdCut.c.

668{
669 Sbd_Sto_t * p;
670 assert( nLutSize <= nCutSize );
671 assert( nCutSize < SBD_CUT_NO_LEAF );
672 assert( nCutSize > 1 && nCutSize <= SBD_MAX_CUTSIZE );
673 assert( nCutNum > 1 && nCutNum < SBD_MAX_CUTNUM );
674 p = ABC_CALLOC( Sbd_Sto_t, 1 );
675 p->clkStart = Abc_Clock();
676 p->nLutSize = nLutSize;
677 p->nCutSize = nCutSize;
678 p->nCutNum = nCutNum;
679 p->fCutMin = fCutMin;
680 p->fVerbose = fVerbose;
681 p->pGia = pGia;
682 p->vMirrors = vMirrors;
683 p->vDelays = Vec_IntStart( Gia_ManObjNum(pGia) );
684 p->vLevels = Vec_IntStart( Gia_ManObjNum(pGia) );
685 p->vRefs = Vec_IntAlloc( Gia_ManObjNum(pGia) );
686 p->vCuts = Vec_WecStart( Gia_ManObjNum(pGia) );
687 p->vTtMem = fCutMin ? Vec_MemAllocForTT( nCutSize, 0 ) : NULL;
688 return p;
689}
struct Sbd_Sto_t_ Sbd_Sto_t
BASIC TYPES ///.
Definition sbdInt.h:64
Here is the caller graph for this function:

◆ Sbd_StoComputeCutsCi()

void Sbd_StoComputeCutsCi ( Sbd_Sto_t * p,
int iObj,
int Delay,
int Level )
extern

Definition at line 724 of file sbdCut.c.

725{
726 Sbd_StoComputeCutsObj( p, iObj, Delay, Level );
727 Sbd_CutAddUnit( p, iObj );
728}
void Sbd_StoComputeCutsObj(Sbd_Sto_t *p, int iObj, int Delay, int Level)
Definition sbdCut.c:702
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sbd_StoComputeCutsConst0()

void Sbd_StoComputeCutsConst0 ( Sbd_Sto_t * p,
int iObj )
extern

Definition at line 719 of file sbdCut.c.

720{
721 Sbd_StoComputeCutsObj( p, iObj, 0, 0 );
722 Sbd_CutAddZero( p, iObj );
723}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sbd_StoComputeCutsNode()

int Sbd_StoComputeCutsNode ( Sbd_Sto_t * p,
int iObj )
extern

Definition at line 729 of file sbdCut.c.

730{
731 Gia_Obj_t * pObj = Gia_ManObj(p->pGia, iObj);
732 int Lev0 = Vec_IntEntry( p->vLevels, Gia_ObjFaninId0(pObj, iObj) );
733 int Lev1 = Vec_IntEntry( p->vLevels, Gia_ObjFaninId1(pObj, iObj) );
734 Sbd_StoComputeCutsObj( p, iObj, -1, 1 + Abc_MaxInt(Lev0, Lev1) );
735 Sbd_StoMergeCuts( p, iObj );
736 return Vec_IntEntry( p->vDelays, iObj );
737}
void Sbd_StoMergeCuts(Sbd_Sto_t *p, int iObj)
Definition sbdCut.c:594
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sbd_StoComputeCutsObj()

void Sbd_StoComputeCutsObj ( Sbd_Sto_t * p,
int iObj,
int Delay,
int Level )
extern

Definition at line 702 of file sbdCut.c.

703{
704 if ( iObj < Vec_IntSize(p->vDelays) )
705 {
706 Vec_IntWriteEntry( p->vDelays, iObj, Delay );
707 Vec_IntWriteEntry( p->vLevels, iObj, Level );
708 }
709 else
710 {
711 assert( iObj == Vec_IntSize(p->vDelays) );
712 assert( iObj == Vec_IntSize(p->vLevels) );
713 assert( iObj == Vec_WecSize(p->vCuts) );
714 Vec_IntPush( p->vDelays, Delay );
715 Vec_IntPush( p->vLevels, Level );
716 Vec_WecPushLevel( p->vCuts );
717 }
718}
Here is the caller graph for this function:

◆ Sbd_StoDerefObj()

void Sbd_StoDerefObj ( Sbd_Sto_t * p,
int iObj )
extern

Definition at line 778 of file sbdCut.c.

779{
780 Gia_Obj_t * pObj;
781 int Lit0m, Lit1m, Fan0, Fan1;
782 return;
783
784 pObj = Gia_ManObj(p->pGia, iObj);
785 if ( Vec_IntEntry(p->vRefs, iObj) == 0 )
786 printf( "Ref count mismatch at node %d\n", iObj );
787 assert( Vec_IntEntry(p->vRefs, iObj) > 0 );
788 Vec_IntAddToEntry( p->vRefs, iObj, -1 );
789 if ( Vec_IntEntry( p->vRefs, iObj ) > 0 )
790 return;
791 if ( Gia_ObjIsCi(pObj) )
792 return;
793//printf( "Deref %d\n", iObj );
794 assert( Gia_ObjIsAnd(pObj) );
795 Lit0m = Vec_IntEntry( p->vMirrors, Gia_ObjFaninId0(pObj, iObj) );
796 Lit1m = Vec_IntEntry( p->vMirrors, Gia_ObjFaninId1(pObj, iObj) );
797 Fan0 = Lit0m >= 0 ? Abc_Lit2Var(Lit0m) : Gia_ObjFaninId0(pObj, iObj);
798 Fan1 = Lit1m >= 0 ? Abc_Lit2Var(Lit1m) : Gia_ObjFaninId1(pObj, iObj);
799 if ( Fan0 ) Sbd_StoDerefObj( p, Fan0 );
800 if ( Fan1 ) Sbd_StoDerefObj( p, Fan1 );
801}
void Sbd_StoDerefObj(Sbd_Sto_t *p, int iObj)
Definition sbdCut.c:778
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sbd_StoFree()

void Sbd_StoFree ( Sbd_Sto_t * p)
extern

Definition at line 690 of file sbdCut.c.

691{
692 Vec_IntFree( p->vDelays );
693 Vec_IntFree( p->vLevels );
694 Vec_IntFree( p->vRefs );
695 Vec_WecFree( p->vCuts );
696 if ( p->fCutMin )
697 Vec_MemHashFree( p->vTtMem );
698 if ( p->fCutMin )
699 Vec_MemFree( p->vTtMem );
700 ABC_FREE( p );
701}
Here is the caller graph for this function:

◆ Sbd_StoObjBestCut()

int Sbd_StoObjBestCut ( Sbd_Sto_t * p,
int iObj,
int nSize,
int * pLeaves )
extern

Definition at line 802 of file sbdCut.c.

803{
804 int fVerbose = 0;
805 Sbd_Cut_t * pCutBest = NULL; int i;
806 assert( p->Pivot == iObj );
807 if ( fVerbose && iObj % 1000 == 0 )
808 printf( "Node %6d : \n", iObj );
809 for ( i = 0; i < p->nCutsR; i++ )
810 {
811 if ( fVerbose && iObj % 1000 == 0 )
812 Sbd_CutPrint( p, iObj, p->ppCuts[i] );
813 if ( nSize && (int)p->ppCuts[i]->nLeaves != nSize )
814 continue;
815 if ( (int)p->ppCuts[i]->nLeaves > p->nLutSize &&
816 (int)p->ppCuts[i]->nSlowLeaves <= 1 &&
817 (int)p->ppCuts[i]->nTopLeaves <= p->nLutSize-1 &&
818 (pCutBest == NULL || Sbd_CutCompare2(pCutBest, p->ppCuts[i]) == 1) )
819 pCutBest = p->ppCuts[i];
820 }
821 if ( fVerbose && iObj % 1000 == 0 )
822 {
823 printf( "Best cut of size %d:\n", nSize );
824 Sbd_CutPrint( p, iObj, pCutBest );
825 }
826 if ( pCutBest == NULL )
827 return -1;
828 assert( pCutBest->nLeaves <= SBD_DIV_MAX );
829 for ( i = 0; i < (int)pCutBest->nLeaves; i++ )
830 pLeaves[i] = pCutBest->pLeaves[i];
831 return pCutBest->nLeaves;
832}
struct Sbd_Cut_t_ Sbd_Cut_t
Definition sbdCut.c:36
int pLeaves[SBD_MAX_CUTSIZE]
Definition sbdCut.c:47
unsigned nLeaves
Definition sbdCut.c:46
Here is the caller graph for this function:

◆ Sbd_StoObjRefs()

int Sbd_StoObjRefs ( Sbd_Sto_t * p,
int iObj )
extern

Definition at line 746 of file sbdCut.c.

747{
748 return Vec_IntEntry(p->vRefs, iObj);
749}

◆ Sbd_StoRefObj()

void Sbd_StoRefObj ( Sbd_Sto_t * p,
int iObj,
int iMirror )
extern

Definition at line 750 of file sbdCut.c.

751{
752 Gia_Obj_t * pObj = Gia_ManObj(p->pGia, iObj);
753 assert( iObj == Vec_IntSize(p->vRefs) );
754 assert( iMirror < iObj );
755 Vec_IntPush( p->vRefs, 0 );
756//printf( "Ref %d\n", iObj );
757 if ( iMirror > 0 )
758 {
759 Vec_IntWriteEntry( p->vRefs, iObj, Vec_IntEntry(p->vRefs, iMirror) );
760 Vec_IntWriteEntry( p->vRefs, iMirror, 1 );
761 }
762 if ( Gia_ObjIsAnd(pObj) )
763 {
764 int Lit0m = Vec_IntEntry( p->vMirrors, Gia_ObjFaninId0(pObj, iObj) );
765 int Lit1m = Vec_IntEntry( p->vMirrors, Gia_ObjFaninId1(pObj, iObj) );
766 int Fan0 = Lit0m >= 0 ? Abc_Lit2Var(Lit0m) : Gia_ObjFaninId0(pObj, iObj);
767 int Fan1 = Lit1m >= 0 ? Abc_Lit2Var(Lit1m) : Gia_ObjFaninId1(pObj, iObj);
768 Vec_IntAddToEntry( p->vRefs, Fan0, 1 );
769 Vec_IntAddToEntry( p->vRefs, Fan1, 1 );
770 }
771 else if ( Gia_ObjIsCo(pObj) )
772 {
773 int Lit0m = Vec_IntEntry( p->vMirrors, Gia_ObjFaninId0(pObj, iObj) );
774 assert( Lit0m == -1 );
775 Vec_IntAddToEntry( p->vRefs, Gia_ObjFaninId0(pObj, iObj), 1 );
776 }
777}
Here is the caller graph for this function:

◆ Sbd_StoSaveBestDelayCut()

void Sbd_StoSaveBestDelayCut ( Sbd_Sto_t * p,
int iObj,
int * pCut )
extern

Definition at line 738 of file sbdCut.c.

739{
740 Sbd_Cut_t * pCutBest = p->ppCuts[p->iCutBest]; int i;
741 assert( iObj == p->Pivot );
742 pCut[0] = pCutBest->nLeaves;
743 for ( i = 0; i < (int)pCutBest->nLeaves; i++ )
744 pCut[i+1] = pCutBest->pLeaves[i];
745}
Here is the caller graph for this function: