ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
sbdCnf.c File Reference
#include "sbdInt.h"
Include dependency graph for sbdCnf.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Sbd_PrintCnf (Vec_Str_t *vCnf)
 DECLARATIONS ///.
 
int Sbd_TruthToCnf (word Truth, int nVars, Vec_Int_t *vCover, Vec_Str_t *vCnf)
 
void Sbd_TranslateCnf (Vec_Wec_t *vRes, Vec_Str_t *vCnf, Vec_Int_t *vFaninMap, int iPivotVar)
 

Function Documentation

◆ Sbd_PrintCnf()

ABC_NAMESPACE_IMPL_START void Sbd_PrintCnf ( Vec_Str_t * vCnf)

DECLARATIONS ///.

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

FileName [sbdCnf.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
sbdCnf.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file sbdCnf.c.

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

◆ Sbd_TranslateCnf()

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

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 121 of file sbdCnf.c.

122{
123 Vec_Int_t * vClause;
124 signed char Entry;
125 int i, Lit;
126 Vec_WecClear( vRes );
127 vClause = Vec_WecPushLevel( vRes );
128 Vec_StrForEachEntry( vCnf, Entry, i )
129 {
130 if ( (int)Entry == -1 )
131 {
132 vClause = Vec_WecPushLevel( vRes );
133 continue;
134 }
135 Lit = Abc_Lit2LitV( Vec_IntArray(vFaninMap), (int)Entry );
136 Lit = Abc_LitNotCond( Lit, Abc_Lit2Var(Lit) == iPivotVar );
137 Vec_IntPush( vClause, Lit );
138 }
139}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37

◆ Sbd_TruthToCnf()

int Sbd_TruthToCnf ( word Truth,
int nVars,
Vec_Int_t * vCover,
Vec_Str_t * vCnf )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 70 of file sbdCnf.c.

71{
72 Vec_StrClear( vCnf );
73 if ( Truth == 0 || ~Truth == 0 )
74 {
75// assert( nVars == 0 );
76 Vec_StrPush( vCnf, (char)(Truth == 0) );
77 Vec_StrPush( vCnf, (char)-1 );
78 return 1;
79 }
80 else
81 {
82 int i, k, c, RetValue, Literal, Cube, nCubes = 0;
83 assert( nVars > 0 );
84 for ( c = 0; c < 2; c ++ )
85 {
86 Truth = c ? ~Truth : Truth;
87 RetValue = Kit_TruthIsop( (unsigned *)&Truth, nVars, vCover, 0 );
88 assert( RetValue == 0 );
89 nCubes += Vec_IntSize( vCover );
90 Vec_IntForEachEntry( vCover, Cube, i )
91 {
92 for ( k = 0; k < nVars; k++ )
93 {
94 Literal = 3 & (Cube >> (k << 1));
95 if ( Literal == 1 ) // '0' -> pos lit
96 Vec_StrPush( vCnf, (char)Abc_Var2Lit(k, 0) );
97 else if ( Literal == 2 ) // '1' -> neg lit
98 Vec_StrPush( vCnf, (char)Abc_Var2Lit(k, 1) );
99 else if ( Literal != 0 )
100 assert( 0 );
101 }
102 Vec_StrPush( vCnf, (char)Abc_Var2Lit(nVars, c) );
103 Vec_StrPush( vCnf, (char)-1 );
104 }
105 }
106 return nCubes;
107 }
108}
struct cube Cube
int Kit_TruthIsop(unsigned *puTruth, int nVars, Vec_Int_t *vMemory, int fTryBoth)
Definition kitIsop.c:134
#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: