ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
giaAig.c
Go to the documentation of this file.
1
20
21#include "giaAig.h"
22#include "aig/gia/gia.h"
23#include "proof/fra/fra.h"
24#include "proof/dch/dch.h"
25#include "opt/dar/dar.h"
26#include "opt/dau/dau.h"
27#include <assert.h>
28
30
31
35
36static inline int Gia_ObjChild0Copy( Aig_Obj_t * pObj ) { return Abc_LitNotCond( Aig_ObjFanin0(pObj)->iData, Aig_ObjFaninC0(pObj) ); }
37static inline int Gia_ObjChild1Copy( Aig_Obj_t * pObj ) { return Abc_LitNotCond( Aig_ObjFanin1(pObj)->iData, Aig_ObjFaninC1(pObj) ); }
38
39static inline Aig_Obj_t * Gia_ObjChild0Copy2( Aig_Obj_t ** ppNodes, Gia_Obj_t * pObj, int Id ) { return Aig_NotCond( ppNodes[Gia_ObjFaninId0(pObj, Id)], Gia_ObjFaninC0(pObj) ); }
40static inline Aig_Obj_t * Gia_ObjChild1Copy2( Aig_Obj_t ** ppNodes, Gia_Obj_t * pObj, int Id ) { return Aig_NotCond( ppNodes[Gia_ObjFaninId1(pObj, Id)], Gia_ObjFaninC1(pObj) ); }
41
45
58{
59 Aig_Obj_t * pNext;
60 if ( pObj->iData )
61 return;
62 assert( Aig_ObjIsNode(pObj) );
63 Gia_ManFromAig_rec( pNew, p, Aig_ObjFanin0(pObj) );
64 Gia_ManFromAig_rec( pNew, p, Aig_ObjFanin1(pObj) );
65 pObj->iData = Gia_ManAppendAnd( pNew, Gia_ObjChild0Copy(pObj), Gia_ObjChild1Copy(pObj) );
66 if ( p->pEquivs && (pNext = Aig_ObjEquiv(p, pObj)) )
67 {
68 int iObjNew, iNextNew;
69 Gia_ManFromAig_rec( pNew, p, pNext );
70 iObjNew = Abc_Lit2Var(pObj->iData);
71 iNextNew = Abc_Lit2Var(pNext->iData);
72 if ( pNew->pNexts )
73 pNew->pNexts[iObjNew] = iNextNew;
74 }
75}
77{
78 Gia_Man_t * pNew;
79 Aig_Obj_t * pObj;
80 int i;
81 // create the new manager
82 pNew = Gia_ManStart( Aig_ManObjNum(p) );
83 pNew->pName = Abc_UtilStrsav( p->pName );
84 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
85 pNew->nConstrs = p->nConstrs;
86 // create room to store equivalences
87 if ( p->pEquivs )
88 pNew->pNexts = ABC_CALLOC( int, Aig_ManObjNum(p) );
89 // create the PIs
91 Aig_ManConst1(p)->iData = 1;
92 Aig_ManForEachCi( p, pObj, i )
93 pObj->iData = Gia_ManAppendCi( pNew );
94 // add logic for the POs
95 Aig_ManForEachCo( p, pObj, i )
96 Gia_ManFromAig_rec( pNew, p, Aig_ObjFanin0(pObj) );
97 Aig_ManForEachCo( p, pObj, i )
98 Gia_ManAppendCo( pNew, Gia_ObjChild0Copy(pObj) );
99 Gia_ManSetRegNum( pNew, Aig_ManRegNum(p) );
100 if ( pNew->pNexts )
101 Gia_ManDeriveReprs( pNew );
102 return pNew;
103}
104
117{
118 if ( !pObj || !Gia_ObjIsAnd(pObj) || pObj->fPhase )
119 return;
120 pObj->fPhase = 1;
121 Gia_ManCheckChoices_rec( p, Gia_ObjFanin0(pObj) );
122 Gia_ManCheckChoices_rec( p, Gia_ObjFanin1(pObj) );
123 Gia_ManCheckChoices_rec( p, Gia_ObjSiblObj(p, Gia_ObjId(p, pObj)) );
124}
126{
127 Gia_Obj_t * pObj;
128 int i, fFound = 0;
130 Gia_ManForEachCo( p, pObj, i )
131 Gia_ManCheckChoices_rec( p, Gia_ObjFanin0(pObj) );
132 Gia_ManForEachAnd( p, pObj, i )
133 if ( !pObj->fPhase )
134 printf( "Object %d is dangling.\n", i ), fFound = 1;
135 if ( !fFound )
136 printf( "There are no dangling objects.\n" );
138}
139
152{
153 if ( pObj == NULL || pObj->iData )
154 return;
155 assert( Aig_ObjIsNode(pObj) );
156 Gia_ManFromAigChoices_rec( pNew, p, Aig_ObjFanin0(pObj) );
157 Gia_ManFromAigChoices_rec( pNew, p, Aig_ObjFanin1(pObj) );
158 Gia_ManFromAigChoices_rec( pNew, p, Aig_ObjEquiv(p, pObj) );
159 pObj->iData = Gia_ManAppendAnd( pNew, Gia_ObjChild0Copy(pObj), Gia_ObjChild1Copy(pObj) );
160 if ( Aig_ObjEquiv(p, pObj) )
161 {
162 int iObjNew, iNextNew;
163 iObjNew = Abc_Lit2Var(pObj->iData);
164 iNextNew = Abc_Lit2Var(Aig_ObjEquiv(p, pObj)->iData);
165 assert( iObjNew > iNextNew );
166 assert( Gia_ObjIsAnd(Gia_ManObj(pNew, iNextNew)) );
167 pNew->pSibls[iObjNew] = iNextNew;
168 }
169}
171{
172 Gia_Man_t * pNew;
173 Aig_Obj_t * pObj;
174 int i;
175 assert( p->pEquivs != NULL );
176 // create the new manager
177 pNew = Gia_ManStart( Aig_ManObjNum(p) );
178 pNew->pName = Abc_UtilStrsav( p->pName );
179 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
180 pNew->nConstrs = p->nConstrs;
181 // create room to store equivalences
182 pNew->pSibls = ABC_CALLOC( int, Aig_ManObjNum(p) );
183 // create the PIs
185 Aig_ManConst1(p)->iData = 1;
186 Aig_ManForEachCi( p, pObj, i )
187 pObj->iData = Gia_ManAppendCi( pNew );
188 // add logic for the POs
189 Aig_ManForEachCo( p, pObj, i )
190 Gia_ManFromAigChoices_rec( pNew, p, Aig_ObjFanin0(pObj) );
191 Aig_ManForEachCo( p, pObj, i )
192 Gia_ManAppendCo( pNew, Gia_ObjChild0Copy(pObj) );
193 Gia_ManSetRegNum( pNew, Aig_ManRegNum(p) );
194 //assert( Gia_ManObjNum(pNew) == Aig_ManObjNum(p) );
195 //Gia_ManCheckChoices( pNew );
196 if ( pNew->pSibls )
198 return pNew;
199}
200
213{
214 Gia_Man_t * pNew;
215 Aig_Obj_t * pObj;
216 int i;
217 // create the new manager
218 pNew = Gia_ManStart( Aig_ManObjNum(p) );
219 pNew->pName = Abc_UtilStrsav( p->pName );
220 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
221 pNew->nConstrs = p->nConstrs;
222 // create the PIs
224 Aig_ManForEachObj( p, pObj, i )
225 {
226 if ( Aig_ObjIsAnd(pObj) )
227 pObj->iData = Gia_ManAppendAnd( pNew, Gia_ObjChild0Copy(pObj), Gia_ObjChild1Copy(pObj) );
228 else if ( Aig_ObjIsCi(pObj) )
229 pObj->iData = Gia_ManAppendCi( pNew );
230 else if ( Aig_ObjIsCo(pObj) )
231 pObj->iData = Gia_ManAppendCo( pNew, Gia_ObjChild0Copy(pObj) );
232 else if ( Aig_ObjIsConst1(pObj) )
233 pObj->iData = 1;
234 else
235 assert( 0 );
236 }
237 Gia_ManSetRegNum( pNew, Aig_ManRegNum(p) );
238 return pNew;
239}
240
253{
254 Gia_Man_t * pNew;
255 Aig_Obj_t * pObj;
256 int i;
257 // create the new manager
258 pNew = Gia_ManStart( Aig_ManObjNum(p) );
259 pNew->pName = Abc_UtilStrsav( p->pName );
260 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
261 pNew->nConstrs = p->nConstrs;
262 // create the PIs
264 Aig_ManConst1(p)->iData = 1;
265 Aig_ManForEachCi( p, pObj, i )
266 pObj->iData = Gia_ManAppendCi( pNew );
267 // add POs corresponding to the nodes with choices
268 Aig_ManForEachNode( p, pObj, i )
269 if ( Aig_ObjRefs(pObj) == 0 )
270 {
271 Gia_ManFromAig_rec( pNew, p, pObj );
272 Gia_ManAppendCo( pNew, pObj->iData );
273 }
274 // add logic for the POs
275 Aig_ManForEachCo( p, pObj, i )
276 Gia_ManFromAig_rec( pNew, p, Aig_ObjFanin0(pObj) );
277 Aig_ManForEachCo( p, pObj, i )
278 pObj->iData = Gia_ManAppendCo( pNew, Gia_ObjChild0Copy(pObj) );
279 Gia_ManSetRegNum( pNew, Aig_ManRegNum(p) );
280 return pNew;
281}
282
294void Gia_ManToAig_rec( Aig_Man_t * pNew, Aig_Obj_t ** ppNodes, Gia_Man_t * p, Gia_Obj_t * pObj )
295{
296 Gia_Obj_t * pNext;
297 if ( ppNodes[Gia_ObjId(p, pObj)] )
298 return;
299 if ( Gia_ObjIsCi(pObj) )
300 ppNodes[Gia_ObjId(p, pObj)] = Aig_ObjCreateCi( pNew );
301 else
302 {
303 assert( Gia_ObjIsAnd(pObj) );
304 Gia_ManToAig_rec( pNew, ppNodes, p, Gia_ObjFanin0(pObj) );
305 Gia_ManToAig_rec( pNew, ppNodes, p, Gia_ObjFanin1(pObj) );
306 ppNodes[Gia_ObjId(p, pObj)] = Aig_And( pNew, Gia_ObjChild0Copy2(ppNodes, pObj, Gia_ObjId(p, pObj)), Gia_ObjChild1Copy2(ppNodes, pObj, Gia_ObjId(p, pObj)) );
307 }
308 if ( pNew->pEquivs && (pNext = Gia_ObjNextObj(p, Gia_ObjId(p, pObj))) )
309 {
310 Aig_Obj_t * pObjNew, * pNextNew;
311 Gia_ManToAig_rec( pNew, ppNodes, p, pNext );
312 pObjNew = ppNodes[Gia_ObjId(p, pObj)];
313 pNextNew = ppNodes[Gia_ObjId(p, pNext)];
314 if ( pNew->pEquivs )
315 pNew->pEquivs[Aig_Regular(pObjNew)->Id] = Aig_Regular(pNextNew);
316 }
317}
318Aig_Man_t * Gia_ManToAig( Gia_Man_t * p, int fChoices )
319{
320 Aig_Man_t * pNew;
321 Aig_Obj_t ** ppNodes;
322 Gia_Obj_t * pObj;
323 int i;
324 assert( !fChoices || (p->pNexts && p->pReprs) );
325 // create the new manager
326 pNew = Aig_ManStart( Gia_ManAndNum(p) );
327 pNew->pName = Abc_UtilStrsav( p->pName );
328 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
329 pNew->nConstrs = p->nConstrs;
330// pNew->pSpec = Abc_UtilStrsav( p->pName );
331 // duplicate representation of choice nodes
332 if ( fChoices )
333 pNew->pEquivs = ABC_CALLOC( Aig_Obj_t *, Gia_ManObjNum(p) );
334 // create the PIs
335 ppNodes = ABC_CALLOC( Aig_Obj_t *, Gia_ManObjNum(p) );
336 ppNodes[0] = Aig_ManConst0(pNew);
337 Gia_ManForEachCi( p, pObj, i )
338 ppNodes[Gia_ObjId(p, pObj)] = Aig_ObjCreateCi( pNew );
339 // transfer level
340 if ( p->vLevels )
341 Gia_ManForEachCi( p, pObj, i )
342 Aig_ObjSetLevel( ppNodes[Gia_ObjId(p, pObj)], Gia_ObjLevel(p, pObj) );
343 // add logic for the POs
344 Gia_ManForEachCo( p, pObj, i )
345 {
346 Gia_ManToAig_rec( pNew, ppNodes, p, Gia_ObjFanin0(pObj) );
347 ppNodes[Gia_ObjId(p, pObj)] = Aig_ObjCreateCo( pNew, Gia_ObjChild0Copy2(ppNodes, pObj, Gia_ObjId(p, pObj)) );
348 }
349 Aig_ManSetRegNum( pNew, Gia_ManRegNum(p) );
350 ABC_FREE( ppNodes );
351 return pNew;
352}
353
366{
367 Aig_Man_t * pNew;
368 Aig_Obj_t ** ppNodes;
369 Gia_Obj_t * pObj;
370 int i;
371 assert( p->pNexts == NULL && p->pReprs == NULL );
372 assert( nOutDelta > 0 && Gia_ManCoNum(p) % nOutDelta == 0 );
373 // create the new manager
374 pNew = Aig_ManStart( Gia_ManAndNum(p) );
375 pNew->pName = Abc_UtilStrsav( p->pName );
376 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
377 pNew->nConstrs = p->nConstrs;
378// pNew->pSpec = Abc_UtilStrsav( p->pName );
379 // create the PIs
380 ppNodes = ABC_CALLOC( Aig_Obj_t *, Gia_ManObjNum(p) );
381 ppNodes[0] = Aig_ManConst0(pNew);
382 Gia_ManForEachCi( p, pObj, i )
383 ppNodes[Gia_ObjId(p, pObj)] = Aig_ObjCreateCi( pNew );
384 // add logic for the POs
385 Gia_ManForEachCo( p, pObj, i )
386 {
387 Gia_ManToAig_rec( pNew, ppNodes, p, Gia_ObjFanin0(pObj) );
388 if ( i % nOutDelta != 0 )
389 continue;
390 ppNodes[Gia_ObjId(p, pObj)] = Aig_ObjCreateCo( pNew, Gia_ObjChild0Copy2(ppNodes, pObj, Gia_ObjId(p, pObj)) );
391 }
392 Aig_ManSetRegNum( pNew, Gia_ManRegNum(p) );
393 ABC_FREE( ppNodes );
394 return pNew;
395}
396
409{
410 Aig_Man_t * pNew;
411 Aig_Obj_t ** ppNodes;
412 Gia_Obj_t * pObj;
413 int i;
414 ppNodes = ABC_FALLOC( Aig_Obj_t *, Gia_ManObjNum(p) );
415 // create the new manager
416 pNew = Aig_ManStart( Gia_ManObjNum(p) );
417 pNew->pName = Abc_UtilStrsav( p->pName );
418 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
419 pNew->nConstrs = p->nConstrs;
420 // create the PIs
421 Gia_ManForEachObj( p, pObj, i )
422 {
423 if ( Gia_ObjIsAnd(pObj) )
424 ppNodes[i] = Aig_And( pNew, Gia_ObjChild0Copy2(ppNodes, pObj, Gia_ObjId(p, pObj)), Gia_ObjChild1Copy2(ppNodes, pObj, Gia_ObjId(p, pObj)) );
425 else if ( Gia_ObjIsCi(pObj) )
426 ppNodes[i] = Aig_ObjCreateCi( pNew );
427 else if ( Gia_ObjIsCo(pObj) )
428 ppNodes[i] = Aig_ObjCreateCo( pNew, Gia_ObjChild0Copy2(ppNodes, pObj, Gia_ObjId(p, pObj)) );
429 else if ( Gia_ObjIsConst0(pObj) )
430 ppNodes[i] = Aig_ManConst0(pNew);
431 else
432 assert( 0 );
433 pObj->Value = Abc_Var2Lit( Aig_ObjId(Aig_Regular(ppNodes[i])), Aig_IsComplement(ppNodes[i]) );
434 assert( i == 0 || Aig_ObjId(ppNodes[i]) == i );
435 }
436 Aig_ManSetRegNum( pNew, Gia_ManRegNum(p) );
437 ABC_FREE( ppNodes );
438 return pNew;
439}
440
452Aig_Man_t * Gia_ManCofactorAig( Aig_Man_t * p, int nFrames, int nCofFanLit )
453{
454 Aig_Man_t * pMan;
455 Gia_Man_t * pGia, * pTemp;
456 pGia = Gia_ManFromAig( p );
457 pGia = Gia_ManUnrollAndCofactor( pTemp = pGia, nFrames, nCofFanLit, 1 );
458 Gia_ManStop( pTemp );
459 pMan = Gia_ManToAig( pGia, 0 );
460 Gia_ManStop( pGia );
461 return pMan;
462}
463
464
477{
478 Aig_Obj_t * pObj;
479 Gia_Obj_t * pGiaObj, * pGiaRepr;
480 int i;
481 assert( pAig->pReprs == NULL );
482 assert( pGia->pReprs != NULL );
483 // move pointers from AIG to GIA
484 Aig_ManForEachObj( pAig, pObj, i )
485 {
486 assert( i == 0 || !Abc_LitIsCompl(pObj->iData) );
487 pGiaObj = Gia_ManObj( pGia, Abc_Lit2Var(pObj->iData) );
488 pGiaObj->Value = i;
489 }
490 // set the pointers to the nodes in AIG
491 Aig_ManReprStart( pAig, Aig_ManObjNumMax(pAig) );
492 Gia_ManForEachObj( pGia, pGiaObj, i )
493 {
494 pGiaRepr = Gia_ObjReprObj( pGia, i );
495 if ( pGiaRepr == NULL )
496 continue;
497 Aig_ObjCreateRepr( pAig, Aig_ManObj(pAig, pGiaRepr->Value), Aig_ManObj(pAig, pGiaObj->Value) );
498 }
499}
501{
502 Gia_Obj_t * pGiaObj, * pGiaRepr;
503 int i;
504 assert( pAig->pReprs == NULL );
505 assert( pGia->pReprs != NULL );
506 // set the pointers to the nodes in AIG
507 Aig_ManReprStart( pAig, Aig_ManObjNumMax(pAig) );
508 Gia_ManForEachObj( pGia, pGiaObj, i )
509 {
510 pGiaRepr = Gia_ObjReprObj( pGia, i );
511 if ( pGiaRepr == NULL )
512 continue;
513 Aig_ObjCreateRepr( pAig, Aig_ManObj(pAig, Abc_Lit2Var(pGiaRepr->Value)), Aig_ManObj(pAig, Abc_Lit2Var(pGiaObj->Value)) );
514 }
515}
516
529{
530 Gia_Obj_t * pObjGia;
531 Aig_Obj_t * pObjAig, * pReprAig;
532 int i;
533 assert( pAig->pReprs != NULL );
534 assert( pGia->pReprs == NULL );
535 assert( Gia_ManObjNum(pGia) - Gia_ManCoNum(pGia) == Aig_ManObjNum(pAig) - Aig_ManCoNum(pAig) );
536 pGia->pReprs = ABC_CALLOC( Gia_Rpr_t, Gia_ManObjNum(pGia) );
537 for ( i = 0; i < Gia_ManObjNum(pGia); i++ )
538 Gia_ObjSetRepr( pGia, i, GIA_VOID );
539 // move pointers from GIA to AIG
540 Gia_ManForEachObj( pGia, pObjGia, i )
541 {
542 if ( Gia_ObjIsCo(pObjGia) )
543 continue;
544 assert( i == 0 || !Abc_LitIsCompl(Gia_ObjValue(pObjGia)) );
545 pObjAig = Aig_ManObj( pAig, Abc_Lit2Var(Gia_ObjValue(pObjGia)) );
546 pObjAig->iData = i;
547 }
548 Aig_ManForEachObj( pAig, pObjAig, i )
549 {
550 if ( Aig_ObjIsCo(pObjAig) )
551 continue;
552 if ( pAig->pReprs[i] == NULL )
553 continue;
554 pReprAig = pAig->pReprs[i];
555 Gia_ObjSetRepr( pGia, pObjAig->iData, pReprAig->iData );
556 }
557 pGia->pNexts = Gia_ManDeriveNexts( pGia );
558}
560{
561 Aig_Obj_t * pObjAig, * pReprAig;
562 int i;
563 assert( pAig->pReprs != NULL );
564 assert( pGia->pReprs == NULL );
565 assert( Gia_ManObjNum(pGia) - Gia_ManCoNum(pGia) == Aig_ManObjNum(pAig) - Aig_ManCoNum(pAig) );
566 pGia->pReprs = ABC_CALLOC( Gia_Rpr_t, Gia_ManObjNum(pGia) );
567 for ( i = 0; i < Gia_ManObjNum(pGia); i++ )
568 Gia_ObjSetRepr( pGia, i, GIA_VOID );
569 Aig_ManForEachObj( pAig, pObjAig, i )
570 {
571 if ( Aig_ObjIsCo(pObjAig) )
572 continue;
573 if ( pAig->pReprs[i] == NULL )
574 continue;
575 pReprAig = pAig->pReprs[i];
576 Gia_ObjSetRepr( pGia, Abc_Lit2Var(pObjAig->iData), Abc_Lit2Var(pReprAig->iData) );
577 }
578 pGia->pNexts = Gia_ManDeriveNexts( pGia );
579}
580
592Gia_Man_t * Gia_ManCompress2( Gia_Man_t * p, int fUpdateLevel, int fVerbose )
593{
594 Gia_Man_t * pGia;
595 Aig_Man_t * pNew, * pTemp;
596 if ( p->pManTime && p->vLevels == NULL )
598 pNew = Gia_ManToAig( p, 0 );
599 pNew = Dar_ManCompress2( pTemp = pNew, 1, fUpdateLevel, 1, 0, fVerbose );
600 Aig_ManStop( pTemp );
601 pGia = Gia_ManFromAig( pNew );
602 Aig_ManStop( pNew );
603 Gia_ManTransferTiming( pGia, p );
604 return pGia;
605}
606
619{
620 Gia_Obj_t * pObj; int i;
621 Vec_Int_t * vPointed = Vec_IntStart( Gia_ManObjNum(p) );
622 Gia_ManForEachAnd( p, pObj, i )
623 if ( Gia_ObjSibl(p, i) )
624 Vec_IntWriteEntry( vPointed, Gia_ObjSibl(p, i), 1 );
626 Gia_ManForEachAnd( p, pObj, i )
627 if ( Vec_IntEntry(vPointed, i) && Gia_ObjRefNumId(p, i) > 0 )
628 {
629 printf( "Gia_ManCheckChoices: Member %d", i );
630 printf( " of a choice node has %d fanouts.\n", Gia_ObjRefNumId(p, i) );
631 ABC_FREE( p->pRefs );
632 Vec_IntFree( vPointed );
633 return 0;
634 }
635 ABC_FREE( p->pRefs );
636 Vec_IntFree( vPointed );
637 return 1;
638}
640{
641 int fUseMapping = 0;
642 Gia_Man_t * pGia, * pGia1;
643 Aig_Man_t * pNew;
644 if ( p->pManTime && p->vLevels == NULL )
646 if ( fUseMapping && Gia_ManHasMapping(p) )
647 pGia1 = (Gia_Man_t *)Dsm_ManDeriveGia( p, 0 );
648 else
649 pGia1 = Gia_ManDup( p );
650 pNew = Gia_ManToAig( pGia1, 0 );
651 Gia_ManStop( pGia1 );
652 pNew = Dar_ManChoiceNew( pNew, (Dch_Pars_t *)pPars );
653// pGia = Gia_ManFromAig( pNew );
654 pGia = Gia_ManFromAigChoices( pNew );
655 Aig_ManStop( pNew );
656 if ( !p->pManTime && !Gia_ManTestChoices(pGia) )
657 {
658 Gia_ManStop( pGia );
659 pGia = Gia_ManDup( p );
660 }
661 Gia_ManTransferTiming( pGia, p );
662 return pGia;
663}
664
676void Gia_ManSeqCleanupClasses( Gia_Man_t * p, int fConst, int fEquiv, int fVerbose )
677{
678 Aig_Man_t * pNew, * pTemp;
679 pNew = Gia_ManToAigSimple( p );
680 pTemp = Aig_ManScl( pNew, fConst, fEquiv, 0, -1, -1, fVerbose, 0 );
681 Gia_ManReprFromAigRepr( pNew, p );
682 Aig_ManStop( pTemp );
683 Aig_ManStop( pNew );
684}
685
698{
699// extern int Fra_FraigSat( Aig_Man_t * pMan, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, int fFlipBits, int fAndOuts, int fNewSolver, int fVerbose );
700 Aig_Man_t * pNew;
701 int RetValue;//, clk = Abc_Clock();
702 pNew = Gia_ManToAig( p, 0 );
703 RetValue = Fra_FraigSat( pNew, 10000000, 0, 0, 0, 0, 1, 1, 0, 0 );
704 if ( RetValue == 0 )
705 {
706 Gia_Obj_t * pObj;
707 int i, * pInit = (int *)pNew->pData;
708 Gia_ManConst0(p)->fMark0 = 0;
709 Gia_ManForEachPi( p, pObj, i )
710 pObj->fMark0 = pInit[i];
711 Gia_ManForEachAnd( p, pObj, i )
712 pObj->fMark0 = (Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj)) &
713 (Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj));
714 Gia_ManForEachPo( p, pObj, i )
715 pObj->fMark0 = (Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj));
716 Gia_ManForEachPo( p, pObj, i )
717 if ( pObj->fMark0 != 1 )
718 break;
719 if ( i != Gia_ManPoNum(p) )
720 Abc_Print( 1, "Counter-example verification has failed. " );
721// else
722// Abc_Print( 1, "Counter-example verification succeeded. " );
723 }
724/*
725 else if ( RetValue == 1 )
726 Abc_Print( 1, "The SAT problem is unsatisfiable. " );
727 else if ( RetValue == -1 )
728 Abc_Print( 1, "The SAT problem is undecided. " );
729 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
730*/
731 Aig_ManStop( pNew );
732 return RetValue;
733}
734
735
739
740
742
#define ABC_FALLOC(type, num)
Definition abc_global.h:266
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define ABC_FREE(obj)
Definition abc_global.h:267
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition aigMan.c:438
void Aig_ManReprStart(Aig_Man_t *p, int nIdMax)
DECLARATIONS ///.
Definition aigRepr.c:45
void Aig_ObjCreateRepr(Aig_Man_t *p, Aig_Obj_t *pNode1, Aig_Obj_t *pNode2)
Definition aigRepr.c:83
#define Aig_ManForEachObj(p, pObj, i)
Definition aig.h:403
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition aig.h:393
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition aigOper.c:104
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition aigObj.c:66
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition aigMan.c:47
#define Aig_ManForEachNode(p, pObj, i)
Definition aig.h:413
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
#define Aig_ManForEachCo(p, pObj, i)
Definition aig.h:398
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition aigObj.c:45
Aig_Man_t * Aig_ManScl(Aig_Man_t *pAig, int fLatchConst, int fLatchEqual, int fUseMvSweep, int nFramesSymb, int nFramesSatur, int fVerbose, int fVeryVerbose)
Definition aigScl.c:650
void Aig_ManCleanData(Aig_Man_t *p)
Definition aigUtil.c:205
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Aig_Man_t * Dar_ManChoiceNew(Aig_Man_t *pAig, Dch_Pars_t *pPars)
Definition darScript.c:849
Aig_Man_t * Dar_ManCompress2(Aig_Man_t *pAig, int fBalance, int fUpdateLevel, int fFanout, int fPower, int fVerbose)
Definition darScript.c:235
void * Dsm_ManDeriveGia(void *p, int fUseMuxes)
Definition dauGia.c:503
typedefABC_NAMESPACE_HEADER_START struct Dch_Pars_t_ Dch_Pars_t
INCLUDES ///.
Definition dch.h:43
Cube * p
Definition exorList.c:222
int Fra_FraigSat(Aig_Man_t *pMan, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, int nLearnedStart, int nLearnedDelta, int nLearnedPerce, int fFlipBits, int fAndOuts, int fNewSolver, int fVerbose)
ITERATORS ///.
Definition fraCec.c:47
void Gia_ManReprToAigRepr(Aig_Man_t *pAig, Gia_Man_t *pGia)
Definition giaAig.c:476
void Gia_ManCheckChoices(Gia_Man_t *p)
Definition giaAig.c:125
void Gia_ManReprFromAigRepr2(Aig_Man_t *pAig, Gia_Man_t *pGia)
Definition giaAig.c:559
void Gia_ManFromAigChoices_rec(Gia_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
Definition giaAig.c:151
int Gia_ManTestChoices(Gia_Man_t *p)
Definition giaAig.c:618
Gia_Man_t * Gia_ManFromAigChoices(Aig_Man_t *p)
Definition giaAig.c:170
Gia_Man_t * Gia_ManFromAigSwitch(Aig_Man_t *p)
Definition giaAig.c:252
Gia_Man_t * Gia_ManCompress2(Gia_Man_t *p, int fUpdateLevel, int fVerbose)
Definition giaAig.c:592
Gia_Man_t * Gia_ManPerformDch(Gia_Man_t *p, void *pPars)
Definition giaAig.c:639
void Gia_ManSeqCleanupClasses(Gia_Man_t *p, int fConst, int fEquiv, int fVerbose)
Definition giaAig.c:676
Aig_Man_t * Gia_ManToAigSimple(Gia_Man_t *p)
Definition giaAig.c:408
Gia_Man_t * Gia_ManFromAig(Aig_Man_t *p)
INCLUDES ///.
Definition giaAig.c:76
void Gia_ManToAig_rec(Aig_Man_t *pNew, Aig_Obj_t **ppNodes, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaAig.c:294
Aig_Man_t * Gia_ManToAig(Gia_Man_t *p, int fChoices)
Definition giaAig.c:318
Aig_Man_t * Gia_ManToAigSkip(Gia_Man_t *p, int nOutDelta)
Definition giaAig.c:365
void Gia_ManReprFromAigRepr(Aig_Man_t *pAig, Gia_Man_t *pGia)
Definition giaAig.c:528
Aig_Man_t * Gia_ManCofactorAig(Aig_Man_t *p, int nFrames, int nCofFanLit)
Definition giaAig.c:452
void Gia_ManFromAig_rec(Gia_Man_t *pNew, Aig_Man_t *p, Aig_Obj_t *pObj)
FUNCTION DEFINITIONS ///.
Definition giaAig.c:57
int Gia_ManSolveSat(Gia_Man_t *p)
Definition giaAig.c:697
void Gia_ManReprToAigRepr2(Aig_Man_t *pAig, Gia_Man_t *pGia)
Definition giaAig.c:500
void Gia_ManCheckChoices_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition giaAig.c:116
Gia_Man_t * Gia_ManFromAigSimple(Aig_Man_t *p)
Definition giaAig.c:212
struct Gia_Rpr_t_ Gia_Rpr_t
Definition gia.h:57
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition giaDup.c:720
#define Gia_ManForEachPo(p, pObj, i)
Definition gia.h:1250
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
void Gia_ManDeriveReprsFromSibls(Gia_Man_t *p)
Definition giaEquiv.c:325
void Gia_ManDeriveReprs(Gia_Man_t *p)
Definition giaEquiv.c:293
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition giaMan.c:764
int * Gia_ManDeriveNexts(Gia_Man_t *p)
Definition giaEquiv.c:260
int Gia_ManLevelWithBoxes(Gia_Man_t *p)
Definition giaTim.c:478
#define Gia_ManForEachPi(p, pObj, i)
Definition gia.h:1248
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Gia_Man_t * Gia_ManUnrollAndCofactor(Gia_Man_t *p, int nFrames, int nFanMax, int fVerbose)
Definition giaEnable.c:403
void Gia_ManCleanPhase(Gia_Man_t *p)
Definition giaUtil.c:472
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition giaIf.c:2370
void Gia_ManCreateRefs(Gia_Man_t *p)
Definition giaUtil.c:779
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition gia.h:1190
#define Gia_ManForEachCo(p, pObj, i)
Definition gia.h:1236
#define Gia_ManForEachCi(p, pObj, i)
Definition gia.h:1228
#define GIA_VOID
Definition gia.h:46
int iData
Definition aig.h:88
int * pSibls
Definition gia.h:128
char * pSpec
Definition gia.h:100
Gia_Rpr_t * pReprs
Definition gia.h:126
int * pNexts
Definition gia.h:127
char * pName
Definition gia.h:99
int nConstrs
Definition gia.h:122
unsigned Value
Definition gia.h:89
unsigned fPhase
Definition gia.h:87
unsigned fMark0
Definition gia.h:81
#define assert(ex)
Definition util_old.h:213