From 3b790eb17e54cd922440a1a3b18a5cfdd5cbcadb Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Sat, 2 Feb 2008 08:01:00 -0800 Subject: Version abc80202 --- src/aig/cnf/cnfMan.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'src/aig/cnf/cnfMan.c') diff --git a/src/aig/cnf/cnfMan.c b/src/aig/cnf/cnfMan.c index 47bc0b67..fab9093d 100644 --- a/src/aig/cnf/cnfMan.c +++ b/src/aig/cnf/cnfMan.c @@ -107,6 +107,57 @@ Vec_Int_t * Cnf_DataCollectPiSatNums( Cnf_Dat_t * pCnf, Aig_Man_t * p ) return vCiIds; } +/**Function************************************************************* + + Synopsis [Allocates the new CNF.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Cnf_Dat_t * Cnf_DataAlloc( Aig_Man_t * pAig, int nVars, int nClauses, int nLiterals ) +{ + Cnf_Dat_t * pCnf; + pCnf = ALLOC( Cnf_Dat_t, 1 ); + memset( pCnf, 0, sizeof(Cnf_Dat_t) ); + pCnf->pMan = pAig; + pCnf->nVars = nVars; + pCnf->nClauses = nClauses; + pCnf->nLiterals = nLiterals; + pCnf->pClauses = ALLOC( int *, nClauses + 1 ); + pCnf->pClauses[0] = ALLOC( int, nLiterals ); + pCnf->pClauses[nClauses] = pCnf->pClauses[0] + nLiterals; + pCnf->pVarNums = ALLOC( int, Aig_ManObjNumMax(pAig) ); + memset( pCnf->pVarNums, 0xff, sizeof(int) * Aig_ManObjNumMax(pAig) ); + return pCnf; +} + +/**Function************************************************************* + + Synopsis [Allocates the new CNF.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Cnf_Dat_t * Cnf_DataDup( Cnf_Dat_t * p ) +{ + Cnf_Dat_t * pCnf; + int i; + pCnf = Cnf_DataAlloc( p->pMan, p->nVars, p->nClauses, p->nLiterals ); + memcpy( pCnf->pClauses[0], p->pClauses[0], sizeof(int) * p->nLiterals ); + memcpy( pCnf->pVarNums, p->pVarNums, sizeof(int) * Aig_ManObjNumMax(p->pMan) ); + for ( i = 1; i < p->nClauses; i++ ) + pCnf->pClauses[i] = pCnf->pClauses[0] + (p->pClauses[i] - p->pClauses[0]); + return pCnf; +} + /**Function************************************************************* Synopsis [] -- cgit v1.2.3