abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
kliveness.c File Reference
#include <stdio.h>
#include "base/main/main.h"
#include "aig/aig/aig.h"
#include "aig/saig/saig.h"
#include <string.h>
#include "base/main/mainInt.h"
#include "proof/pdr/pdr.h"
#include <time.h>

Go to the source code of this file.

Macros

#define SIMPLE_kCS   0
 
#define kCS_WITH_SAFETY_INVARIANTS   1
 
#define kCS_WITH_DISCOVER_MONOTONE_SIGNALS   2
 
#define kCS_WITH_SAFETY_AND_DCS_INVARIANTS   3
 
#define kCS_WITH_SAFETY_AND_USER_GIVEN_DCS_INVARIANTS   4
 

Functions

ABC_NAMESPACE_IMPL_START
Aig_Man_t
Abc_NtkToDar (Abc_Ntk_t *pNtk, int fExors, int fRegisters)
 DECLARATIONS ///. More...
 
Abc_Ntk_tAbc_NtkFromAigPhase (Aig_Man_t *pMan)
 
Abc_Ntk_tAbc_NtkMakeOnePo (Abc_Ntk_t *pNtk, int Output, int nRange)
 
void Aig_ManDumpBlif (Aig_Man_t *p, char *pFileName, Vec_Ptr_t *vPiNames, Vec_Ptr_t *vPoNames)
 
Aig_Man_tgenerateWorkingAig (Aig_Man_t *pAig, Abc_Ntk_t *pNtk, int *pIndex0Live)
 
Aig_Man_tgenerateWorkingAigWithDSC (Aig_Man_t *pAig, Abc_Ntk_t *pNtk, int *pIndex0Live, Vec_Ptr_t *vMasterBarriers)
 
Vec_Ptr_tfindDisjunctiveMonotoneSignals (Abc_Ntk_t *pNtk)
 
Vec_Int_tcreateSingletonIntVector (int i)
 
Aig_Man_tgenerateDisjunctiveTester (Abc_Ntk_t *pNtk, Aig_Man_t *pAig, int combN, int combK)
 
Aig_Man_tgenerateGeneralDisjunctiveTester (Abc_Ntk_t *pNtk, Aig_Man_t *pAig, int combK)
 
Aig_Obj_treadLiveSignal_0 (Aig_Man_t *pAig, int liveIndex_0)
 
Aig_Obj_treadLiveSignal_k (Aig_Man_t *pAig, int liveIndex_k)
 
Aig_Man_tintroduceAbsorberLogic (Aig_Man_t *pAig, int *pLiveIndex_0, int *pLiveIndex_k, int nonFirstIteration)
 
void modifyAigToApplySafetyInvar (Aig_Man_t *pAig, int csTarget, int safetyInvarPO)
 
int flipConePdr (Aig_Man_t *pAig, int directive, int targetCSPropertyIndex, int safetyInvariantPOIndex, int absorberCount)
 
int collectSafetyInvariantPOIndex (Abc_Ntk_t *pNtk)
 
Vec_Ptr_tcollectUserGivenDisjunctiveMonotoneSignals (Abc_Ntk_t *pNtk)
 
void deallocateMasterBarrierDisjunctInt (Vec_Ptr_t *vMasterBarrierDisjunctsArg)
 
void deallocateMasterBarrierDisjunctVecPtrVecInt (Vec_Ptr_t *vMasterBarrierDisjunctsArg)
 
Vec_Ptr_tgetVecOfVecFairness (FILE *fp)
 
int Abc_CommandCS_kLiveness (Abc_Frame_t *pAbc, int argc, char **argv)
 
int Abc_CommandNChooseK (Abc_Frame_t *pAbc, int argc, char **argv)
 

Macro Definition Documentation

#define kCS_WITH_DISCOVER_MONOTONE_SIGNALS   2

Definition at line 59 of file kliveness.c.

#define kCS_WITH_SAFETY_AND_DCS_INVARIANTS   3

Definition at line 60 of file kliveness.c.

#define kCS_WITH_SAFETY_AND_USER_GIVEN_DCS_INVARIANTS   4

Definition at line 61 of file kliveness.c.

#define kCS_WITH_SAFETY_INVARIANTS   1

Definition at line 58 of file kliveness.c.

#define SIMPLE_kCS   0

Definition at line 57 of file kliveness.c.

Function Documentation

int Abc_CommandCS_kLiveness ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)

Definition at line 525 of file kliveness.c.

526 {
527  Abc_Ntk_t * pNtk, * pNtkTemp;
528  Aig_Man_t * pAig, *pAigCS, *pAigCSNew;
529  int absorberCount;
530  int absorberLimit = 500;
531  int RetValue;
532  int liveIndex_0 = -1, liveIndex_k = -1;
533  int fVerbose = 1;
534  int directive = -1;
535  int c;
536  int safetyInvariantPO = -1;
537  abctime beginTime, endTime;
538  double time_spent;
539  Vec_Ptr_t *vMasterBarrierDisjuncts = NULL;
540  Aig_Man_t *pWorkingAig;
541  //FILE *fp;
542 
543  pNtk = Abc_FrameReadNtk(pAbc);
544 
545  //fp = fopen("propFile.txt", "r");
546  //if( fp )
547  // getVecOfVecFairness(fp);
548  //exit(0);
549 
550  /*************************************************
551  Extraction of Command Line Argument
552  *************************************************/
553  if( argc == 1 )
554  {
555  assert( directive == -1 );
556  directive = SIMPLE_kCS;
557  }
558  else
559  {
561  while ( ( c = Extra_UtilGetopt( argc, argv, "cmCgh" ) ) != EOF )
562  {
563  switch( c )
564  {
565  case 'c':
566  directive = kCS_WITH_SAFETY_INVARIANTS;
567  break;
568  case 'm':
570  break;
571  case 'C':
573  break;
574  case 'g':
576  break;
577  case 'h':
578  goto usage;
579  break;
580  default:
581  goto usage;
582  }
583  }
584  }
585  /*************************************************
586  Extraction of Command Line Argument Ends
587  *************************************************/
588 
589  if( !Abc_NtkIsStrash( pNtk ) )
590  {
591  printf("The input network was not strashed, strashing....\n");
592  pNtkTemp = Abc_NtkStrash( pNtk, 0, 0, 0 );
593  pAig = Abc_NtkToDar( pNtkTemp, 0, 1 );
594  }
595  else
596  {
597  pAig = Abc_NtkToDar( pNtk, 0, 1 );
598  pNtkTemp = pNtk;
599  }
600 
601  if( directive == kCS_WITH_SAFETY_INVARIANTS )
602  {
603  safetyInvariantPO = collectSafetyInvariantPOIndex(pNtkTemp);
604  assert( safetyInvariantPO != -1 );
605  }
606 
607  if(directive == kCS_WITH_DISCOVER_MONOTONE_SIGNALS)
608  {
609  beginTime = Abc_Clock();
610  vMasterBarrierDisjuncts = findDisjunctiveMonotoneSignals( pNtk );
611  endTime = Abc_Clock();
612  time_spent = (double)(endTime - beginTime)/CLOCKS_PER_SEC;
613  printf("pre-processing time = %f\n",time_spent);
614  return 0;
615  }
616 
617  if(directive == kCS_WITH_SAFETY_AND_DCS_INVARIANTS)
618  {
619  safetyInvariantPO = collectSafetyInvariantPOIndex(pNtkTemp);
620  assert( safetyInvariantPO != -1 );
621 
622  beginTime = Abc_Clock();
623  vMasterBarrierDisjuncts = findDisjunctiveMonotoneSignals( pNtk );
624  endTime = Abc_Clock();
625  time_spent = (double)(endTime - beginTime)/CLOCKS_PER_SEC;
626  printf("pre-processing time = %f\n",time_spent);
627 
628  assert( vMasterBarrierDisjuncts != NULL );
629  assert( Vec_PtrSize(vMasterBarrierDisjuncts) > 0 );
630  }
631 
633  {
634  safetyInvariantPO = collectSafetyInvariantPOIndex(pNtkTemp);
635  assert( safetyInvariantPO != -1 );
636 
637  beginTime = Abc_Clock();
638  vMasterBarrierDisjuncts = collectUserGivenDisjunctiveMonotoneSignals( pNtk );
639  endTime = Abc_Clock();
640  time_spent = (double)(endTime - beginTime)/CLOCKS_PER_SEC;
641  printf("pre-processing time = %f\n",time_spent);
642 
643  assert( vMasterBarrierDisjuncts != NULL );
644  assert( Vec_PtrSize(vMasterBarrierDisjuncts) > 0 );
645  }
646 
648  {
649  assert( vMasterBarrierDisjuncts != NULL );
650  pWorkingAig = generateWorkingAigWithDSC( pAig, pNtk, &liveIndex_0, vMasterBarrierDisjuncts );
651  pAigCS = introduceAbsorberLogic(pWorkingAig, &liveIndex_0, &liveIndex_k, 0);
652  }
653  else
654  {
655  pWorkingAig = generateWorkingAig( pAig, pNtk, &liveIndex_0 );
656  pAigCS = introduceAbsorberLogic(pWorkingAig, &liveIndex_0, &liveIndex_k, 0);
657  }
658 
659  Aig_ManStop(pWorkingAig);
660 
661  for( absorberCount=1; absorberCount<absorberLimit; absorberCount++ )
662  {
663  //printf( "\nindex of the liveness output = %d\n", liveIndex_k );
664  RetValue = flipConePdr( pAigCS, directive, liveIndex_k, safetyInvariantPO, absorberCount );
665 
666  if ( RetValue == 1 )
667  {
668  Abc_Print( 1, "k = %d, Property proved\n", absorberCount );
669  break;
670  }
671  else if ( RetValue == 0 )
672  {
673  if( fVerbose )
674  {
675  Abc_Print( 1, "k = %d, Property DISPROVED\n", absorberCount );
676  }
677  }
678  else if ( RetValue == -1 )
679  {
680  Abc_Print( 1, "Property UNDECIDED with k = %d.\n", absorberCount );
681  }
682  else
683  assert( 0 );
684 
685  pAigCSNew = introduceAbsorberLogic(pAigCS, &liveIndex_0, &liveIndex_k, absorberCount);
686  Aig_ManStop(pAigCS);
687  pAigCS = pAigCSNew;
688  }
689 
690  Aig_ManStop(pAigCS);
691  Aig_ManStop(pAig);
692 
694  {
695  deallocateMasterBarrierDisjunctInt(vMasterBarrierDisjuncts);
696  }
697  else
698  {
699  //if(vMasterBarrierDisjuncts)
700  // Vec_PtrFree(vMasterBarrierDisjuncts);
701  //deallocateMasterBarrierDisjunctVecPtrVecInt(vMasterBarrierDisjuncts);
702  deallocateMasterBarrierDisjunctInt(vMasterBarrierDisjuncts);
703  }
704  return 0;
705 
706  usage:
707  fprintf( stdout, "usage: kcs [-cmgCh]\n" );
708  fprintf( stdout, "\timplements Claessen-Sorensson's k-Liveness algorithm\n" );
709  fprintf( stdout, "\t-c : verification with constraints, looks for POs prefixed with csSafetyInvar_\n");
710  fprintf( stdout, "\t-m : discovers monotone signals\n");
711  fprintf( stdout, "\t-g : verification with user-supplied barriers, looks for POs prefixed with csLevel1Stabil_\n");
712  fprintf( stdout, "\t-C : verification with discovered monotone signals\n");
713  fprintf( stdout, "\t-h : print usage\n");
714  return 1;
715 
716 }
ABC_NAMESPACE_IMPL_START Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
DECLARATIONS ///.
Definition: abcDar.c:233
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
#define kCS_WITH_SAFETY_AND_USER_GIVEN_DCS_INVARIANTS
Definition: kliveness.c:61
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition: abcStrash.c:265
static abctime Abc_Clock()
Definition: abc_global.h:279
#define kCS_WITH_SAFETY_AND_DCS_INVARIANTS
Definition: kliveness.c:60
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
#define kCS_WITH_DISCOVER_MONOTONE_SIGNALS
Definition: kliveness.c:59
Vec_Ptr_t * collectUserGivenDisjunctiveMonotoneSignals(Abc_Ntk_t *pNtk)
Definition: kliveness.c:439
Aig_Man_t * generateWorkingAig(Aig_Man_t *pAig, Abc_Ntk_t *pNtk, int *pIndex0Live)
int flipConePdr(Aig_Man_t *pAig, int directive, int targetCSPropertyIndex, int safetyInvariantPOIndex, int absorberCount)
Definition: kliveness.c:341
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
#define kCS_WITH_SAFETY_INVARIANTS
Definition: kliveness.c:58
#define SIMPLE_kCS
Definition: kliveness.c:57
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition: mainFrame.c:282
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
Aig_Man_t * generateWorkingAigWithDSC(Aig_Man_t *pAig, Abc_Ntk_t *pNtk, int *pIndex0Live, Vec_Ptr_t *vMasterBarriers)
Aig_Man_t * introduceAbsorberLogic(Aig_Man_t *pAig, int *pLiveIndex_0, int *pLiveIndex_k, int nonFirstIteration)
Definition: kliveness.c:175
#define assert(ex)
Definition: util_old.h:213
int collectSafetyInvariantPOIndex(Abc_Ntk_t *pNtk)
Definition: kliveness.c:425
ABC_INT64_T abctime
Definition: abc_global.h:278
Vec_Ptr_t * findDisjunctiveMonotoneSignals(Abc_Ntk_t *pNtk)
void deallocateMasterBarrierDisjunctInt(Vec_Ptr_t *vMasterBarrierDisjunctsArg)
Definition: kliveness.c:463
int Abc_CommandNChooseK ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)

Definition at line 718 of file kliveness.c.

719 {
720  Abc_Ntk_t * pNtk, * pNtkTemp, *pNtkCombStabil;
721  Aig_Man_t * pAig, *pAigCombStabil;
722  int directive = -1;
723  int c;
724  int parameterizedCombK;
725 
726  pNtk = Abc_FrameReadNtk(pAbc);
727 
728 
729  /*************************************************
730  Extraction of Command Line Argument
731  *************************************************/
732  if( argc == 1 )
733  {
734  assert( directive == -1 );
735  directive = SIMPLE_kCS;
736  }
737  else
738  {
740  while ( ( c = Extra_UtilGetopt( argc, argv, "cmCgh" ) ) != EOF )
741  {
742  switch( c )
743  {
744  case 'c':
745  directive = kCS_WITH_SAFETY_INVARIANTS;
746  break;
747  case 'm':
749  break;
750  case 'C':
752  break;
753  case 'g':
755  break;
756  case 'h':
757  goto usage;
758  break;
759  default:
760  goto usage;
761  }
762  }
763  }
764  /*************************************************
765  Extraction of Command Line Argument Ends
766  *************************************************/
767 
768  if( !Abc_NtkIsStrash( pNtk ) )
769  {
770  printf("The input network was not strashed, strashing....\n");
771  pNtkTemp = Abc_NtkStrash( pNtk, 0, 0, 0 );
772  pAig = Abc_NtkToDar( pNtkTemp, 0, 1 );
773  }
774  else
775  {
776  pAig = Abc_NtkToDar( pNtk, 0, 1 );
777  pNtkTemp = pNtk;
778  }
779 
780 /**********************Code for generation of nCk outputs**/
781  //combCount = countCombination(1000, 3);
782  //pAigCombStabil = generateDisjunctiveTester( pNtk, pAig, 7, 2 );
783  printf("Enter parameterizedCombK = " );
784  if( scanf("%d", &parameterizedCombK) != 1 )
785  {
786  printf("\nFailed to read integer!\n");
787  return 0;
788  }
789  printf("\n");
790 
791  pAigCombStabil = generateGeneralDisjunctiveTester( pNtk, pAig, parameterizedCombK );
792  Aig_ManPrintStats(pAigCombStabil);
793  pNtkCombStabil = Abc_NtkFromAigPhase( pAigCombStabil );
794  pNtkCombStabil->pName = Abc_UtilStrsav( pAigCombStabil->pName );
795  if ( !Abc_NtkCheck( pNtkCombStabil ) )
796  fprintf( stdout, "Abc_NtkCreateCone(): Network check has failed.\n" );
797  Abc_FrameSetCurrentNetwork( pAbc, pNtkCombStabil );
798 
799  Aig_ManStop( pAigCombStabil );
800  Aig_ManStop( pAig );
801 
802  return 1;
803  //printf("\ncombCount = %d\n", combCount);
804  //exit(0);
805 /**********************************************************/
806 
807  usage:
808  fprintf( stdout, "usage: nck [-cmgCh]\n" );
809  fprintf( stdout, "\tgenerates combinatorial signals for stabilization\n" );
810  fprintf( stdout, "\t-h : print usage\n");
811  return 1;
812 
813 }
ABC_NAMESPACE_IMPL_START Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
DECLARATIONS ///.
Definition: abcDar.c:233
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
#define kCS_WITH_SAFETY_AND_USER_GIVEN_DCS_INVARIANTS
Definition: kliveness.c:61
ABC_DLL void Abc_FrameSetCurrentNetwork(Abc_Frame_t *p, Abc_Ntk_t *pNet)
Definition: mainFrame.c:396
Abc_Ntk_t * Abc_NtkFromAigPhase(Aig_Man_t *pMan)
Definition: abcDar.c:590
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition: abcStrash.c:265
void Aig_ManPrintStats(Aig_Man_t *p)
Definition: aigMan.c:379
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
#define kCS_WITH_SAFETY_AND_DCS_INVARIANTS
Definition: kliveness.c:60
Aig_Man_t * generateGeneralDisjunctiveTester(Abc_Ntk_t *pNtk, Aig_Man_t *pAig, int combK)
Definition: combination.c:321
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
#define kCS_WITH_DISCOVER_MONOTONE_SIGNALS
Definition: kliveness.c:59
#define kCS_WITH_SAFETY_INVARIANTS
Definition: kliveness.c:58
#define SIMPLE_kCS
Definition: kliveness.c:57
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition: mainFrame.c:282
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
#define assert(ex)
Definition: util_old.h:213
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
char * pName
Definition: abc.h:158
Abc_Ntk_t* Abc_NtkFromAigPhase ( Aig_Man_t pMan)

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

Synopsis [Converts the network from the AIG manager into ABC.]

Description [This procedure should be called after seq sweeping, which changes the number of registers.]

SideEffects []

SeeAlso []

Definition at line 590 of file abcDar.c.

591 {
592  Vec_Ptr_t * vNodes;
593  Abc_Ntk_t * pNtkNew;
594  Abc_Obj_t * pObjNew;
595  Aig_Obj_t * pObj, * pObjLo, * pObjLi;
596  int i;
597  assert( pMan->nAsserts == 0 );
598  // perform strashing
599  pNtkNew = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
600  pNtkNew->nConstrs = pMan->nConstrs;
601  pNtkNew->nBarBufs = pMan->nBarBufs;
602  // duplicate the name and the spec
603 // pNtkNew->pName = Extra_UtilStrsav(pMan->pName);
604 // pNtkNew->pSpec = Extra_UtilStrsav(pMan->pSpec);
605  Aig_ManConst1(pMan)->pData = Abc_AigConst1(pNtkNew);
606  // create PIs
607  Aig_ManForEachPiSeq( pMan, pObj, i )
608  {
609  pObjNew = Abc_NtkCreatePi( pNtkNew );
610 // Abc_ObjAssignName( pObjNew, Abc_ObjName(pObjNew), NULL );
611  pObj->pData = pObjNew;
612  }
613  // create POs
614  Aig_ManForEachPoSeq( pMan, pObj, i )
615  {
616  pObjNew = Abc_NtkCreatePo( pNtkNew );
617 // Abc_ObjAssignName( pObjNew, Abc_ObjName(pObjNew), NULL );
618  pObj->pData = pObjNew;
619  }
620  assert( Abc_NtkCiNum(pNtkNew) == Aig_ManCiNum(pMan) - Aig_ManRegNum(pMan) );
621  assert( Abc_NtkCoNum(pNtkNew) == Aig_ManCoNum(pMan) - Aig_ManRegNum(pMan) );
622  // create as many latches as there are registers in the manager
623  Aig_ManForEachLiLoSeq( pMan, pObjLi, pObjLo, i )
624  {
625  pObjNew = Abc_NtkCreateLatch( pNtkNew );
626  pObjLi->pData = Abc_NtkCreateBi( pNtkNew );
627  pObjLo->pData = Abc_NtkCreateBo( pNtkNew );
628  Abc_ObjAddFanin( pObjNew, (Abc_Obj_t *)pObjLi->pData );
629  Abc_ObjAddFanin( (Abc_Obj_t *)pObjLo->pData, pObjNew );
630  Abc_LatchSetInit0( pObjNew );
631 // Abc_ObjAssignName( (Abc_Obj_t *)pObjLi->pData, Abc_ObjName((Abc_Obj_t *)pObjLi->pData), NULL );
632 // Abc_ObjAssignName( (Abc_Obj_t *)pObjLo->pData, Abc_ObjName((Abc_Obj_t *)pObjLo->pData), NULL );
633  }
634  // rebuild the AIG
635  vNodes = Aig_ManDfs( pMan, 1 );
636  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
637  if ( Aig_ObjIsBuf(pObj) )
638  pObj->pData = (Abc_Obj_t *)Aig_ObjChild0Copy(pObj);
639  else
640  pObj->pData = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, (Abc_Obj_t *)Aig_ObjChild0Copy(pObj), (Abc_Obj_t *)Aig_ObjChild1Copy(pObj) );
641  Vec_PtrFree( vNodes );
642  // connect the PO nodes
643  Aig_ManForEachCo( pMan, pObj, i )
644  {
645  pObjNew = (Abc_Obj_t *)Aig_ObjChild0Copy(pObj);
646  Abc_ObjAddFanin( Abc_NtkCo(pNtkNew, i), pObjNew );
647  }
648 
649  Abc_NtkAddDummyPiNames( pNtkNew );
650  Abc_NtkAddDummyPoNames( pNtkNew );
651  Abc_NtkAddDummyBoxNames( pNtkNew );
652 
653  // check the resulting AIG
654  if ( !Abc_NtkCheck( pNtkNew ) )
655  Abc_Print( 1, "Abc_NtkFromAigPhase(): Network check has failed.\n" );
656  return pNtkNew;
657 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
void * pData
Definition: aig.h:87
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
DECLARATIONS ///.
Definition: abcAig.c:52
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:318
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
static Abc_Obj_t * Abc_NtkCreateBo(Abc_Ntk_t *pNtk)
Definition: abc.h:306
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
static int Aig_ObjIsBuf(Aig_Obj_t *pObj)
Definition: aig.h:277
ABC_DLL void Abc_NtkAddDummyPoNames(Abc_Ntk_t *pNtk)
Definition: abcNames.c:398
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
Definition: aig.h:450
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
ABC_DLL void Abc_NtkAddDummyBoxNames(Abc_Ntk_t *pNtk)
Definition: abcNames.c:418
static Abc_Obj_t * Abc_NtkCreateLatch(Abc_Ntk_t *pNtk)
Definition: abc.h:309
Vec_Ptr_t * Aig_ManDfs(Aig_Man_t *p, int fNodesOnly)
Definition: aigDfs.c:145
Definition: aig.h:69
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
int nBarBufs
Definition: abc.h:174
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_NtkCreateBi(Abc_Ntk_t *pNtk)
Definition: abc.h:305
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Aig_ManForEachPoSeq(p, pObj, i)
Definition: aig.h:444
ABC_DLL void Abc_NtkAddDummyPiNames(Abc_Ntk_t *pNtk)
Definition: abcNames.c:378
static void Abc_LatchSetInit0(Abc_Obj_t *pLatch)
Definition: abc.h:418
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
#define Aig_ManForEachPiSeq(p, pObj, i)
SEQUENTIAL ITERATORS ///.
Definition: aig.h:438
int nConstrs
Definition: abc.h:173
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Abc_Ntk_t* Abc_NtkMakeOnePo ( Abc_Ntk_t pNtkInit,
int  Output,
int  nRange 
)

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

Synopsis [Removes all POs, except one.]

Description []

SideEffects []

SeeAlso []

Definition at line 1590 of file abcNtk.c.

1591 {
1592  Abc_Ntk_t * pNtk;
1593  Vec_Ptr_t * vPosLeft;
1594  Vec_Ptr_t * vCosLeft;
1595  Abc_Obj_t * pNodePo;
1596  int i;
1597  assert( !Abc_NtkIsNetlist(pNtkInit) );
1598  assert( Abc_NtkHasOnlyLatchBoxes(pNtkInit) );
1599  if ( Output < 0 || Output >= Abc_NtkPoNum(pNtkInit) )
1600  {
1601  printf( "PO index is incorrect.\n" );
1602  return NULL;
1603  }
1604 
1605  pNtk = Abc_NtkDup( pNtkInit );
1606  if ( Abc_NtkPoNum(pNtk) == 1 )
1607  return pNtk;
1608 
1609  if ( nRange < 1 )
1610  nRange = 1;
1611 
1612  // filter POs
1613  vPosLeft = Vec_PtrAlloc( nRange );
1614  Abc_NtkForEachPo( pNtk, pNodePo, i )
1615  if ( i < Output || i >= Output + nRange )
1616  Abc_NtkDeleteObjPo( pNodePo );
1617  else
1618  Vec_PtrPush( vPosLeft, pNodePo );
1619  // filter COs
1620  vCosLeft = Vec_PtrDup( vPosLeft );
1621  for ( i = Abc_NtkPoNum(pNtk); i < Abc_NtkCoNum(pNtk); i++ )
1622  Vec_PtrPush( vCosLeft, Abc_NtkCo(pNtk, i) );
1623  // update arrays
1624  Vec_PtrFree( pNtk->vPos ); pNtk->vPos = vPosLeft;
1625  Vec_PtrFree( pNtk->vCos ); pNtk->vCos = vCosLeft;
1626 
1627  // clean the network
1628  if ( Abc_NtkIsStrash(pNtk) )
1629  {
1630  Abc_AigCleanup( (Abc_Aig_t *)pNtk->pManFunc );
1631  printf( "Run sequential cleanup (\"scl\") to get rid of dangling logic.\n" );
1632  }
1633  else
1634  {
1635  printf( "Run sequential cleanup (\"st; scl\") to get rid of dangling logic.\n" );
1636  }
1637 
1638  if ( !Abc_NtkCheck( pNtk ) )
1639  fprintf( stdout, "Abc_NtkMakeComb(): Network check has failed.\n" );
1640  return pNtk;
1641 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:419
static int Abc_NtkIsNetlist(Abc_Ntk_t *pNtk)
Definition: abc.h:249
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Vec_Ptr_t * Vec_PtrDup(Vec_Ptr_t *pVec)
Definition: vecPtr.h:169
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
for(p=first;p->value< newval;p=p->next)
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
DECLARATIONS ///.
Definition: abcAig.c:52
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:318
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition: abcAig.c:194
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
ABC_DLL void Abc_NtkDeleteObjPo(Abc_Obj_t *pObj)
Definition: abcObj.c:244
static int Abc_NtkHasOnlyLatchBoxes(Abc_Ntk_t *pNtk)
Definition: abc.h:298
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
ABC_NAMESPACE_IMPL_START Aig_Man_t* Abc_NtkToDar ( Abc_Ntk_t pNtk,
int  fExors,
int  fRegisters 
)

DECLARATIONS ///.

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

FileName [kliveness.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Liveness property checking.]

Synopsis [Main implementation module of the algorithm k-Liveness ] [invented by Koen Claessen, Niklas Sorensson. Implements] [the code for 'kcs'. 'kcs' pre-processes based on switch] [and then runs the (absorber circuit >> pdr) loop ]

Author [Sayak Ray]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - October 31, 2012.]

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

Synopsis [Converts the network from the AIG manager into ABC.]

Description [Assumes that registers are ordered after PIs/POs.]

SideEffects []

SeeAlso []

Definition at line 233 of file abcDar.c.

234 {
235  Vec_Ptr_t * vNodes;
236  Aig_Man_t * pMan;
237  Aig_Obj_t * pObjNew;
238  Abc_Obj_t * pObj;
239  int i, nNodes, nDontCares;
240  // make sure the latches follow PIs/POs
241  if ( fRegisters )
242  {
243  assert( Abc_NtkBoxNum(pNtk) == Abc_NtkLatchNum(pNtk) );
244  Abc_NtkForEachCi( pNtk, pObj, i )
245  if ( i < Abc_NtkPiNum(pNtk) )
246  {
247  assert( Abc_ObjIsPi(pObj) );
248  if ( !Abc_ObjIsPi(pObj) )
249  Abc_Print( 1, "Abc_NtkToDar(): Temporary bug: The PI ordering is wrong!\n" );
250  }
251  else
252  assert( Abc_ObjIsBo(pObj) );
253  Abc_NtkForEachCo( pNtk, pObj, i )
254  if ( i < Abc_NtkPoNum(pNtk) )
255  {
256  assert( Abc_ObjIsPo(pObj) );
257  if ( !Abc_ObjIsPo(pObj) )
258  Abc_Print( 1, "Abc_NtkToDar(): Temporary bug: The PO ordering is wrong!\n" );
259  }
260  else
261  assert( Abc_ObjIsBi(pObj) );
262  // print warning about initial values
263  nDontCares = 0;
264  Abc_NtkForEachLatch( pNtk, pObj, i )
265  if ( Abc_LatchIsInitDc(pObj) )
266  {
267  Abc_LatchSetInit0(pObj);
268  nDontCares++;
269  }
270  if ( nDontCares )
271  {
272  Abc_Print( 1, "Warning: %d registers in this network have don't-care init values.\n", nDontCares );
273  Abc_Print( 1, "The don't-care are assumed to be 0. The result may not verify.\n" );
274  Abc_Print( 1, "Use command \"print_latch\" to see the init values of registers.\n" );
275  Abc_Print( 1, "Use command \"zero\" to convert or \"init\" to change the values.\n" );
276  }
277  }
278  // create the manager
279  pMan = Aig_ManStart( Abc_NtkNodeNum(pNtk) + 100 );
280  pMan->fCatchExor = fExors;
281  pMan->nConstrs = pNtk->nConstrs;
282  pMan->nBarBufs = pNtk->nBarBufs;
283  pMan->pName = Extra_UtilStrsav( pNtk->pName );
284  pMan->pSpec = Extra_UtilStrsav( pNtk->pSpec );
285  // transfer the pointers to the basic nodes
286  Abc_AigConst1(pNtk)->pCopy = (Abc_Obj_t *)Aig_ManConst1(pMan);
287  Abc_NtkForEachCi( pNtk, pObj, i )
288  {
289  pObj->pCopy = (Abc_Obj_t *)Aig_ObjCreateCi(pMan);
290  // initialize logic level of the CIs
291  ((Aig_Obj_t *)pObj->pCopy)->Level = pObj->Level;
292  }
293  // complement the 1-values registers
294  if ( fRegisters ) {
295  Abc_NtkForEachLatch( pNtk, pObj, i )
296  if ( Abc_LatchIsInit1(pObj) )
297  Abc_ObjFanout0(pObj)->pCopy = Abc_ObjNot(Abc_ObjFanout0(pObj)->pCopy);
298  }
299  // perform the conversion of the internal nodes (assumes DFS ordering)
300 // pMan->fAddStrash = 1;
301  vNodes = Abc_NtkDfs( pNtk, 0 );
302  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
303 // Abc_NtkForEachNode( pNtk, pObj, i )
304  {
305  pObj->pCopy = (Abc_Obj_t *)Aig_And( pMan, (Aig_Obj_t *)Abc_ObjChild0Copy(pObj), (Aig_Obj_t *)Abc_ObjChild1Copy(pObj) );
306 // Abc_Print( 1, "%d->%d ", pObj->Id, ((Aig_Obj_t *)pObj->pCopy)->Id );
307  }
308  Vec_PtrFree( vNodes );
309  pMan->fAddStrash = 0;
310  // create the POs
311  Abc_NtkForEachCo( pNtk, pObj, i )
312  Aig_ObjCreateCo( pMan, (Aig_Obj_t *)Abc_ObjChild0Copy(pObj) );
313  // complement the 1-valued registers
314  Aig_ManSetRegNum( pMan, Abc_NtkLatchNum(pNtk) );
315  if ( fRegisters )
316  Aig_ManForEachLiSeq( pMan, pObjNew, i )
318  pObjNew->pFanin0 = Aig_Not(pObjNew->pFanin0);
319  // remove dangling nodes
320  nNodes = (Abc_NtkGetChoiceNum(pNtk) == 0)? Aig_ManCleanup( pMan ) : 0;
321  if ( !fExors && nNodes )
322  Abc_Print( 1, "Abc_NtkToDar(): Unexpected %d dangling nodes when converting to AIG!\n", nNodes );
323 //Aig_ManDumpVerilog( pMan, "test.v" );
324  // save the number of registers
325  if ( fRegisters )
326  {
327  Aig_ManSetRegNum( pMan, Abc_NtkLatchNum(pNtk) );
328  pMan->vFlopNums = Vec_IntStartNatural( pMan->nRegs );
329 // pMan->vFlopNums = NULL;
330 // pMan->vOnehots = Abc_NtkConverLatchNamesIntoNumbers( pNtk );
331  if ( pNtk->vOnehots )
332  pMan->vOnehots = (Vec_Ptr_t *)Vec_VecDupInt( (Vec_Vec_t *)pNtk->vOnehots );
333  }
334  if ( !Aig_ManCheck( pMan ) )
335  {
336  Abc_Print( 1, "Abc_NtkToDar: AIG check has failed.\n" );
337  Aig_ManStop( pMan );
338  return NULL;
339  }
340  return pMan;
341 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
unsigned Level
Definition: aig.h:82
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static int Abc_ObjIsBo(Abc_Obj_t *pObj)
Definition: abc.h:350
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
static int Abc_NtkBoxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:289
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static int Abc_ObjIsPi(Abc_Obj_t *pObj)
Definition: abc.h:347
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition: abcDfs.c:81
static Vec_Int_t * Vec_IntStartNatural(int nSize)
Definition: bblif.c:192
ABC_DLL int Abc_NtkGetChoiceNum(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:430
unsigned Level
Definition: abc.h:142
char * Extra_UtilStrsav(const char *s)
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:318
static Vec_Vec_t * Vec_VecDupInt(Vec_Vec_t *p)
Definition: vecVec.h:395
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
Abc_Obj_t * pCopy
Definition: abc.h:148
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static int Abc_LatchIsInitDc(Abc_Obj_t *pLatch)
Definition: abc.h:424
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition: abc.h:497
static int Abc_LatchIsInit1(Abc_Obj_t *pLatch)
Definition: abc.h:423
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Abc_ObjIsBi(Abc_Obj_t *pObj)
Definition: abc.h:349
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
static int Abc_ObjIsPo(Abc_Obj_t *pObj)
Definition: abc.h:348
#define assert(ex)
Definition: util_old.h:213
#define Aig_ManForEachLiSeq(p, pObj, i)
Definition: aig.h:447
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Abc_LatchSetInit0(Abc_Obj_t *pLatch)
Definition: abc.h:418
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
DECLARATIONS ///.
Definition: abcDar.c:233
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Aig_ManDumpBlif ( Aig_Man_t p,
char *  pFileName,
Vec_Ptr_t vPiNames,
Vec_Ptr_t vPoNames 
)

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

Synopsis [Writes the AIG into a BLIF file.]

Description []

SideEffects []

SeeAlso []

Definition at line 733 of file aigUtil.c.

734 {
735  FILE * pFile;
736  Vec_Ptr_t * vNodes;
737  Aig_Obj_t * pObj, * pObjLi, * pObjLo, * pConst1 = NULL;
738  int i, nDigits, Counter = 0;
739  if ( Aig_ManCoNum(p) == 0 )
740  {
741  printf( "Aig_ManDumpBlif(): AIG manager does not have POs.\n" );
742  return;
743  }
744  // check if constant is used
745  Aig_ManForEachCo( p, pObj, i )
746  if ( Aig_ObjIsConst1(Aig_ObjFanin0(pObj)) )
747  pConst1 = Aig_ManConst1(p);
748  // collect nodes in the DFS order
749  vNodes = Aig_ManDfs( p, 1 );
750  // assign IDs to objects
751  Aig_ManConst1(p)->iData = Counter++;
752  Aig_ManForEachCi( p, pObj, i )
753  pObj->iData = Counter++;
754  Aig_ManForEachCo( p, pObj, i )
755  pObj->iData = Counter++;
756  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
757  pObj->iData = Counter++;
758  nDigits = Abc_Base10Log( Counter );
759  // write the file
760  pFile = fopen( pFileName, "w" );
761  fprintf( pFile, "# BLIF file written by procedure Aig_ManDumpBlif()\n" );
762 // fprintf( pFile, "# http://www.eecs.berkeley.edu/~alanmi/abc/\n" );
763  fprintf( pFile, ".model %s\n", p->pName );
764  // write PIs
765  fprintf( pFile, ".inputs" );
766  Aig_ManForEachPiSeq( p, pObj, i )
767  if ( vPiNames )
768  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, i) );
769  else
770  fprintf( pFile, " n%0*d", nDigits, pObj->iData );
771  fprintf( pFile, "\n" );
772  // write POs
773  fprintf( pFile, ".outputs" );
774  Aig_ManForEachPoSeq( p, pObj, i )
775  if ( vPoNames )
776  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPoNames, i) );
777  else
778  fprintf( pFile, " n%0*d", nDigits, pObj->iData );
779  fprintf( pFile, "\n" );
780  // write latches
781  if ( Aig_ManRegNum(p) )
782  {
783  fprintf( pFile, "\n" );
784  Aig_ManForEachLiLoSeq( p, pObjLi, pObjLo, i )
785  {
786  fprintf( pFile, ".latch" );
787  if ( vPoNames )
788  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPoNames, Aig_ManCoNum(p)-Aig_ManRegNum(p)+i) );
789  else
790  fprintf( pFile, " n%0*d", nDigits, pObjLi->iData );
791  if ( vPiNames )
792  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, Aig_ManCiNum(p)-Aig_ManRegNum(p)+i) );
793  else
794  fprintf( pFile, " n%0*d", nDigits, pObjLo->iData );
795  fprintf( pFile, " 0\n" );
796  }
797  fprintf( pFile, "\n" );
798  }
799  // write nodes
800  if ( pConst1 )
801  fprintf( pFile, ".names n%0*d\n 1\n", nDigits, pConst1->iData );
802  Aig_ManSetCioIds( p );
803  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
804  {
805  fprintf( pFile, ".names" );
806  if ( vPiNames && Aig_ObjIsCi(Aig_ObjFanin0(pObj)) )
807  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, Aig_ObjCioId(Aig_ObjFanin0(pObj))) );
808  else
809  fprintf( pFile, " n%0*d", nDigits, Aig_ObjFanin0(pObj)->iData );
810  if ( vPiNames && Aig_ObjIsCi(Aig_ObjFanin1(pObj)) )
811  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, Aig_ObjCioId(Aig_ObjFanin1(pObj))) );
812  else
813  fprintf( pFile, " n%0*d", nDigits, Aig_ObjFanin1(pObj)->iData );
814  fprintf( pFile, " n%0*d\n", nDigits, pObj->iData );
815  fprintf( pFile, "%d%d 1\n", !Aig_ObjFaninC0(pObj), !Aig_ObjFaninC1(pObj) );
816  }
817  // write POs
818  Aig_ManForEachCo( p, pObj, i )
819  {
820  fprintf( pFile, ".names" );
821  if ( vPiNames && Aig_ObjIsCi(Aig_ObjFanin0(pObj)) )
822  fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, Aig_ObjCioId(Aig_ObjFanin0(pObj))) );
823  else
824  fprintf( pFile, " n%0*d", nDigits, Aig_ObjFanin0(pObj)->iData );
825  if ( vPoNames )
826  fprintf( pFile, " %s\n", (char*)Vec_PtrEntry(vPoNames, Aig_ObjCioId(pObj)) );
827  else
828  fprintf( pFile, " n%0*d\n", nDigits, pObj->iData );
829  fprintf( pFile, "%d 1\n", !Aig_ObjFaninC0(pObj) );
830  }
831  Aig_ManCleanCioIds( p );
832  fprintf( pFile, ".end\n\n" );
833  fclose( pFile );
834  Vec_PtrFree( vNodes );
835 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition: aigUtil.c:965
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
#define Aig_ManForEachCo(p, pObj, i)
Definition: aig.h:398
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
Definition: aig.h:450
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
static int Abc_Base10Log(unsigned n)
Definition: abc_global.h:252
if(last==0)
Definition: sparse_int.h:34
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
else
Definition: sparse_int.h:55
Vec_Ptr_t * Aig_ManDfs(Aig_Man_t *p, int fNodesOnly)
Definition: aigDfs.c:145
Definition: aig.h:69
static int Counter
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
int iData
Definition: aig.h:88
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Aig_ManForEachPoSeq(p, pObj, i)
Definition: aig.h:444
static int Aig_ObjIsCi(Aig_Obj_t *pObj)
Definition: aig.h:275
#define Aig_ManForEachPiSeq(p, pObj, i)
SEQUENTIAL ITERATORS ///.
Definition: aig.h:438
void Aig_ManCleanCioIds(Aig_Man_t *p)
Definition: aigUtil.c:986
static int Aig_ObjCioId(Aig_Obj_t *pObj)
Definition: aig.h:285
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
int collectSafetyInvariantPOIndex ( Abc_Ntk_t pNtk)

Definition at line 425 of file kliveness.c.

426 {
427  Abc_Obj_t *pObj;
428  int i;
429 
430  Abc_NtkForEachPo( pNtk, pObj, i )
431  {
432  if( strstr( Abc_ObjName( pObj ), "csSafetyInvar_" ) != NULL )
433  return i;
434  }
435 
436  return -1;
437 }
char * strstr()
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
Vec_Ptr_t* collectUserGivenDisjunctiveMonotoneSignals ( Abc_Ntk_t pNtk)

Definition at line 439 of file kliveness.c.

440 {
441  Abc_Obj_t *pObj;
442  int i;
443  Vec_Ptr_t *monotoneVector;
444  Vec_Int_t *newIntVector;
445 
446  monotoneVector = Vec_PtrAlloc(0);
447  Abc_NtkForEachPo( pNtk, pObj, i )
448  {
449  if( strstr( Abc_ObjName( pObj ), "csLevel1Stabil_" ) != NULL )
450  {
451  newIntVector = createSingletonIntVector(i);
452  Vec_PtrPush(monotoneVector, newIntVector);
453  }
454  }
455 
456  if( Vec_PtrSize(monotoneVector) > 0 )
457  return monotoneVector;
458  else
459  return NULL;
460 
461 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Vec_Int_t * createSingletonIntVector(int i)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
char * strstr()
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
Vec_Int_t* createSingletonIntVector ( int  i)

Definition at line 380 of file disjunctiveMonotone.c.

381 {
382  Vec_Int_t *myVec = Vec_IntAlloc(1);
383 
384  Vec_IntPush(myVec, iElem);
385  return myVec;
386 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
void deallocateMasterBarrierDisjunctInt ( Vec_Ptr_t vMasterBarrierDisjunctsArg)

Definition at line 463 of file kliveness.c.

464 {
465  Vec_Int_t *vInt;
466  int i;
467 
468  if(vMasterBarrierDisjunctsArg)
469  {
470  Vec_PtrForEachEntry(Vec_Int_t *, vMasterBarrierDisjunctsArg, vInt, i)
471  {
472  Vec_IntFree(vInt);
473  }
474  Vec_PtrFree(vMasterBarrierDisjunctsArg);
475  }
476 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void deallocateMasterBarrierDisjunctVecPtrVecInt ( Vec_Ptr_t vMasterBarrierDisjunctsArg)

Definition at line 478 of file kliveness.c.

479 {
480  Vec_Int_t *vInt;
481  Vec_Ptr_t *vPtr;
482  int i, j, k, iElem;
483 
484  if(vMasterBarrierDisjunctsArg)
485  {
486  Vec_PtrForEachEntry(Vec_Ptr_t *, vMasterBarrierDisjunctsArg, vPtr, i)
487  {
488  assert(vPtr);
489  Vec_PtrForEachEntry( Vec_Int_t *, vPtr, vInt, j )
490  {
491  //Vec_IntFree(vInt);
492  Vec_IntForEachEntry( vInt, iElem, k )
493  printf("%d - ", iElem);
494  //printf("Chung Chang j = %d\n", j);
495  }
496  Vec_PtrFree(vPtr);
497  }
498  Vec_PtrFree(vMasterBarrierDisjunctsArg);
499  }
500 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Vec_Ptr_t* findDisjunctiveMonotoneSignals ( Abc_Ntk_t pNtk)

Definition at line 596 of file disjunctiveMonotone.c.

597 {
598  Aig_Man_t *pAig;
599  Vec_Int_t *vCandidateMonotoneSignals;
600  Vec_Int_t *vKnownMonotoneSignals;
601  //Vec_Int_t *vKnownMonotoneSignalsRoundTwo;
602  //Vec_Int_t *vOldConsequentVector;
603  //Vec_Int_t *vRemainingConsecVector;
604  int i;
605  int iElem;
606  int pendingSignalIndex;
607  Abc_Ntk_t *pNtkTemp;
608  int hintSingalBeginningMarker;
609  int hintSingalEndMarker;
610  struct aigPoIndices *aigPoIndicesInstance;
611  //struct monotoneVectorsStruct *monotoneVectorsInstance;
612  struct antecedentConsequentVectorsStruct *anteConsecInstance;
613  //Aig_Obj_t *safetyDriverNew;
614  Vec_Int_t *newIntVec;
615  Vec_Ptr_t *levelOneMonotne, *levelTwoMonotne;
616  //Vec_Ptr_t *levelThreeMonotne;
617 
618  Vec_Ptr_t *vMasterDisjunctions;
619 
620  extern int findPendingSignal(Abc_Ntk_t *pNtk);
621  extern Vec_Int_t *findHintOutputs(Abc_Ntk_t *pNtk);
622  extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters );
623 
624  //system("rm monotone.dat");
625 
626  /*******************************************/
627  //Finding the PO index of the pending signal
628  /*******************************************/
629  pendingSignalIndex = findPendingSignal(pNtk);
630  if( pendingSignalIndex == -1 )
631  {
632  printf("\nNo Pending Signal Found\n");
633  return NULL;
634  }
635  //else
636  //printf("Po[%d] = %s\n", pendingSignalIndex, Abc_ObjName( Abc_NtkPo(pNtk, pendingSignalIndex) ) );
637 
638  /*******************************************/
639  //Finding the PO indices of all hint signals
640  /*******************************************/
641  vCandidateMonotoneSignals = findHintOutputs(pNtk);
642  if( vCandidateMonotoneSignals == NULL )
643  return NULL;
644  else
645  {
646  //Vec_IntForEachEntry( vCandidateMonotoneSignals, iElem, i )
647  // printf("Po[%d] = %s\n", iElem, Abc_ObjName( Abc_NtkPo(pNtk, iElem) ) );
648  hintSingalBeginningMarker = Vec_IntEntry( vCandidateMonotoneSignals, 0 );
649  hintSingalEndMarker = Vec_IntEntry( vCandidateMonotoneSignals, Vec_IntSize(vCandidateMonotoneSignals) - 1 );
650  }
651 
652  /**********************************************/
653  //Allocating "struct" with necessary parameters
654  /**********************************************/
655  aigPoIndicesInstance = allocAigPoIndices();
656  aigPoIndicesInstance->attrPendingSignalIndex = pendingSignalIndex;
657  aigPoIndicesInstance->attrHintSingalBeginningMarker = hintSingalBeginningMarker;
658  aigPoIndicesInstance->attrHintSingalEndMarker = hintSingalEndMarker;
659  aigPoIndicesInstance->attrSafetyInvarIndex = collectSafetyInvariantPOIndex(pNtk);
660 
661  /****************************************************/
662  //Allocating "struct" with necessary monotone vectors
663  /****************************************************/
664  anteConsecInstance = allocAntecedentConsequentVectorsStruct();
665  anteConsecInstance->attrAntecedents = NULL;
666  anteConsecInstance->attrConsequentCandidates = vCandidateMonotoneSignals;
667 
668  /*******************************************/
669  //Generate AIG from Ntk
670  /*******************************************/
671  if( !Abc_NtkIsStrash( pNtk ) )
672  {
673  pNtkTemp = Abc_NtkStrash( pNtk, 0, 0, 0 );
674  pAig = Abc_NtkToDar( pNtkTemp, 0, 1 );
675  }
676  else
677  {
678  pAig = Abc_NtkToDar( pNtk, 0, 1 );
679  pNtkTemp = pNtk;
680  }
681 
682  /*******************************************/
683  //finding LEVEL 1 monotone signals
684  /*******************************************/
685  //printf("Calling target function outside loop\n");
686  vKnownMonotoneSignals = findNewDisjunctiveMonotone( pAig, aigPoIndicesInstance, anteConsecInstance );
687  levelOneMonotne = Vec_PtrAlloc(0);
688  Vec_IntForEachEntry( vKnownMonotoneSignals, iElem, i )
689  {
690  newIntVec = createSingletonIntVector( iElem );
691  Vec_PtrPush( levelOneMonotne, newIntVec );
692  //printf("Monotone Po[%d] = %s\n", iElem, Abc_ObjName( Abc_NtkPo(pNtk, iElem) ) );
693  }
694  //printAllIntVectors( levelOneMonotne, pNtk, "monotone.dat" );
695 
696  vMasterDisjunctions = Vec_PtrAlloc( Vec_PtrSize( levelOneMonotne ));
697  appendVecToMasterVecInt(vMasterDisjunctions, levelOneMonotne );
698 
699  /*******************************************/
700  //finding LEVEL >1 monotone signals
701  /*******************************************/
702  #if 0
703  if( vKnownMonotoneSignals )
704  {
705  Vec_IntForEachEntry( vKnownMonotoneSignals, iElem, i )
706  {
707  printf("\n**************************************************************\n");
708  printf("Exploring Second Layer : Reference Po[%d] = %s", iElem, Abc_ObjName( Abc_NtkPo(pNtk, iElem) ));
709  printf("\n**************************************************************\n");
710  anteConsecInstance->attrAntecedents = createSingletonIntVector( iElem );
711  vOldConsequentVector = anteConsecInstance->attrConsequentCandidates;
712  vRemainingConsecVector = updateAnteConseVectors(anteConsecInstance);
713  if( anteConsecInstance->attrConsequentCandidates != vRemainingConsecVector )
714  {
715  anteConsecInstance->attrConsequentCandidates = vRemainingConsecVector;
716  }
717  vKnownMonotoneSignalsRoundTwo = findNewDisjunctiveMonotone( pAig, aigPoIndicesInstance, anteConsecInstance );
718  Vec_IntForEachEntry( vKnownMonotoneSignalsRoundTwo, iElemTwo, iTwo )
719  {
720  printf("Monotone Po[%d] = %s, (%d, %d)\n", iElemTwo, Abc_ObjName( Abc_NtkPo(pNtk, iElemTwo) ), iElem, iElemTwo );
721  }
722  Vec_IntFree(vKnownMonotoneSignalsRoundTwo);
723  Vec_IntFree(anteConsecInstance->attrAntecedents);
724  if(anteConsecInstance->attrConsequentCandidates != vOldConsequentVector)
725  {
726  Vec_IntFree(anteConsecInstance->attrConsequentCandidates);
727  anteConsecInstance->attrConsequentCandidates = vOldConsequentVector;
728  }
729  }
730  }
731  #endif
732 
733 #if 1
734  levelTwoMonotne = findNextLevelDisjunctiveMonotone( pAig, aigPoIndicesInstance, anteConsecInstance, levelOneMonotne );
735  //printAllIntVectors( levelTwoMonotne, pNtk, "monotone.dat" );
736  appendVecToMasterVecInt(vMasterDisjunctions, levelTwoMonotne );
737 #endif
738 
739  //levelThreeMonotne = findNextLevelDisjunctiveMonotone( pAig, aigPoIndicesInstance, anteConsecInstance, levelTwoMonotne );
740  //printAllIntVectors( levelThreeMonotne );
741  //printAllIntVectors( levelTwoMonotne, pNtk, "monotone.dat" );
742  //appendVecToMasterVecInt(vMasterDisjunctions, levelThreeMonotne );
743 
744  deallocAigPoIndices(aigPoIndicesInstance);
745  deallocAntecedentConsequentVectorsStruct(anteConsecInstance);
746  //deallocPointersToMonotoneVectors(monotoneVectorsInstance);
747 
748  deallocateVecOfIntVec( levelOneMonotne );
749  deallocateVecOfIntVec( levelTwoMonotne );
750 
751  Aig_ManStop(pAig);
752  Vec_IntFree(vKnownMonotoneSignals);
753 
754  return vMasterDisjunctions;
755 }
int findPendingSignal(Abc_Ntk_t *pNtk)
Definition: monotone.c:112
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void deallocateVecOfIntVec(Vec_Ptr_t *vecOfIntVec)
int collectSafetyInvariantPOIndex(Abc_Ntk_t *pNtk)
Definition: kliveness.c:425
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
struct antecedentConsequentVectorsStruct * allocAntecedentConsequentVectorsStruct()
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition: abcStrash.c:265
Vec_Ptr_t * findNextLevelDisjunctiveMonotone(Aig_Man_t *pAig, struct aigPoIndices *aigPoIndicesInstance, struct antecedentConsequentVectorsStruct *anteConsecInstance, Vec_Ptr_t *previousMonotoneVectors)
Vec_Int_t * updateAnteConseVectors(struct antecedentConsequentVectorsStruct *anteConse)
Vec_Int_t * createSingletonIntVector(int iElem)
struct aigPoIndices * allocAigPoIndices()
Definition: monotone.c:43
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
int attrHintSingalBeginningMarker
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
Definition: abcDar.c:233
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
void deallocAigPoIndices(struct aigPoIndices *toBeDeletedAigPoIndices)
Definition: monotone.c:57
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
void deallocAntecedentConsequentVectorsStruct(struct antecedentConsequentVectorsStruct *toBeDeleted)
void appendVecToMasterVecInt(Vec_Ptr_t *masterVec, Vec_Ptr_t *candVec)
Vec_Int_t * findHintOutputs(Abc_Ntk_t *pNtk)
Definition: monotone.c:90
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Vec_Int_t * findNewDisjunctiveMonotone(Aig_Man_t *pAig, struct aigPoIndices *aigPoIndicesArg, struct antecedentConsequentVectorsStruct *anteConseVectors)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
int flipConePdr ( Aig_Man_t pAig,
int  directive,
int  targetCSPropertyIndex,
int  safetyInvariantPOIndex,
int  absorberCount 
)

Definition at line 341 of file kliveness.c.

342 {
343  int RetValue, i;
344  Aig_Obj_t *pObjTargetPo;
345  Aig_Man_t *pAigDupl;
346  Pdr_Par_t Pars, * pPars = &Pars;
347  Abc_Cex_t * pCex = NULL;
348 
349  char *fileName;
350 
351  fileName = (char *)malloc(sizeof(char) * 50);
352  sprintf(fileName, "%s_%d.%s", "kLive", absorberCount, "blif" );
353 
355  {
356  assert( safetyInvariantPOIndex != -1 );
357  modifyAigToApplySafetyInvar(pAig, targetCSPropertyIndex, safetyInvariantPOIndex);
358  }
359 
360  pAigDupl = pAig;
361  pAig = Aig_ManDupSimple( pAigDupl );
362 
363  for( i=0; i<Saig_ManPoNum(pAig); i++ )
364  {
365  pObjTargetPo = Aig_ManCo( pAig, i );
366  Aig_ObjChild0Flip( pObjTargetPo );
367  }
368 
369  Pdr_ManSetDefaultParams( pPars );
370  pPars->fVerbose = 1;
371  pPars->fNotVerbose = 1;
372  pPars->fSolveAll = 1;
373  pAig->vSeqModelVec = NULL;
374 
375  Aig_ManCleanup( pAig );
376  assert( Aig_ManCheck( pAig ) );
377 
378  Pdr_ManSolve( pAig, pPars );
379 
380  if( pAig->vSeqModelVec )
381  {
382  pCex = (Abc_Cex_t *)Vec_PtrEntry( pAig->vSeqModelVec, targetCSPropertyIndex );
383  if( pCex == NULL )
384  {
385  RetValue = 1;
386  }
387  else
388  RetValue = 0;
389  }
390  else
391  {
392  RetValue = -1;
393  exit(0);
394  }
395 
396  free(fileName);
397 
398  for( i=0; i<Saig_ManPoNum(pAig); i++ )
399  {
400  pObjTargetPo = Aig_ManCo( pAig, i );
401  Aig_ObjChild0Flip( pObjTargetPo );
402  }
403 
404  Aig_ManStop( pAig );
405  return RetValue;
406 }
char * malloc()
VOID_HACK exit()
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
VOID_HACK free()
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
void Pdr_ManSetDefaultParams(Pdr_Par_t *pPars)
MACRO DEFINITIONS ///.
Definition: pdrCore.c:48
typedefABC_NAMESPACE_HEADER_START struct Pdr_Par_t_ Pdr_Par_t
INCLUDES ///.
Definition: pdr.h:40
#define kCS_WITH_SAFETY_AND_USER_GIVEN_DCS_INVARIANTS
Definition: kliveness.c:61
#define kCS_WITH_SAFETY_AND_DCS_INVARIANTS
Definition: kliveness.c:60
Definition: aig.h:69
char * sprintf()
static void Aig_ObjChild0Flip(Aig_Obj_t *pObj)
Definition: aig.h:316
#define kCS_WITH_SAFETY_INVARIANTS
Definition: kliveness.c:58
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
int Pdr_ManSolve(Aig_Man_t *p, Pdr_Par_t *pPars)
Definition: pdrCore.c:886
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
Aig_Man_t * Aig_ManDupSimple(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigDup.c:46
void modifyAigToApplySafetyInvar(Aig_Man_t *pAig, int csTarget, int safetyInvarPO)
Definition: kliveness.c:326
Aig_Man_t* generateDisjunctiveTester ( Abc_Ntk_t pNtk,
Aig_Man_t pAig,
int  combN,
int  combK 
)

Definition at line 148 of file combination.c.

149 {
150  //AIG creation related data structure
151  Aig_Man_t *pNewAig;
152  int piCopied = 0, loCopied = 0, loCreated = 0, liCopied = 0, liCreated = 0, poCopied = 0;
153  //int i, iElem, nRegCount, hintSingalBeginningMarker, hintSingalEndMarker;
154  int i, nRegCount, hintSingalBeginningMarker, hintSingalEndMarker;
155  int combN_internal, combK_internal; //, targetPoIndex;
156  long longI, lCombinationCount;
157  //Aig_Obj_t *pObj, *pObjMonoCand, *pObjLO_nCk, *pObjDisj_nCk;
158  Aig_Obj_t *pObj, *pObjLO_nCk, *pObjDisj_nCk;
159  Vec_Ptr_t *vLO_nCk, *vPODriver_nCk, *vDisj_nCk;
160  Vec_Int_t *vCandidateMonotoneSignals;
161 
162  extern Vec_Int_t *findHintOutputs(Abc_Ntk_t *pNtk);
163 
164  //Knuth's Data Strcuture
165  //Vec_Int_t *vC_KNUTH;
166  //int i_KNUTH, j_KNUTH, combCounter_KNUTH = 0;
167 
168  //Collecting target HINT signals
169  vCandidateMonotoneSignals = findHintOutputs(pNtk);
170  if( vCandidateMonotoneSignals == NULL )
171  {
172  printf("\nTraget Signal Set is Empty: Duplicating given AIG\n");
173  combN_internal = 0;
174  }
175  else
176  {
177  //Vec_IntForEachEntry( vCandidateMonotoneSignals, iElem, i )
178  // printf("Po[%d] = %s\n", iElem, Abc_ObjName( Abc_NtkPo(pNtk, iElem) ) );
179  hintSingalBeginningMarker = Vec_IntEntry( vCandidateMonotoneSignals, 0 );
180  hintSingalEndMarker = Vec_IntEntry( vCandidateMonotoneSignals, Vec_IntSize(vCandidateMonotoneSignals) - 1 );
181  combN_internal = hintSingalEndMarker - hintSingalBeginningMarker + 1;
182  }
183 
184  //combK_internal = combK;
185 
186  //Knuth's Data Structure Initialization
187  //vC_KNUTH = Vec_IntAlloc(combK_internal+3);
188  //for(i_KNUTH=-1; i_KNUTH<combK_internal; i_KNUTH++)
189  // Vec_IntPush( vC_KNUTH, i_KNUTH );
190  //Vec_IntPush( vC_KNUTH, combN_internal );
191  //Vec_IntPush( vC_KNUTH, 0 );
192 
193  //Standard AIG duplication begins
194  //Standard AIG Manager Creation
195  pNewAig = Aig_ManStart( Aig_ManObjNumMax(pAig) );
196  pNewAig->pName = (char *)malloc( strlen( pAig->pName ) + strlen("_nCk") + 1 );
197  sprintf(pNewAig->pName, "%s_%s", pAig->pName, "nCk");
198  pNewAig->pSpec = NULL;
199 
200  //Standard Mapping of Constant Nodes
201  pObj = Aig_ManConst1( pAig );
202  pObj->pData = Aig_ManConst1( pNewAig );
203 
204  //Standard AIG PI duplication
205  Saig_ManForEachPi( pAig, pObj, i )
206  {
207  piCopied++;
208  pObj->pData = Aig_ObjCreateCi(pNewAig);
209  }
210 
211  //Standard AIG LO duplication
212  Saig_ManForEachLo( pAig, pObj, i )
213  {
214  loCopied++;
215  pObj->pData = Aig_ObjCreateCi(pNewAig);
216  }
217 
218  //nCk LO creation
219  lCombinationCount = 0;
220  for(combK_internal=1; combK_internal<=combK; combK_internal++)
221  lCombinationCount += countCombination( combN_internal, combK_internal );
222  assert( lCombinationCount > 0 );
223  vLO_nCk = Vec_PtrAlloc(lCombinationCount);
224  for( longI = 0; longI < lCombinationCount; longI++ )
225  {
226  loCreated++;
227  pObj = Aig_ObjCreateCi(pNewAig);
228  Vec_PtrPush( vLO_nCk, pObj );
229  }
230 
231  //Standard Node duplication
232  Aig_ManForEachNode( pAig, pObj, i )
233  {
234  pObj->pData = Aig_And( pNewAig, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
235  }
236 
237  //nCk specific logic creation (i.e. nCk number of OR gates)
238  vDisj_nCk = Vec_PtrAlloc(lCombinationCount);
239 
240 
241 
242  //while(1)
243  //{
244  // //visit combination
245  // //printf("Comb-%3d : ", ++combCounter_KNUTH);
246  // pObjMonoCand = Aig_Not(Aig_ManConst1(pNewAig));
247  // for( i_KNUTH=combK_internal; i_KNUTH>0; i_KNUTH--)
248  // {
249  // //printf("vC[%d] = %d ", i_KNUTH, Vec_IntEntry(vC_KNUTH, i_KNUTH));
250  // targetPoIndex = Vec_IntEntry( vCandidateMonotoneSignals, Vec_IntEntry(vC_KNUTH, i_KNUTH));
251  // pObj = Aig_ObjChild0Copy(Aig_ManCo( pAig, targetPoIndex ));
252  // pObjMonoCand = Aig_Or( pNewAig, pObj, pObjMonoCand );
253  // }
254  // Vec_PtrPush(vDisj_nCk, pObjMonoCand );
255  // //printf("\n");
256 
257  // j_KNUTH = 1;
258  // while( Vec_IntEntry( vC_KNUTH, j_KNUTH ) + 1 == Vec_IntEntry( vC_KNUTH, j_KNUTH+1 ) )
259  // {
260  // Vec_IntWriteEntry( vC_KNUTH, j_KNUTH, j_KNUTH-1 );
261  // j_KNUTH = j_KNUTH + 1;
262  // }
263  // if( j_KNUTH > combK_internal ) break;
264  // Vec_IntWriteEntry( vC_KNUTH, j_KNUTH, Vec_IntEntry( vC_KNUTH, j_KNUTH ) + 1 );
265  //}
266  for( combK_internal=1; combK_internal<=combK; combK_internal++ )
267  generateCombinatorialStabil( pNewAig, pAig, vCandidateMonotoneSignals,
268  vDisj_nCk, combN_internal, combK_internal );
269 
270 
271  //creation of implication logic
272  vPODriver_nCk = Vec_PtrAlloc(lCombinationCount);
273  for( longI = 0; longI < lCombinationCount; longI++ )
274  {
275  pObjLO_nCk = (Aig_Obj_t *)(Vec_PtrEntry( vLO_nCk, longI ));
276  pObjDisj_nCk = (Aig_Obj_t *)(Vec_PtrEntry( vDisj_nCk, longI ));
277 
278  pObj = Aig_Or( pNewAig, Aig_Not(pObjDisj_nCk), pObjLO_nCk);
279  Vec_PtrPush(vPODriver_nCk, pObj);
280  }
281 
282  //Standard PO duplication
283  Saig_ManForEachPo( pAig, pObj, i )
284  {
285  poCopied++;
286  pObj->pData = Aig_ObjCreateCo( pNewAig, Aig_ObjChild0Copy(pObj) );
287  }
288 
289  //nCk specific PO creation
290  for( longI = 0; longI < lCombinationCount; longI++ )
291  {
292  Aig_ObjCreateCo( pNewAig, (Aig_Obj_t *)(Vec_PtrEntry( vPODriver_nCk, longI )) );
293  }
294 
295  //Standard LI duplication
296  Saig_ManForEachLi( pAig, pObj, i )
297  {
298  liCopied++;
299  Aig_ObjCreateCo( pNewAig, Aig_ObjChild0Copy(pObj) );
300  }
301 
302  //nCk specific LI creation
303  for( longI = 0; longI < lCombinationCount; longI++ )
304  {
305  liCreated++;
306  Aig_ObjCreateCo( pNewAig, (Aig_Obj_t *)(Vec_PtrEntry( vPODriver_nCk, longI )) );
307  }
308 
309  //clean-up, book-keeping
310  assert( liCopied + liCreated == loCopied + loCreated );
311  nRegCount = loCopied + loCreated;
312 
313  Aig_ManSetRegNum( pNewAig, nRegCount );
314  Aig_ManCleanup( pNewAig );
315  assert( Aig_ManCheck( pNewAig ) );
316 
317  //Vec_IntFree(vC_KNUTH);
318  return pNewAig;
319 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
char * malloc()
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
ABC_NAMESPACE_IMPL_START long countCombination(long n, long k)
Definition: combination.c:12
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:259
Definition: aig.h:69
char * sprintf()
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
int generateCombinatorialStabil(Aig_Man_t *pAigNew, Aig_Man_t *pAigOld, Vec_Int_t *vCandidateMonotoneSignals_, Vec_Ptr_t *vDisj_nCk_, int combN, int combK)
Definition: combination.c:54
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
int strlen()
Vec_Int_t * findHintOutputs(Abc_Ntk_t *pNtk)
Definition: monotone.c:90
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
Aig_Man_t* generateGeneralDisjunctiveTester ( Abc_Ntk_t pNtk,
Aig_Man_t pAig,
int  combK 
)

Definition at line 321 of file combination.c.

322 {
323  //AIG creation related data structure
324  Aig_Man_t *pNewAig;
325  int piCopied = 0, loCopied = 0, loCreated = 0, liCopied = 0, liCreated = 0, poCopied = 0;
326  //int i, iElem, nRegCount, hintSingalBeginningMarker, hintSingalEndMarker;
327  int i, nRegCount;
328  int combN_internal, combK_internal; //, targetPoIndex;
329  long longI, lCombinationCount;
330  //Aig_Obj_t *pObj, *pObjMonoCand, *pObjLO_nCk, *pObjDisj_nCk;
331  Aig_Obj_t *pObj, *pObjLO_nCk, *pObjDisj_nCk;
332  Vec_Ptr_t *vLO_nCk, *vPODriver_nCk, *vDisj_nCk;
333 
334  extern Vec_Int_t *findHintOutputs(Abc_Ntk_t *pNtk);
335 
336  //Knuth's Data Strcuture
337  //Vec_Int_t *vC_KNUTH;
338  //int i_KNUTH, j_KNUTH, combCounter_KNUTH = 0;
339 
340  //Collecting target HINT signals
341  //vCandidateMonotoneSignals = findHintOutputs(pNtk);
342  //if( vCandidateMonotoneSignals == NULL )
343  //{
344  // printf("\nTraget Signal Set is Empty: Duplicating given AIG\n");
345  // combN_internal = 0;
346  //}
347  //else
348  //{
349  //Vec_IntForEachEntry( vCandidateMonotoneSignals, iElem, i )
350  // printf("Po[%d] = %s\n", iElem, Abc_ObjName( Abc_NtkPo(pNtk, iElem) ) );
351  // hintSingalBeginningMarker = Vec_IntEntry( vCandidateMonotoneSignals, 0 );
352  // hintSingalEndMarker = Vec_IntEntry( vCandidateMonotoneSignals, Vec_IntSize(vCandidateMonotoneSignals) - 1 );
353  // combN_internal = hintSingalEndMarker - hintSingalBeginningMarker + 1;
354  //}
355 
356  combN_internal = Aig_ManRegNum(pAig);
357 
358  pNewAig = Aig_ManStart( Aig_ManObjNumMax(pAig) );
359  pNewAig->pName = (char *)malloc( strlen( pAig->pName ) + strlen("_nCk") + 1 );
360  sprintf(pNewAig->pName, "%s_%s", pAig->pName, "nCk");
361  pNewAig->pSpec = NULL;
362 
363  //Standard Mapping of Constant Nodes
364  pObj = Aig_ManConst1( pAig );
365  pObj->pData = Aig_ManConst1( pNewAig );
366 
367  //Standard AIG PI duplication
368  Saig_ManForEachPi( pAig, pObj, i )
369  {
370  piCopied++;
371  pObj->pData = Aig_ObjCreateCi(pNewAig);
372  }
373 
374  //Standard AIG LO duplication
375  Saig_ManForEachLo( pAig, pObj, i )
376  {
377  loCopied++;
378  pObj->pData = Aig_ObjCreateCi(pNewAig);
379  }
380 
381  //nCk LO creation
382  lCombinationCount = 0;
383  for(combK_internal=1; combK_internal<=combK; combK_internal++)
384  lCombinationCount += countCombination( combN_internal, combK_internal );
385  assert( lCombinationCount > 0 );
386  vLO_nCk = Vec_PtrAlloc(lCombinationCount);
387  for( longI = 0; longI < lCombinationCount; longI++ )
388  {
389  loCreated++;
390  pObj = Aig_ObjCreateCi(pNewAig);
391  Vec_PtrPush( vLO_nCk, pObj );
392  }
393 
394  //Standard Node duplication
395  Aig_ManForEachNode( pAig, pObj, i )
396  {
397  pObj->pData = Aig_And( pNewAig, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
398  }
399 
400  //nCk specific logic creation (i.e. nCk number of OR gates)
401  vDisj_nCk = Vec_PtrAlloc(lCombinationCount);
402 
403  for( combK_internal=1; combK_internal<=combK; combK_internal++ )
404  {
405  generateCombinatorialStabilExhaust( pNewAig, pAig,
406  vDisj_nCk, combN_internal, combK_internal );
407  }
408 
409 
410  //creation of implication logic
411  vPODriver_nCk = Vec_PtrAlloc(lCombinationCount);
412  for( longI = 0; longI < lCombinationCount; longI++ )
413  {
414  pObjLO_nCk = (Aig_Obj_t *)(Vec_PtrEntry( vLO_nCk, longI ));
415  pObjDisj_nCk = (Aig_Obj_t *)(Vec_PtrEntry( vDisj_nCk, longI ));
416 
417  pObj = Aig_Or( pNewAig, Aig_Not(pObjDisj_nCk), pObjLO_nCk);
418  Vec_PtrPush(vPODriver_nCk, pObj);
419  }
420 
421  //Standard PO duplication
422  Saig_ManForEachPo( pAig, pObj, i )
423  {
424  poCopied++;
425  pObj->pData = Aig_ObjCreateCo( pNewAig, Aig_ObjChild0Copy(pObj) );
426  }
427 
428  //nCk specific PO creation
429  for( longI = 0; longI < lCombinationCount; longI++ )
430  {
431  Aig_ObjCreateCo( pNewAig, (Aig_Obj_t *)(Vec_PtrEntry( vPODriver_nCk, longI )) );
432  }
433 
434  //Standard LI duplication
435  Saig_ManForEachLi( pAig, pObj, i )
436  {
437  liCopied++;
438  Aig_ObjCreateCo( pNewAig, Aig_ObjChild0Copy(pObj) );
439  }
440 
441  //nCk specific LI creation
442  for( longI = 0; longI < lCombinationCount; longI++ )
443  {
444  liCreated++;
445  Aig_ObjCreateCo( pNewAig, (Aig_Obj_t *)(Vec_PtrEntry( vPODriver_nCk, longI )) );
446  }
447 
448  //clean-up, book-keeping
449  assert( liCopied + liCreated == loCopied + loCreated );
450  nRegCount = loCopied + loCreated;
451 
452  Aig_ManSetRegNum( pNewAig, nRegCount );
453  Aig_ManCleanup( pNewAig );
454  assert( Aig_ManCheck( pNewAig ) );
455 
456  Vec_PtrFree(vLO_nCk);
457  Vec_PtrFree(vPODriver_nCk);
458  Vec_PtrFree(vDisj_nCk);
459  //Vec_IntFree(vC_KNUTH);
460  return pNewAig;
461 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
char * malloc()
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
ABC_NAMESPACE_IMPL_START long countCombination(long n, long k)
Definition: combination.c:12
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:259
Definition: aig.h:69
char * sprintf()
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
int strlen()
Vec_Int_t * findHintOutputs(Abc_Ntk_t *pNtk)
Definition: monotone.c:90
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
int generateCombinatorialStabilExhaust(Aig_Man_t *pAigNew, Aig_Man_t *pAigOld, Vec_Ptr_t *vDisj_nCk_, int combN, int combK)
Definition: combination.c:101
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
Aig_Man_t* generateWorkingAig ( Aig_Man_t pAig,
Abc_Ntk_t pNtk,
int *  pIndex0Live 
)

Definition at line 163 of file kLiveConstraints.c.

164 {
165  Vec_Ptr_t *vSignalVector;
166  Aig_Man_t *pAigNew;
167 
168  vSignalVector = collectCSSignals( pNtk, pAig );
169  assert(vSignalVector);
170  pAigNew = createNewAigWith0LivePo( pAig, vSignalVector, pIndex0Live );
171  Vec_PtrFree(vSignalVector);
172 
173  return pAigNew;
174 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
Aig_Man_t * createNewAigWith0LivePo(Aig_Man_t *pAig, Vec_Ptr_t *signalList, int *index0Live)
Vec_Ptr_t * collectCSSignals(Abc_Ntk_t *pNtk, Aig_Man_t *pAig)
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Aig_Man_t* generateWorkingAigWithDSC ( Aig_Man_t pAig,
Abc_Ntk_t pNtk,
int *  pIndex0Live,
Vec_Ptr_t vMasterBarriers 
)

Definition at line 529 of file arenaViolation.c.

530 {
531  Vec_Ptr_t *vSignalVector;
532  Aig_Man_t *pAigNew;
533  int pObjWithinWindow;
534  int pObjWindowBegin;
535  int pObjPendingSignal;
536 
537  vSignalVector = collectCSSignalsWithDSC( pNtk, pAig );
538 
539  pObjWindowBegin = collectWindowBeginSignalWithDSC( pNtk, pAig );
540  pObjWithinWindow = collectWithinWindowSignalWithDSC( pNtk, pAig );
541  pObjPendingSignal = collectPendingSignalWithDSC( pNtk, pAig );
542 
543  pAigNew = createNewAigWith0LivePoWithDSC( pAig, vSignalVector, pIndex0Live, pObjWindowBegin, pObjWithinWindow, pObjPendingSignal, vMasterBarriers );
544  Vec_PtrFree(vSignalVector);
545 
546  return pAigNew;
547 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
Vec_Ptr_t * collectCSSignalsWithDSC(Abc_Ntk_t *pNtk, Aig_Man_t *pAig)
int collectPendingSignalWithDSC(Abc_Ntk_t *pNtk, Aig_Man_t *pAig)
int collectWithinWindowSignalWithDSC(Abc_Ntk_t *pNtk, Aig_Man_t *pAig)
int collectWindowBeginSignalWithDSC(Abc_Ntk_t *pNtk, Aig_Man_t *pAig)
Aig_Man_t * createNewAigWith0LivePoWithDSC(Aig_Man_t *pAig, Vec_Ptr_t *signalList, int *index0Live, int windowBeginIndex, int withinWindowIndex, int pendingSignalIndex, Vec_Ptr_t *vBarriers)
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Vec_Ptr_t* getVecOfVecFairness ( FILE *  fp)

Definition at line 502 of file kliveness.c.

503 {
504  Vec_Ptr_t *masterVector = Vec_PtrAlloc(0);
505  //Vec_Ptr_t *currSignalVector;
506  char stringBuffer[100];
507  //int i;
508 
509  while(fgets(stringBuffer, 50, fp))
510  {
511  if(strstr(stringBuffer, ":"))
512  {
513 
514  }
515  else
516  {
517 
518  }
519  }
520 
521  return masterVector;
522 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
char * strstr()
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Aig_Man_t* introduceAbsorberLogic ( Aig_Man_t pAig,
int *  pLiveIndex_0,
int *  pLiveIndex_k,
int  nonFirstIteration 
)

Definition at line 175 of file kliveness.c.

176 {
177  Aig_Man_t *pNewAig;
178  Aig_Obj_t *pObj, *pObjAbsorberLo, *pPInNewArg, *pPOutNewArg;
179  Aig_Obj_t *pPIn = NULL, *pPOut = NULL, *pPOutCo = NULL;
180  Aig_Obj_t *pFirstAbsorberOr, *pSecondAbsorberOr;
181  int i;
182  int piCopied = 0, loCreated = 0, loCopied = 0, liCreated = 0, liCopied = 0;
183  int nRegCount;
184 
185  assert(*pLiveIndex_0 != -1);
186  if(nonFirstIteration == 0)
187  assert( *pLiveIndex_k == -1 );
188  else
189  assert( *pLiveIndex_k != -1 );
190 
191  //****************************************************************
192  // Step1: create the new manager
193  // Note: The new manager is created with "2 * Aig_ManObjNumMax(p)"
194  // nodes, but this selection is arbitrary - need to be justified
195  //****************************************************************
196  pNewAig = Aig_ManStart( Aig_ManObjNumMax(pAig) );
197  pNewAig->pName = (char *)malloc( strlen( pAig->pName ) + strlen("_kCS") + 1 );
198  sprintf(pNewAig->pName, "%s_%s", pAig->pName, "kCS");
199  pNewAig->pSpec = NULL;
200 
201  //****************************************************************
202  // reading the signal pIn, and pOut
203  //****************************************************************
204 
205  pPIn = readLiveSignal_0( pAig, *pLiveIndex_0 );
206  if( *pLiveIndex_k == -1 )
207  pPOut = NULL;
208  else
209  pPOut = readLiveSignal_k( pAig, *pLiveIndex_k );
210 
211  //****************************************************************
212  // Step 2: map constant nodes
213  //****************************************************************
214  pObj = Aig_ManConst1( pAig );
215  pObj->pData = Aig_ManConst1( pNewAig );
216 
217  //****************************************************************
218  // Step 3: create true PIs
219  //****************************************************************
220  Saig_ManForEachPi( pAig, pObj, i )
221  {
222  piCopied++;
223  pObj->pData = Aig_ObjCreateCi(pNewAig);
224  }
225 
226  //****************************************************************
227  // Step 5: create register outputs
228  //****************************************************************
229  Saig_ManForEachLo( pAig, pObj, i )
230  {
231  loCopied++;
232  pObj->pData = Aig_ObjCreateCi(pNewAig);
233  }
234 
235  //****************************************************************
236  // Step 6: create "D" register output for the ABSORBER logic
237  //****************************************************************
238  loCreated++;
239  pObjAbsorberLo = Aig_ObjCreateCi( pNewAig );
240 
241  nRegCount = loCreated + loCopied;
242 
243  //********************************************************************
244  // Step 7: create internal nodes
245  //********************************************************************
246  Aig_ManForEachNode( pAig, pObj, i )
247  {
248  pObj->pData = Aig_And( pNewAig, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
249  }
250 
251  //****************************************************************
252  // Step 8: create the two OR gates of the OBSERVER logic
253  //****************************************************************
254  if( nonFirstIteration == 0 )
255  {
256  assert(pPIn);
257 
258  pPInNewArg = !Aig_IsComplement(pPIn)?
259  (Aig_Obj_t *)((Aig_Regular(pPIn))->pData) :
260  Aig_Not((Aig_Obj_t *)((Aig_Regular(pPIn))->pData));
261 
262  pFirstAbsorberOr = Aig_Or( pNewAig, Aig_Not(pPInNewArg), pObjAbsorberLo );
263  pSecondAbsorberOr = Aig_Or( pNewAig, pPInNewArg, Aig_Not(pObjAbsorberLo) );
264  }
265  else
266  {
267  assert( pPOut );
268 
269  pPInNewArg = !Aig_IsComplement(pPIn)?
270  (Aig_Obj_t *)((Aig_Regular(pPIn))->pData) :
271  Aig_Not((Aig_Obj_t *)((Aig_Regular(pPIn))->pData));
272  pPOutNewArg = !Aig_IsComplement(pPOut)?
273  (Aig_Obj_t *)((Aig_Regular(pPOut))->pData) :
274  Aig_Not((Aig_Obj_t *)((Aig_Regular(pPOut))->pData));
275 
276  pFirstAbsorberOr = Aig_Or( pNewAig, Aig_Not(pPOutNewArg), pObjAbsorberLo );
277  pSecondAbsorberOr = Aig_Or( pNewAig, pPInNewArg, Aig_Not(pObjAbsorberLo) );
278  }
279 
280  //********************************************************************
281  // Step 9: create primary outputs
282  //********************************************************************
283  Saig_ManForEachPo( pAig, pObj, i )
284  {
285  pObj->pData = Aig_ObjCreateCo( pNewAig, Aig_ObjChild0Copy(pObj) );
286  if( i == *pLiveIndex_k )
287  pPOutCo = (Aig_Obj_t *)(pObj->pData);
288  }
289 
290  //create new po
291  if( nonFirstIteration == 0 )
292  {
293  assert(pPOutCo == NULL);
294  pPOutCo = Aig_ObjCreateCo( pNewAig, pSecondAbsorberOr );
295 
296  *pLiveIndex_k = i;
297  }
298  else
299  {
300  assert( pPOutCo != NULL );
301  //pPOutCo = Aig_ObjCreateCo( pNewAig, pSecondAbsorberOr );
302  //*pLiveIndex_k = Saig_ManPoNum(pAig);
303 
304  Aig_ObjPatchFanin0( pNewAig, pPOutCo, pSecondAbsorberOr );
305  }
306 
307  Saig_ManForEachLi( pAig, pObj, i )
308  {
309  liCopied++;
310  Aig_ObjCreateCo( pNewAig, Aig_ObjChild0Copy(pObj) );
311  }
312 
313  //create new li
314  liCreated++;
315  Aig_ObjCreateCo( pNewAig, pFirstAbsorberOr );
316 
317  Aig_ManSetRegNum( pNewAig, nRegCount );
318  Aig_ManCleanup( pNewAig );
319 
320  assert( Aig_ManCheck( pNewAig ) );
321 
322  assert( *pLiveIndex_k != - 1);
323  return pNewAig;
324 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
char * malloc()
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void * pData
Definition: aig.h:87
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
Aig_Obj_t * readLiveSignal_0(Aig_Man_t *pAig, int liveIndex_0)
Definition: kliveness.c:83
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
void Aig_ObjPatchFanin0(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFaninNew)
Definition: aigObj.c:282
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:259
Definition: aig.h:69
char * sprintf()
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
Aig_Obj_t * readLiveSignal_k(Aig_Man_t *pAig, int liveIndex_k)
Definition: kliveness.c:91
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
int strlen()
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
void modifyAigToApplySafetyInvar ( Aig_Man_t pAig,
int  csTarget,
int  safetyInvarPO 
)

Definition at line 326 of file kliveness.c.

327 {
328  Aig_Obj_t *pObjPOSafetyInvar, *pObjSafetyInvar;
329  Aig_Obj_t *pObjPOCSTarget, *pObjCSTarget;
330  Aig_Obj_t *pObjCSTargetNew;
331 
332  pObjPOSafetyInvar = Aig_ManCo( pAig, safetyInvarPO );
333  pObjSafetyInvar = Aig_NotCond((Aig_Obj_t *)Aig_ObjFanin0(pObjPOSafetyInvar), Aig_ObjFaninC0(pObjPOSafetyInvar));
334  pObjPOCSTarget = Aig_ManCo( pAig, csTarget );
335  pObjCSTarget = Aig_NotCond((Aig_Obj_t *)Aig_ObjFanin0(pObjPOCSTarget), Aig_ObjFaninC0(pObjPOCSTarget));
336 
337  pObjCSTargetNew = Aig_And( pAig, pObjSafetyInvar, pObjCSTarget );
338  Aig_ObjPatchFanin0( pAig, pObjPOCSTarget, pObjCSTargetNew );
339 }
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
void Aig_ObjPatchFanin0(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFaninNew)
Definition: aigObj.c:282
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
Aig_Obj_t* readLiveSignal_0 ( Aig_Man_t pAig,
int  liveIndex_0 
)

Definition at line 83 of file kliveness.c.

84 {
85  Aig_Obj_t *pObj;
86 
87  pObj = Aig_ManCo( pAig, liveIndex_0 );
88  return Aig_NotCond((Aig_Obj_t *)Aig_ObjFanin0(pObj), Aig_ObjFaninC0(pObj));
89 }
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
Aig_Obj_t* readLiveSignal_k ( Aig_Man_t pAig,
int  liveIndex_k 
)

Definition at line 91 of file kliveness.c.

92 {
93  Aig_Obj_t *pObj;
94 
95  pObj = Aig_ManCo( pAig, liveIndex_k );
96  return Aig_NotCond((Aig_Obj_t *)Aig_ObjFanin0(pObj), Aig_ObjFaninC0(pObj));
97 }
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248