ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
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>
Include dependency graph for kliveness.c:

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_tAbc_NtkToDar (Abc_Ntk_t *pNtk, int fExors, int fRegisters)
 DECLARATIONS ///.
 
Abc_Ntk_tAbc_NtkFromAigPhase (Aig_Man_t *pMan)
 DECLARATIONS ///.
 
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

◆ kCS_WITH_DISCOVER_MONOTONE_SIGNALS

#define kCS_WITH_DISCOVER_MONOTONE_SIGNALS   2

Definition at line 59 of file kliveness.c.

◆ kCS_WITH_SAFETY_AND_DCS_INVARIANTS

#define kCS_WITH_SAFETY_AND_DCS_INVARIANTS   3

Definition at line 60 of file kliveness.c.

◆ kCS_WITH_SAFETY_AND_USER_GIVEN_DCS_INVARIANTS

#define kCS_WITH_SAFETY_AND_USER_GIVEN_DCS_INVARIANTS   4

Definition at line 61 of file kliveness.c.

◆ kCS_WITH_SAFETY_INVARIANTS

#define kCS_WITH_SAFETY_INVARIANTS   1

Definition at line 58 of file kliveness.c.

◆ SIMPLE_kCS

#define SIMPLE_kCS   0

Definition at line 57 of file kliveness.c.

Function Documentation

◆ Abc_CommandCS_kLiveness()

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
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
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}
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition abcStrash.c:265
ABC_INT64_T abctime
Definition abc_global.h:332
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition mainFrame.c:327
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
ABC_DLL void Extra_UtilGetoptReset()
Aig_Man_t * generateWorkingAig(Aig_Man_t *pAig, Abc_Ntk_t *pNtk, int *pIndex0Live)
int collectSafetyInvariantPOIndex(Abc_Ntk_t *pNtk)
Definition kliveness.c:425
#define SIMPLE_kCS
Definition kliveness.c:57
ABC_NAMESPACE_IMPL_START Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
DECLARATIONS ///.
Definition abcDar.c:237
int flipConePdr(Aig_Man_t *pAig, int directive, int targetCSPropertyIndex, int safetyInvariantPOIndex, int absorberCount)
Definition kliveness.c:341
#define kCS_WITH_SAFETY_AND_USER_GIVEN_DCS_INVARIANTS
Definition kliveness.c:61
Vec_Ptr_t * findDisjunctiveMonotoneSignals(Abc_Ntk_t *pNtk)
Vec_Ptr_t * collectUserGivenDisjunctiveMonotoneSignals(Abc_Ntk_t *pNtk)
Definition kliveness.c:439
#define kCS_WITH_SAFETY_AND_DCS_INVARIANTS
Definition kliveness.c:60
Aig_Man_t * introduceAbsorberLogic(Aig_Man_t *pAig, int *pLiveIndex_0, int *pLiveIndex_k, int nonFirstIteration)
Definition kliveness.c:175
#define kCS_WITH_DISCOVER_MONOTONE_SIGNALS
Definition kliveness.c:59
Aig_Man_t * generateWorkingAigWithDSC(Aig_Man_t *pAig, Abc_Ntk_t *pNtk, int *pIndex0Live, Vec_Ptr_t *vMasterBarriers)
#define kCS_WITH_SAFETY_INVARIANTS
Definition kliveness.c:58
void deallocateMasterBarrierDisjunctInt(Vec_Ptr_t *vMasterBarrierDisjunctsArg)
Definition kliveness.c:463
usage()
Definition main.c:626
#define assert(ex)
Definition util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_CommandNChooseK()

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_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition abcCheck.c:64
void Aig_ManPrintStats(Aig_Man_t *p)
Definition aigMan.c:379
ABC_DLL void Abc_FrameSetCurrentNetwork(Abc_Frame_t *p, Abc_Ntk_t *pNet)
Definition mainFrame.c:441
Aig_Man_t * generateGeneralDisjunctiveTester(Abc_Ntk_t *pNtk, Aig_Man_t *pAig, int combK)
Abc_Ntk_t * Abc_NtkFromAigPhase(Aig_Man_t *pMan)
DECLARATIONS ///.
Definition abcDar.c:595
char * pName
Definition abc.h:158
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkFromAigPhase()

Abc_Ntk_t * Abc_NtkFromAigPhase ( Aig_Man_t * pMan)
extern

DECLARATIONS ///.

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 595 of file abcDar.c.

596{
597 Vec_Ptr_t * vNodes;
598 Abc_Ntk_t * pNtkNew;
599 Abc_Obj_t * pObjNew;
600 Aig_Obj_t * pObj, * pObjLo, * pObjLi;
601 int i;
602 assert( pMan->nAsserts == 0 );
603 // perform strashing
605 pNtkNew->nConstrs = pMan->nConstrs;
606 pNtkNew->nBarBufs = pMan->nBarBufs;
607 // duplicate the name and the spec
608// pNtkNew->pName = Extra_UtilStrsav(pMan->pName);
609// pNtkNew->pSpec = Extra_UtilStrsav(pMan->pSpec);
610 Aig_ManConst1(pMan)->pData = Abc_AigConst1(pNtkNew);
611 // create PIs
612 Aig_ManForEachPiSeq( pMan, pObj, i )
613 {
614 pObjNew = Abc_NtkCreatePi( pNtkNew );
615// Abc_ObjAssignName( pObjNew, Abc_ObjName(pObjNew), NULL );
616 pObj->pData = pObjNew;
617 }
618 // create POs
619 Aig_ManForEachPoSeq( pMan, pObj, i )
620 {
621 pObjNew = Abc_NtkCreatePo( pNtkNew );
622// Abc_ObjAssignName( pObjNew, Abc_ObjName(pObjNew), NULL );
623 pObj->pData = pObjNew;
624 }
625 assert( Abc_NtkCiNum(pNtkNew) == Aig_ManCiNum(pMan) - Aig_ManRegNum(pMan) );
626 assert( Abc_NtkCoNum(pNtkNew) == Aig_ManCoNum(pMan) - Aig_ManRegNum(pMan) );
627 // create as many latches as there are registers in the manager
628 Aig_ManForEachLiLoSeq( pMan, pObjLi, pObjLo, i )
629 {
630 pObjNew = Abc_NtkCreateLatch( pNtkNew );
631 pObjLi->pData = Abc_NtkCreateBi( pNtkNew );
632 pObjLo->pData = Abc_NtkCreateBo( pNtkNew );
633 Abc_ObjAddFanin( pObjNew, (Abc_Obj_t *)pObjLi->pData );
634 Abc_ObjAddFanin( (Abc_Obj_t *)pObjLo->pData, pObjNew );
635 Abc_LatchSetInit0( pObjNew );
636// Abc_ObjAssignName( (Abc_Obj_t *)pObjLi->pData, Abc_ObjName((Abc_Obj_t *)pObjLi->pData), NULL );
637// Abc_ObjAssignName( (Abc_Obj_t *)pObjLo->pData, Abc_ObjName((Abc_Obj_t *)pObjLo->pData), NULL );
638 }
639 // rebuild the AIG
640 vNodes = Aig_ManDfs( pMan, 1 );
641 Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
642 if ( Aig_ObjIsBuf(pObj) )
643 pObj->pData = (Abc_Obj_t *)Aig_ObjChild0Copy(pObj);
644 else
645 pObj->pData = Abc_AigAnd( (Abc_Aig_t *)pNtkNew->pManFunc, (Abc_Obj_t *)Aig_ObjChild0Copy(pObj), (Abc_Obj_t *)Aig_ObjChild1Copy(pObj) );
646 Vec_PtrFree( vNodes );
647 // connect the PO nodes
648 Aig_ManForEachCo( pMan, pObj, i )
649 {
650 pObjNew = (Abc_Obj_t *)Aig_ObjChild0Copy(pObj);
651 Abc_ObjAddFanin( Abc_NtkCo(pNtkNew, i), pObjNew );
652 }
653
654 Abc_NtkAddDummyPiNames( pNtkNew );
655 Abc_NtkAddDummyPoNames( pNtkNew );
656 Abc_NtkAddDummyBoxNames( pNtkNew );
657
658 // check the resulting AIG
659 if ( !Abc_NtkCheck( pNtkNew ) )
660 Abc_Print( 1, "Abc_NtkFromAigPhase(): Network check has failed.\n" );
661 return pNtkNew;
662}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition abcNtk.c:53
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition abcFanio.c:84
ABC_DLL void Abc_NtkAddDummyBoxNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:547
struct Abc_Aig_t_ Abc_Aig_t
Definition abc.h:117
@ ABC_NTK_STRASH
Definition abc.h:58
ABC_DLL void Abc_NtkAddDummyPoNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:521
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition abcAig.c:700
@ ABC_FUNC_AIG
Definition abc.h:67
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition abcAig.c:683
ABC_DLL void Abc_NtkAddDummyPiNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:495
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
#define Aig_ManForEachPiSeq(p, pObj, i)
SEQUENTIAL ITERATORS ///.
Definition aig.h:438
#define Aig_ManForEachCo(p, pObj, i)
Definition aig.h:398
Vec_Ptr_t * Aig_ManDfs(Aig_Man_t *p, int fNodesOnly)
Definition aigDfs.c:145
#define Aig_ManForEachPoSeq(p, pObj, i)
Definition aig.h:444
#define Aig_ManForEachLiLoSeq(p, pObjLi, pObjLo, k)
Definition aig.h:450
int nBarBufs
Definition abc.h:174
int nConstrs
Definition abc.h:173
void * pManFunc
Definition abc.h:191
void * pData
Definition aig.h:87
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the caller graph for this function:

◆ Abc_NtkMakeOnePo()

Abc_Ntk_t * Abc_NtkMakeOnePo ( Abc_Ntk_t * pNtkInit,
int Output,
int nRange )
extern

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

Synopsis [Removes all POs, except one.]

Description []

SideEffects []

SeeAlso []

Definition at line 1857 of file abcNtk.c.

1858{
1859 Abc_Ntk_t * pNtk;
1860 Vec_Ptr_t * vPosLeft;
1861 Vec_Ptr_t * vCosLeft;
1862 Abc_Obj_t * pNodePo;
1863 int i;
1864 assert( !Abc_NtkIsNetlist(pNtkInit) );
1865 assert( Abc_NtkHasOnlyLatchBoxes(pNtkInit) );
1866 if ( Output < 0 || Output >= Abc_NtkPoNum(pNtkInit) )
1867 {
1868 printf( "PO index is incorrect.\n" );
1869 return NULL;
1870 }
1871
1872 pNtk = Abc_NtkDup( pNtkInit );
1873 if ( Abc_NtkPoNum(pNtk) == 1 )
1874 return pNtk;
1875
1876 if ( nRange < 1 )
1877 nRange = 1;
1878
1879 // filter POs
1880 vPosLeft = Vec_PtrAlloc( nRange );
1881 Abc_NtkForEachPo( pNtk, pNodePo, i )
1882 if ( i < Output || i >= Output + nRange )
1883 Abc_NtkDeleteObjPo( pNodePo );
1884 else
1885 Vec_PtrPush( vPosLeft, pNodePo );
1886 // filter COs
1887 vCosLeft = Vec_PtrDup( vPosLeft );
1888 for ( i = Abc_NtkPoNum(pNtk); i < Abc_NtkCoNum(pNtk); i++ )
1889 Vec_PtrPush( vCosLeft, Abc_NtkCo(pNtk, i) );
1890 // update arrays
1891 Vec_PtrFree( pNtk->vPos ); pNtk->vPos = vPosLeft;
1892 Vec_PtrFree( pNtk->vCos ); pNtk->vCos = vCosLeft;
1893
1894 // clean the network
1895 if ( Abc_NtkIsStrash(pNtk) )
1896 {
1897 Abc_AigCleanup( (Abc_Aig_t *)pNtk->pManFunc );
1898 if ( Abc_NtkLatchNum(pNtk) ) printf( "Run sequential cleanup (\"scl\") to get rid of dangling logic.\n" );
1899 }
1900 else
1901 {
1902 if ( Abc_NtkLatchNum(pNtk) ) printf( "Run sequential cleanup (\"st; scl\") to get rid of dangling logic.\n" );
1903 }
1904
1905 if ( !Abc_NtkCheck( pNtk ) )
1906 fprintf( stdout, "Abc_NtkMakeComb(): Network check has failed.\n" );
1907 return pNtk;
1908}
Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition abcNtk.c:472
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition abc.h:520
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition abcAig.c:194
ABC_DLL void Abc_NtkDeleteObjPo(Abc_Obj_t *pObj)
Definition abcObj.c:249
Vec_Ptr_t * vCos
Definition abc.h:166
Vec_Ptr_t * vPos
Definition abc.h:164
Here is the call graph for this function:

◆ Abc_NtkToDar()

ABC_NAMESPACE_IMPL_START Aig_Man_t * Abc_NtkToDar ( Abc_Ntk_t * pNtk,
int fExors,
int fRegisters )
extern

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 237 of file abcDar.c.

238{
239 Vec_Ptr_t * vNodes;
240 Aig_Man_t * pMan;
241 Aig_Obj_t * pObjNew;
242 Abc_Obj_t * pObj;
243 int i, nNodes, nDontCares;
244 // make sure the latches follow PIs/POs
245 if ( fRegisters )
246 {
247 assert( Abc_NtkBoxNum(pNtk) == Abc_NtkLatchNum(pNtk) );
248 Abc_NtkForEachCi( pNtk, pObj, i )
249 if ( i < Abc_NtkPiNum(pNtk) )
250 {
251 assert( Abc_ObjIsPi(pObj) );
252 if ( !Abc_ObjIsPi(pObj) )
253 Abc_Print( 1, "Abc_NtkToDar(): Temporary bug: The PI ordering is wrong!\n" );
254 }
255 else
256 assert( Abc_ObjIsBo(pObj) );
257 Abc_NtkForEachCo( pNtk, pObj, i )
258 if ( i < Abc_NtkPoNum(pNtk) )
259 {
260 assert( Abc_ObjIsPo(pObj) );
261 if ( !Abc_ObjIsPo(pObj) )
262 Abc_Print( 1, "Abc_NtkToDar(): Temporary bug: The PO ordering is wrong!\n" );
263 }
264 else
265 assert( Abc_ObjIsBi(pObj) );
266 // print warning about initial values
267 nDontCares = 0;
268 Abc_NtkForEachLatch( pNtk, pObj, i )
269 if ( Abc_LatchIsInitDc(pObj) )
270 {
271 Abc_LatchSetInit0(pObj);
272 nDontCares++;
273 }
274 if ( nDontCares )
275 {
276 Abc_Print( 1, "Warning: %d registers in this network have don't-care init values.\n", nDontCares );
277 Abc_Print( 1, "The don't-care are assumed to be 0. The result may not verify.\n" );
278 Abc_Print( 1, "Use command \"print_latch\" to see the init values of registers.\n" );
279 Abc_Print( 1, "Use command \"zero\" to convert or \"init\" to change the values.\n" );
280 }
281 }
282 // create the manager
283 pMan = Aig_ManStart( Abc_NtkNodeNum(pNtk) + 100 );
284 pMan->fCatchExor = fExors;
285 pMan->nConstrs = pNtk->nConstrs;
286 pMan->nBarBufs = pNtk->nBarBufs;
287 pMan->pName = Extra_UtilStrsav( pNtk->pName );
288 pMan->pSpec = Extra_UtilStrsav( pNtk->pSpec );
289 // transfer the pointers to the basic nodes
290 Abc_AigConst1(pNtk)->pCopy = (Abc_Obj_t *)Aig_ManConst1(pMan);
291 Abc_NtkForEachCi( pNtk, pObj, i )
292 {
293 pObj->pCopy = (Abc_Obj_t *)Aig_ObjCreateCi(pMan);
294 // initialize logic level of the CIs
295 ((Aig_Obj_t *)pObj->pCopy)->Level = pObj->Level;
296 }
297
298 // complement the 1-values registers
299 if ( fRegisters ) {
300 Abc_NtkForEachLatch( pNtk, pObj, i )
301 if ( Abc_LatchIsInit1(pObj) )
302 Abc_ObjFanout0(pObj)->pCopy = Abc_ObjNot(Abc_ObjFanout0(pObj)->pCopy);
303 }
304 // perform the conversion of the internal nodes (assumes DFS ordering)
305// pMan->fAddStrash = 1;
306 vNodes = Abc_NtkDfs( pNtk, 0 );
307 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
308// Abc_NtkForEachNode( pNtk, pObj, i )
309 {
310 pObj->pCopy = (Abc_Obj_t *)Aig_And( pMan, (Aig_Obj_t *)Abc_ObjChild0Copy(pObj), (Aig_Obj_t *)Abc_ObjChild1Copy(pObj) );
311// Abc_Print( 1, "%d->%d ", pObj->Id, ((Aig_Obj_t *)pObj->pCopy)->Id );
312 }
313 Vec_PtrFree( vNodes );
314 pMan->fAddStrash = 0;
315 // create the POs
316 Abc_NtkForEachCo( pNtk, pObj, i )
317 Aig_ObjCreateCo( pMan, (Aig_Obj_t *)Abc_ObjChild0Copy(pObj) );
318 // complement the 1-valued registers
319 Aig_ManSetRegNum( pMan, Abc_NtkLatchNum(pNtk) );
320 if ( fRegisters )
321 Aig_ManForEachLiSeq( pMan, pObjNew, i )
322 if ( Abc_LatchIsInit1(Abc_ObjFanout0(Abc_NtkCo(pNtk,i))) )
323 pObjNew->pFanin0 = Aig_Not(pObjNew->pFanin0);
324 // remove dangling nodes
325 nNodes = (Abc_NtkGetChoiceNum(pNtk) == 0)? Aig_ManCleanup( pMan ) : 0;
326 if ( !fExors && nNodes )
327 Abc_Print( 1, "Abc_NtkToDar(): Unexpected %d dangling nodes when converting to AIG!\n", nNodes );
328//Aig_ManDumpVerilog( pMan, "test.v" );
329 // save the number of registers
330 if ( fRegisters )
331 {
332 Aig_ManSetRegNum( pMan, Abc_NtkLatchNum(pNtk) );
333 pMan->vFlopNums = Vec_IntStartNatural( pMan->nRegs );
334// pMan->vFlopNums = NULL;
335// pMan->vOnehots = Abc_NtkConverLatchNamesIntoNumbers( pNtk );
336 if ( pNtk->vOnehots )
337 pMan->vOnehots = (Vec_Ptr_t *)Vec_VecDupInt( (Vec_Vec_t *)pNtk->vOnehots );
338 }
339 if ( !Aig_ManCheck( pMan ) )
340 {
341 Abc_Print( 1, "Abc_NtkToDar: AIG check has failed.\n" );
342 Aig_ManStop( pMan );
343 return NULL;
344 }
345 return pMan;
346}
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition abc.h:500
ABC_DLL int Abc_NtkGetChoiceNum(Abc_Ntk_t *pNtk)
Definition abcUtil.c:463
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition abcDfs.c:82
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition aigMan.c:438
#define Aig_ManForEachLiSeq(p, pObj, i)
Definition aig.h:447
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
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition aigMan.c:47
int Aig_ManCleanup(Aig_Man_t *p)
Definition aigMan.c:265
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition aigObj.c:45
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition aigCheck.c:45
char * Extra_UtilStrsav(const char *s)
Vec_Ptr_t * vOnehots
Definition abc.h:211
char * pSpec
Definition abc.h:159
Abc_Obj_t * pCopy
Definition abc.h:148
unsigned Level
Definition abc.h:142
Aig_Obj_t * pFanin0
Definition aig.h:75
unsigned Level
Definition aig.h:82
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition vecVec.h:42
Here is the caller graph for this function:

◆ Aig_ManDumpBlif()

void Aig_ManDumpBlif ( Aig_Man_t * p,
char * pFileName,
Vec_Ptr_t * vPiNames,
Vec_Ptr_t * vPoNames )
extern

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

Synopsis [Writes the AIG into a BLIF file.]

Description []

SideEffects []

SeeAlso []

Definition at line 746 of file aigUtil.c.

747{
748 FILE * pFile;
749 Vec_Ptr_t * vNodes;
750 Aig_Obj_t * pObj, * pObjLi, * pObjLo, * pConst1 = NULL;
751 int i, nDigits, Counter = 0;
752 if ( Aig_ManCoNum(p) == 0 )
753 {
754 printf( "Aig_ManDumpBlif(): AIG manager does not have POs.\n" );
755 return;
756 }
757 // check if constant is used
758 Aig_ManForEachCo( p, pObj, i )
759 if ( Aig_ObjIsConst1(Aig_ObjFanin0(pObj)) )
760 pConst1 = Aig_ManConst1(p);
761 // collect nodes in the DFS order
762 vNodes = Aig_ManDfs( p, 1 );
763 // assign IDs to objects
764 Aig_ManConst1(p)->iData = Counter++;
765 Aig_ManForEachCi( p, pObj, i )
766 pObj->iData = Counter++;
767 Aig_ManForEachCo( p, pObj, i )
768 pObj->iData = Counter++;
769 Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
770 pObj->iData = Counter++;
771 nDigits = Abc_Base10Log( Counter );
772 // write the file
773 pFile = fopen( pFileName, "w" );
774 fprintf( pFile, "# BLIF file written by procedure Aig_ManDumpBlif()\n" );
775// fprintf( pFile, "# http://www.eecs.berkeley.edu/~alanmi/abc/\n" );
776 fprintf( pFile, ".model %s\n", p->pName );
777 // write PIs
778 fprintf( pFile, ".inputs" );
779 Aig_ManForEachPiSeq( p, pObj, i )
780 if ( vPiNames )
781 fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, i) );
782 else
783 fprintf( pFile, " n%0*d", nDigits, pObj->iData );
784 fprintf( pFile, "\n" );
785 // write POs
786 fprintf( pFile, ".outputs" );
787 Aig_ManForEachPoSeq( p, pObj, i )
788 if ( vPoNames )
789 fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPoNames, i) );
790 else
791 fprintf( pFile, " n%0*d", nDigits, pObj->iData );
792 fprintf( pFile, "\n" );
793 // write latches
794 if ( Aig_ManRegNum(p) )
795 {
796 fprintf( pFile, "\n" );
797 Aig_ManForEachLiLoSeq( p, pObjLi, pObjLo, i )
798 {
799 fprintf( pFile, ".latch" );
800 if ( vPoNames )
801 fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPoNames, Aig_ManCoNum(p)-Aig_ManRegNum(p)+i) );
802 else
803 fprintf( pFile, " n%0*d", nDigits, pObjLi->iData );
804 if ( vPiNames )
805 fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, Aig_ManCiNum(p)-Aig_ManRegNum(p)+i) );
806 else
807 fprintf( pFile, " n%0*d", nDigits, pObjLo->iData );
808 fprintf( pFile, " 0\n" );
809 }
810 fprintf( pFile, "\n" );
811 }
812 // write nodes
813 if ( pConst1 )
814 fprintf( pFile, ".names n%0*d\n 1\n", nDigits, pConst1->iData );
816 Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
817 {
818 fprintf( pFile, ".names" );
819 if ( vPiNames && Aig_ObjIsCi(Aig_ObjFanin0(pObj)) )
820 fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, Aig_ObjCioId(Aig_ObjFanin0(pObj))) );
821 else
822 fprintf( pFile, " n%0*d", nDigits, Aig_ObjFanin0(pObj)->iData );
823 if ( vPiNames && Aig_ObjIsCi(Aig_ObjFanin1(pObj)) )
824 fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, Aig_ObjCioId(Aig_ObjFanin1(pObj))) );
825 else
826 fprintf( pFile, " n%0*d", nDigits, Aig_ObjFanin1(pObj)->iData );
827 fprintf( pFile, " n%0*d\n", nDigits, pObj->iData );
828 fprintf( pFile, "%d%d 1\n", !Aig_ObjFaninC0(pObj), !Aig_ObjFaninC1(pObj) );
829 }
830 // write POs
831 Aig_ManForEachCo( p, pObj, i )
832 {
833 fprintf( pFile, ".names" );
834 if ( vPiNames && Aig_ObjIsCi(Aig_ObjFanin0(pObj)) )
835 fprintf( pFile, " %s", (char*)Vec_PtrEntry(vPiNames, Aig_ObjCioId(Aig_ObjFanin0(pObj))) );
836 else
837 fprintf( pFile, " n%0*d", nDigits, Aig_ObjFanin0(pObj)->iData );
838 if ( vPoNames )
839 fprintf( pFile, " %s\n", (char*)Vec_PtrEntry(vPoNames, Aig_ObjCioId(pObj)) );
840 else
841 fprintf( pFile, " n%0*d\n", nDigits, pObj->iData );
842 fprintf( pFile, "%d 1\n", !Aig_ObjFaninC0(pObj) );
843 }
845 fprintf( pFile, ".end\n\n" );
846 fclose( pFile );
847 Vec_PtrFree( vNodes );
848}
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition aigUtil.c:978
void Aig_ManCleanCioIds(Aig_Man_t *p)
Definition aigUtil.c:999
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition aig.h:393
Cube * p
Definition exorList.c:222
int iData
Definition aig.h:88
Here is the caller graph for this function:

◆ collectSafetyInvariantPOIndex()

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}
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition abcNames.c:49
char * strstr()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ collectUserGivenDisjunctiveMonotoneSignals()

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_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Vec_Int_t * createSingletonIntVector(int i)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createSingletonIntVector()

Vec_Int_t * createSingletonIntVector ( int i)
extern

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}
Here is the caller graph for this function:

◆ deallocateMasterBarrierDisjunctInt()

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}
Here is the caller graph for this function:

◆ deallocateMasterBarrierDisjunctVecPtrVecInt()

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}
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54

◆ findDisjunctiveMonotoneSignals()

Vec_Ptr_t * findDisjunctiveMonotoneSignals ( Abc_Ntk_t * pNtk)
extern

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);
746 //deallocPointersToMonotoneVectors(monotoneVectorsInstance);
747
748 deallocateVecOfIntVec( levelOneMonotne );
749 deallocateVecOfIntVec( levelTwoMonotne );
750
751 Aig_ManStop(pAig);
752 Vec_IntFree(vKnownMonotoneSignals);
753
754 return vMasterDisjunctions;
755}
Vec_Int_t * createSingletonIntVector(int iElem)
int collectSafetyInvariantPOIndex(Abc_Ntk_t *pNtk)
Definition kliveness.c:425
struct aigPoIndices * allocAigPoIndices()
Definition monotone.c:43
Vec_Int_t * updateAnteConseVectors(struct antecedentConsequentVectorsStruct *anteConse)
void deallocAigPoIndices(struct aigPoIndices *toBeDeletedAigPoIndices)
Definition monotone.c:57
void appendVecToMasterVecInt(Vec_Ptr_t *masterVec, Vec_Ptr_t *candVec)
void deallocateVecOfIntVec(Vec_Ptr_t *vecOfIntVec)
Vec_Ptr_t * findNextLevelDisjunctiveMonotone(Aig_Man_t *pAig, struct aigPoIndices *aigPoIndicesInstance, struct antecedentConsequentVectorsStruct *anteConsecInstance, Vec_Ptr_t *previousMonotoneVectors)
void deallocAntecedentConsequentVectorsStruct(struct antecedentConsequentVectorsStruct *toBeDeleted)
Vec_Int_t * findNewDisjunctiveMonotone(Aig_Man_t *pAig, struct aigPoIndices *aigPoIndicesArg, struct antecedentConsequentVectorsStruct *anteConseVectors)
struct antecedentConsequentVectorsStruct * allocAntecedentConsequentVectorsStruct()
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
Definition abcDar.c:237
Vec_Int_t * findHintOutputs(Abc_Ntk_t *pNtk)
Definition monotone.c:90
int findPendingSignal(Abc_Ntk_t *pNtk)
Definition monotone.c:112
Here is the call graph for this function:
Here is the caller graph for this function:

◆ flipConePdr()

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
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}
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
void Pdr_ManSetDefaultParams(Pdr_Par_t *pPars)
MACRO DEFINITIONS ///.
Definition pdrCore.c:50
typedefABC_NAMESPACE_HEADER_START struct Pdr_Par_t_ Pdr_Par_t
INCLUDES ///.
Definition pdr.h:40
int Pdr_ManSolve(Aig_Man_t *p, Pdr_Par_t *pPars)
Definition pdrCore.c:1765
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition utilCex.h:39
char * sprintf()
VOID_HACK free()
VOID_HACK exit()
char * malloc()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ generateDisjunctiveTester()

Aig_Man_t * generateDisjunctiveTester ( Abc_Ntk_t * pNtk,
Aig_Man_t * pAig,
int combN,
int combK )
extern

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}
#define Aig_ManForEachNode(p, pObj, i)
Definition aig.h:413
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition aigOper.c:259
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
ABC_NAMESPACE_IMPL_START long countCombination(long n, long k)
Definition combination.c:12
#define Saig_ManForEachLi(p, pObj, i)
Definition saig.h:98
#define Saig_ManForEachPo(p, pObj, i)
Definition saig.h:93
#define Saig_ManForEachLo(p, pObj, i)
Definition saig.h:96
#define Saig_ManForEachPi(p, pObj, i)
Definition saig.h:91
int strlen()
Here is the call graph for this function:

◆ generateGeneralDisjunctiveTester()

Aig_Man_t * generateGeneralDisjunctiveTester ( Abc_Ntk_t * pNtk,
Aig_Man_t * pAig,
int combK )
extern

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 {
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}
int generateCombinatorialStabilExhaust(Aig_Man_t *pAigNew, Aig_Man_t *pAigOld, Vec_Ptr_t *vDisj_nCk_, int combN, int combK)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ generateWorkingAig()

Aig_Man_t * generateWorkingAig ( Aig_Man_t * pAig,
Abc_Ntk_t * pNtk,
int * pIndex0Live )
extern

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}
Vec_Ptr_t * collectCSSignals(Abc_Ntk_t *pNtk, Aig_Man_t *pAig)
Aig_Man_t * createNewAigWith0LivePo(Aig_Man_t *pAig, Vec_Ptr_t *signalList, int *index0Live)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ generateWorkingAigWithDSC()

Aig_Man_t * generateWorkingAigWithDSC ( Aig_Man_t * pAig,
Abc_Ntk_t * pNtk,
int * pIndex0Live,
Vec_Ptr_t * vMasterBarriers )
extern

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}
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)
int collectPendingSignalWithDSC(Abc_Ntk_t *pNtk, Aig_Man_t *pAig)
Vec_Ptr_t * collectCSSignalsWithDSC(Abc_Ntk_t *pNtk, Aig_Man_t *pAig)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getVecOfVecFairness()

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}
Here is the call graph for this function:

◆ introduceAbsorberLogic()

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}
void Aig_ObjPatchFanin0(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pFaninNew)
Definition aigObj.c:282
Aig_Obj_t * readLiveSignal_0(Aig_Man_t *pAig, int liveIndex_0)
Definition kliveness.c:83
Aig_Obj_t * readLiveSignal_k(Aig_Man_t *pAig, int liveIndex_k)
Definition kliveness.c:91
Here is the call graph for this function:
Here is the caller graph for this function:

◆ modifyAigToApplySafetyInvar()

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}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readLiveSignal_0()

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}
Here is the caller graph for this function:

◆ readLiveSignal_k()

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}
Here is the caller graph for this function: