ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
io.c File Reference
#include "ioAbc.h"
#include "base/main/mainInt.h"
#include "aig/saig/saig.h"
#include "proof/abs/abs.h"
#include "sat/bmc/bmc.h"
#include <unistd.h>
#include "proof/fra/fra.h"
Include dependency graph for io.c:

Go to the source code of this file.

Functions

void Abc_FrameCopyLTLDataBase (Abc_Frame_t *pAbc, Abc_Ntk_t *pNtk)
 
void Io_Init (Abc_Frame_t *pAbc)
 FUNCTION DEFINITIONS ///.
 
void Io_End (Abc_Frame_t *pAbc)
 
int Abc_NtkReadCexFile (char *pFileName, Abc_Ntk_t *pNtk, Abc_Cex_t **ppCex, Abc_Cex_t **ppCexCare, int *pnFrames, int *fOldFormat, int xMode)
 
ABC_NAMESPACE_IMPL_END ABC_NAMESPACE_IMPL_START int Abc_NtkCheckSpecialPi (Abc_Ntk_t *pNtk)
 
void Abc_NtkDumpOneCexSpecial (FILE *pFile, Abc_Ntk_t *pNtk, Abc_Cex_t *pCex)
 
Abc_Cex_tBmc_CexInnerStates (Gia_Man_t *p, Abc_Cex_t *pCex, Abc_Cex_t **ppCexImpl, int fVerbose)
 
Abc_Cex_tBmc_CexEssentialBits (Gia_Man_t *p, Abc_Cex_t *pCexState, Abc_Cex_t *pCexCare, int fVerbose)
 
Abc_Cex_tBmc_CexCareBits (Gia_Man_t *p, Abc_Cex_t *pCexState, Abc_Cex_t *pCexImpl, Abc_Cex_t *pCexEss, int fFindAll, int fVerbose)
 
void Abc_NtkDumpOneCex (FILE *pFile, Abc_Ntk_t *pNtk, Abc_Cex_t *pCex, int fPrintFull, int fNames, int fUseFfNames, int fMinimize, int fUseOldMin, int fCexInfo, int fCheckCex, int fUseSatBased, int fHighEffort, int fAiger, int fVerbose, int fExtended)
 

Variables

int glo_fMapped
 

Function Documentation

◆ Abc_FrameCopyLTLDataBase()

void Abc_FrameCopyLTLDataBase ( Abc_Frame_t * pAbc,
Abc_Ntk_t * pNtk )
extern

Definition at line 73 of file ltl_parser.c.

74{
75 char *pLtlFormula, *tempFormula;
76 int i;
77
78 if( pAbc->vLTLProperties_global != NULL )
79 {
80// printf("Deleting exisitng LTL database from the frame\n");
81 Vec_PtrFree( pAbc->vLTLProperties_global );
82 pAbc->vLTLProperties_global = NULL;
83 }
84 pAbc->vLTLProperties_global = Vec_PtrAlloc(Vec_PtrSize(pNtk->vLtlProperties));
85 Vec_PtrForEachEntry( char *, pNtk->vLtlProperties, pLtlFormula, i )
86 {
87 tempFormula = (char *)malloc( sizeof(char)*(strlen(pLtlFormula)+1) );
88 sprintf( tempFormula, "%s", pLtlFormula );
89 Vec_PtrPush( pAbc->vLTLProperties_global, tempFormula );
90 }
91}
Vec_Ptr_t * vLtlProperties
Definition abc.h:169
int strlen()
char * sprintf()
char * malloc()
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:

◆ Abc_NtkCheckSpecialPi()

ABC_NAMESPACE_IMPL_END ABC_NAMESPACE_IMPL_START int Abc_NtkCheckSpecialPi ( Abc_Ntk_t * pNtk)

Definition at line 3006 of file io.c.

3007{
3008 Abc_Obj_t * pObj; int i;
3009 Abc_NtkForEachPi( pNtk, pObj, i )
3010 if ( !strcmp(Abc_ObjName(pObj), "_abc_190121_abc_") )
3011 return 1;
3012 return 0;
3013}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition abcNames.c:49
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition abc.h:516
int strcmp()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDumpOneCex()

void Abc_NtkDumpOneCex ( FILE * pFile,
Abc_Ntk_t * pNtk,
Abc_Cex_t * pCex,
int fPrintFull,
int fNames,
int fUseFfNames,
int fMinimize,
int fUseOldMin,
int fCexInfo,
int fCheckCex,
int fUseSatBased,
int fHighEffort,
int fAiger,
int fVerbose,
int fExtended )

Definition at line 3056 of file io.c.

3059{
3060 Abc_Cex_t * pCare = NULL;
3061 Abc_Obj_t * pObj;
3062 int i, f;
3063 if ( fPrintFull )
3064 {
3065 extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters );
3066 Aig_Man_t * pAig = Abc_NtkToDar( pNtk, 0, 1 );
3067 Abc_Cex_t * pCexFull = Saig_ManExtendCex( pAig, pCex );
3068 Aig_ManStop( pAig );
3069 // output PI values (while skipping the minimized ones)
3070 assert( pCexFull->nBits == Abc_NtkCiNum(pNtk) * (pCex->iFrame + 1) );
3071 for ( f = 0; f <= pCex->iFrame; f++ )
3072 Abc_NtkForEachCi( pNtk, pObj, i )
3073 fprintf( pFile, "%s@%d=%c ", Abc_ObjName(pObj), f, '0'+Abc_InfoHasBit(pCexFull->pData, Abc_NtkCiNum(pNtk)*f + i) );
3074 Abc_CexFreeP( &pCexFull );
3075 }
3076 else
3077 {
3078 if ( fNames )
3079 {
3080 fprintf( pFile, "# FALSIFYING OUTPUTS:");
3081 fprintf( pFile, " %s", Abc_ObjName(Abc_NtkCo(pNtk, pCex->iPo)) );
3082 }
3083 if ( fMinimize )
3084 {
3085 extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters );
3086 Aig_Man_t * pAig = Abc_NtkToDar( pNtk, 0, 1 );
3087 if ( fUseOldMin )
3088 {
3089 pCare = Saig_ManCbaFindCexCareBits( pAig, pCex, 0, fVerbose );
3090 if ( fCheckCex )
3091 Bmc_CexCareVerify( pAig, pCex, pCare, fVerbose );
3092 }
3093 else if ( fUseSatBased )
3094 {
3095 if ( Abc_NtkPoNum( pNtk ) == 1 )
3096 pCare = Bmc_CexCareSatBasedMinimize( pAig, Saig_ManPiNum(pAig), pCex, fHighEffort, fCheckCex, fVerbose );
3097 else
3098 printf( "SAT-based CEX minimization requires having a single PO.\n" );
3099 }
3100 else if ( fCexInfo )
3101 {
3102 Gia_Man_t * p = Gia_ManFromAigSimple( pAig );
3103 Abc_Cex_t * pCexImpl = NULL;
3104 Abc_Cex_t * pCexStates = Bmc_CexInnerStates( p, pCex, &pCexImpl, fVerbose );
3105 Abc_Cex_t * pCexCare = Bmc_CexCareBits( p, pCexStates, pCexImpl, NULL, 1, fVerbose );
3106 Abc_Cex_t * pCexEss;
3107
3108 if ( fCheckCex && !Bmc_CexVerify( p, pCex, pCexCare ) )
3109 printf( "Counter-example care-set verification has failed.\n" );
3110
3111 pCexEss = Bmc_CexEssentialBits( p, pCexStates, pCexCare, fVerbose );
3112
3113 // pCare is pCexMin from Bmc_CexTest
3114 pCare = Bmc_CexCareBits( p, pCexStates, pCexImpl, pCexEss, 0, fVerbose );
3115
3116 if ( fCheckCex && !Bmc_CexVerify( p, pCex, pCare ) )
3117 printf( "Counter-example min-set verification has failed.\n" );
3118 Abc_CexFreeP( &pCexStates );
3119 Abc_CexFreeP( &pCexImpl );
3120 Abc_CexFreeP( &pCexCare );
3121 Abc_CexFreeP( &pCexEss );
3122 }
3123 else
3124 pCare = Bmc_CexCareMinimize( pAig, Saig_ManPiNum(pAig), pCex, 4, fCheckCex, fVerbose );
3125 Aig_ManStop( pAig );
3126 if(pCare == NULL)
3127 printf( "Counter-example minimization has failed.\n" );
3128 }
3129 if (fNames)
3130 {
3131 fprintf( pFile, "\n");
3132 fprintf( pFile, "# COUNTEREXAMPLE LENGTH: %u\n", pCex->iFrame+1);
3133 }
3134 if ( fNames && fUseFfNames && Abc_NtkCheckSpecialPi(pNtk) )
3135 {
3136 int * pValues;
3137 int nXValues = 0, iFlop = 0, iPivotPi = -1;
3138 Abc_NtkForEachPi( pNtk, pObj, iPivotPi )
3139 if ( !strcmp(Abc_ObjName(pObj), "_abc_190121_abc_") )
3140 break;
3141 if ( iPivotPi == Abc_NtkPiNum(pNtk) )
3142 {
3143 fprintf( stdout, "IoCommandWriteCex(): Cannot find special PI required by switch \"-z\".\n" );
3144 return;
3145 }
3146 // count X-valued flops
3147 for ( i = iPivotPi+1; i < Abc_NtkPiNum(pNtk); i++ )
3148 if ( Abc_ObjName(Abc_NtkPi(pNtk, i))[0] == 'x' )
3149 nXValues++;
3150 // map X-valued flops into auxiliary PIs
3151 pValues = ABC_FALLOC( int, Abc_NtkPiNum(pNtk) );
3152 for ( i = iPivotPi+1; i < Abc_NtkPiNum(pNtk); i++ )
3153 if ( Abc_ObjName(Abc_NtkPi(pNtk, i))[0] == 'x' )
3154 pValues[i] = iPivotPi - nXValues + iFlop++;
3155 assert( iFlop == nXValues );
3156 // write flop values
3157 for ( i = iPivotPi+1; i < Abc_NtkPiNum(pNtk); i++ )
3158 if ( pValues[i] == -1 )
3159 fprintf( pFile, "%s@0=%c\n", Abc_ObjName(Abc_NtkPi(pNtk, i))+1, Abc_ObjName(Abc_NtkPi(pNtk, i))[0] );
3160 else if ( Abc_InfoHasBit(pCare->pData, pCare->nRegs + pValues[i]) )
3161 fprintf( pFile, "%s@0=%c\n", Abc_ObjName(Abc_NtkPi(pNtk, i))+1, '0'+Abc_InfoHasBit(pCex->pData, pCex->nRegs + pValues[i]) );
3162 ABC_FREE( pValues );
3163 // output PI values (while skipping the minimized ones)
3164 for ( f = 0; f <= pCex->iFrame; f++ )
3165 Abc_NtkForEachPi( pNtk, pObj, i )
3166 {
3167 if ( i == iPivotPi - nXValues ) break;
3168 if ( !pCare || Abc_InfoHasBit(pCare->pData, pCare->nRegs+pCare->nPis*f + i) )
3169 fprintf( pFile, "%s@%d=%c\n", Abc_ObjName(pObj), f, '0'+Abc_InfoHasBit(pCex->pData, pCex->nRegs+pCex->nPis*f + i) );
3170 }
3171 }
3172 else
3173 {
3174 if (fExtended && fAiger && !fNames) {
3175 fprintf( pFile, "1\n");
3176 fprintf( pFile, "b%d\n", pCex->iPo);
3177 }
3178 // output flop values (unaffected by the minimization)
3179 Abc_NtkForEachLatch( pNtk, pObj, i )
3180 if ( fNames )
3181 fprintf( pFile, "%s@0=%c\n", Abc_ObjName(Abc_ObjFanout0(pObj)), '0'+!Abc_LatchIsInit0(pObj) );
3182 else
3183 fprintf( pFile, "%c", '0'+!Abc_LatchIsInit0(pObj) );
3184 if ( !fNames && fAiger)
3185 fprintf( pFile, "\n");
3186 // output PI values (while skipping the minimized ones)
3187 for ( f = 0; f <= pCex->iFrame; f++ ) {
3188 Abc_NtkForEachPi( pNtk, pObj, i )
3189 if ( !pCare || Abc_InfoHasBit(pCare->pData, pCare->nRegs+pCare->nPis*f + i) )
3190 if ( fNames )
3191 fprintf( pFile, "%s@%d=%c\n", Abc_ObjName(pObj), f, '0'+Abc_InfoHasBit(pCex->pData, pCex->nRegs+pCex->nPis*f + i) );
3192 else
3193 fprintf( pFile, "%c", '0'+Abc_InfoHasBit(pCex->pData, pCex->nRegs+pCex->nPis*f + i) );
3194 else if ( !fNames )
3195 fprintf( pFile, "x");
3196 if ( !fNames && fAiger)
3197 fprintf( pFile, "\n");
3198 }
3199 if (fExtended && fAiger && !fNames)
3200 fprintf( pFile, ".\n");
3201 }
3202 Abc_CexFreeP( &pCare );
3203 }
3204}
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition abc.h:500
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
#define ABC_FALLOC(type, num)
Definition abc_global.h:266
#define ABC_FREE(obj)
Definition abc_global.h:267
Abc_Cex_t * Saig_ManCbaFindCexCareBits(Aig_Man_t *pAig, Abc_Cex_t *pCex, int nInputs, int fVerbose)
Definition absOldCex.c:718
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_Cex_t * Bmc_CexCareMinimize(Aig_Man_t *p, int nRealPis, Abc_Cex_t *pCex, int nTryCexes, int fCheck, int fVerbose)
Definition bmcCexCare.c:426
Abc_Cex_t * Bmc_CexCareSatBasedMinimize(Aig_Man_t *p, int nRealPis, Abc_Cex_t *pCex, int fHighEffort, int fCheck, int fVerbose)
Definition bmcCexCare.c:433
int Bmc_CexVerify(Gia_Man_t *p, Abc_Cex_t *pCex, Abc_Cex_t *pCexCare)
int Bmc_CexCareVerify(Aig_Man_t *p, Abc_Cex_t *pCex, Abc_Cex_t *pCexMin, int fVerbose)
Definition bmcCexCare.c:458
Cube * p
Definition exorList.c:222
Gia_Man_t * Gia_ManFromAigSimple(Aig_Man_t *p)
Definition giaAig.c:212
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
Definition abcDar.c:237
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Abc_Cex_t * Bmc_CexCareBits(Gia_Man_t *p, Abc_Cex_t *pCexState, Abc_Cex_t *pCexImpl, Abc_Cex_t *pCexEss, int fFindAll, int fVerbose)
ABC_NAMESPACE_IMPL_END ABC_NAMESPACE_IMPL_START int Abc_NtkCheckSpecialPi(Abc_Ntk_t *pNtk)
Definition io.c:3006
Abc_Cex_t * Bmc_CexEssentialBits(Gia_Man_t *p, Abc_Cex_t *pCexState, Abc_Cex_t *pCexCare, int fVerbose)
Abc_Cex_t * Bmc_CexInnerStates(Gia_Man_t *p, Abc_Cex_t *pCex, Abc_Cex_t **ppCexImpl, int fVerbose)
Abc_Cex_t * Saig_ManExtendCex(Aig_Man_t *pAig, Abc_Cex_t *p)
Definition saigDup.c:384
void Abc_CexFreeP(Abc_Cex_t **p)
Definition utilCex.c:361
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition utilCex.h:39
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:

◆ Abc_NtkDumpOneCexSpecial()

void Abc_NtkDumpOneCexSpecial ( FILE * pFile,
Abc_Ntk_t * pNtk,
Abc_Cex_t * pCex )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 3026 of file io.c.

3027{
3028 Abc_Cex_t * pCare = NULL; int i, f; Abc_Obj_t * pObj;
3029 extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters );
3030 Aig_Man_t * pAig = Abc_NtkToDar( pNtk, 0, 1 );
3031 //fprintf( pFile, "# FALSIFYING OUTPUTS:");
3032 //fprintf( pFile, " %s", Abc_ObjName(Abc_NtkCo(pNtk, pCex->iPo)) );
3033 pCare = Bmc_CexCareMinimize( pAig, Saig_ManPiNum(pAig), pCex, 4, 0, 0 );
3034 Aig_ManStop( pAig );
3035 if( pCare == NULL )
3036 {
3037 printf( "Counter-example minimization has failed.\n" );
3038 return;
3039 }
3040 // output flop values (unaffected by the minimization)
3041 Abc_NtkForEachLatch( pNtk, pObj, i )
3042 fprintf( pFile, "CEX: %s@0=%c\n", Abc_ObjName(Abc_ObjFanout0(pObj)), '0'+!Abc_LatchIsInit0(pObj) );
3043 // output PI values (while skipping the minimized ones)
3044 for ( f = 0; f <= pCex->iFrame; f++ )
3045 Abc_NtkForEachPi( pNtk, pObj, i )
3046 if ( !pCare || Abc_InfoHasBit(pCare->pData, pCare->nRegs+pCare->nPis*f + i) )
3047 fprintf( pFile, "CEX: %s@%d=%c\n", Abc_ObjName(pObj), f, '0'+Abc_InfoHasBit(pCex->pData, pCex->nRegs+pCex->nPis*f + i) );
3048 Abc_CexFreeP( &pCare );
3049}
Here is the call graph for this function:

◆ Abc_NtkReadCexFile()

int Abc_NtkReadCexFile ( char * pFileName,
Abc_Ntk_t * pNtk,
Abc_Cex_t ** ppCex,
Abc_Cex_t ** ppCexCare,
int * pnFrames,
int * fOldFormat,
int xMode )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 715 of file io.c.

716{
717 FILE * pFile;
718 Abc_Cex_t * pCex;
719 Abc_Cex_t * pCexCare;
720 Vec_Int_t * vNums;
721 int c, nRegs = -1, nFrames = -1;
722 pFile = fopen( pFileName, "r" );
723 if ( pFile == NULL )
724 {
725 printf( "Cannot open log file for reading \"%s\".\n" , pFileName );
726 return -1;
727 }
728
729 vNums = Vec_IntAlloc( 100 );
730 int usedX = 0;
731 *fOldFormat = 0;
732
733 int MaxLine = 1000000;
734 char *Buffer;
735 int BufferLen = 0;
736 int state = 0;
737 int iPo = 0;
738 nFrames = -1;
739 int status = 0;
740 int i;
741 int nRegsNtk = 0;
742 Abc_Obj_t * pObj;
743 Abc_NtkForEachLatch( pNtk, pObj, i ) nRegsNtk++;
744
745 Buffer = ABC_ALLOC( char, MaxLine );
746 while ( fgets( Buffer, MaxLine, pFile ) != NULL )
747 {
748 if ( Buffer[0] == '#' || Buffer[0] == 'c' || Buffer[0] == 'f' || Buffer[0] == 'u' )
749 continue;
750 BufferLen = strlen(Buffer) - 1;
751 Buffer[BufferLen] = '\0';
752 if (state==0 && BufferLen>1) {
753 // old format detected
754 *fOldFormat = 1;
755 state = 2;
756 iPo = 0;
757 status = 1;
758 }
759 if (state==1 && Buffer[0]!='b' && Buffer[0]!='j') {
760 // old format detected, first line was actually register
761 *fOldFormat = 1;
762 state = 3;
763 Vec_IntPush( vNums, status );
764 status = 1;
765 }
766 if (Buffer[0] == '.' )
767 break;
768 switch(state) {
769 case 0 :
770 {
771 char c = Buffer[0];
772 if ( c == '0' || c == '1' || c == '2' ) {
773 status = c - '0' ;
774 state = 1;
775 } else if ( c == 'x' ) {
776 // old format with one x state latch
777 usedX = 1;
778 // set to 2 so we can Abc_LatchSetInitNone
779 // acts like 0 when setting bits
780 Vec_IntPush( vNums, 2 );
781 nRegs = Vec_IntSize(vNums);
782 state = 3;
783 } else {
784 printf( "ERROR: Bad aiger status line.\n" );
785 return -1;
786 }
787 }
788 break;
789 case 1 :
790 iPo = atoi(Buffer+1);
791 state = 2;
792 break;
793 case 2 :
794 for (i=0; i<BufferLen;i++) {
795 char c = Buffer[i];
796 if ( c == '0' || c == '1' )
797 Vec_IntPush( vNums, c - '0' );
798 else if ( c == 'x') {
799 usedX = 1;
800 // set to 2 so we can Abc_LatchSetInitNone
801 // acts like 0 when setting bits
802 Vec_IntPush( vNums, 2 );
803 }
804 }
805 nRegs = Vec_IntSize(vNums);
806 if ( nRegs < nRegsNtk )
807 {
808 printf( "WARNING: Register number is smaller than in Ntk. Appending.\n" );
809 for (i=0; i<nRegsNtk-nRegs;i++) {
810 Vec_IntPush( vNums, 0 );
811 }
812 nRegs = Vec_IntSize(vNums);
813 }
814 else if ( nRegs > nRegsNtk )
815 {
816 printf( "WARNING: Register number is larger than in Ntk. Truncating.\n" );
817 Vec_IntShrink( vNums, nRegsNtk );
818 nRegs = nRegsNtk;
819 }
820 state = 3;
821 break;
822 default:
823 for (i=0; i<BufferLen;i++) {
824 char c = Buffer[i];
825 if ( c == '0' || c == '1' )
826 Vec_IntPush( vNums, c - '0' );
827 else if ( c == 'x') {
828 usedX = 1;
829 Vec_IntPush( vNums, 2 );
830 }
831 }
832 nFrames++;
833 break;
834 }
835 }
836 fclose( pFile );
837
838 if (usedX && !xMode)
839 printf( "Warning: Using 0 instead of x in latches or primary inputs\n" );
840 int iFrameCex = nFrames;
841 if ( nRegs < 0 )
842 {
843 if (status == 0 || *fOldFormat == 0)
844 printf( "Counter-example is not available.\n" );
845 else
846 printf( "ERROR: Cannot read register number.\n" );
847 Vec_IntFree( vNums );
848 return -1;
849 }
850 if ( nRegs != nRegsNtk )
851 {
852 printf( "ERROR: Register number not coresponding to Ntk.\n" );
853 Vec_IntFree( vNums );
854 return -1;
855 }
856 if ( Vec_IntSize(vNums)-nRegs == 0 )
857 {
858 printf( "ERROR: Cannot read counter example.\n" );
859 Vec_IntFree( vNums );
860 return -1;
861 }
862 if ( (Vec_IntSize(vNums)-nRegs) % (iFrameCex + 1) != 0 )
863 {
864 printf( "ERROR: Incorrect number of bits.\n" );
865 Vec_IntFree( vNums );
866 return -1;
867 }
868 int nPi = (Vec_IntSize(vNums)-nRegs)/(iFrameCex + 1);
869 if ( nPi != Abc_NtkPiNum(pNtk) )
870 {
871 printf( "ERROR: Number of primary inputs not coresponding to Ntk.\n" );
872 Vec_IntFree( vNums );
873 return -1;
874 }
875 if ( iPo >= Abc_NtkPoNum(pNtk) )
876 {
877 printf( "WARNING: PO that failed verification not coresponding to Ntk, using first PO instead.\n" );
878 iPo = 0;
879 }
880 Abc_NtkForEachLatch( pNtk, pObj, i ) {
881 if ( Vec_IntEntry(vNums, i) == 1 )
882 Abc_LatchSetInit1(pObj);
883 else if ( Vec_IntEntry(vNums, i) == 2 && xMode )
884 Abc_LatchSetInitNone(pObj);
885 else
886 Abc_LatchSetInit0(pObj);
887 }
888
889 pCex = Abc_CexAlloc( nRegs, nPi, iFrameCex + 1 );
890 pCexCare = Abc_CexAlloc( nRegs, nPi, iFrameCex + 1);
891 // the zero-based number of PO, for which verification failed
892 // fails in Bmc_CexVerify if not less than actual number of PO
893 pCex->iPo = iPo;
894 pCexCare->iPo = iPo;
895 // the zero-based number of the time-frame, for which verificaiton failed
896 pCex->iFrame = iFrameCex;
897 pCexCare->iFrame = iFrameCex;
898 assert( Vec_IntSize(vNums) == pCex->nBits );
899 for ( c = 0; c < pCex->nBits; c++ ) {
900 if ( Vec_IntEntry(vNums, c) == 1)
901 {
902 Abc_InfoSetBit( pCex->pData, c );
903 Abc_InfoSetBit( pCexCare->pData, c );
904 }
905 else if ( Vec_IntEntry(vNums, c) == 2 && xMode )
906 {
907 // nothing to set
908 }
909 else
910 Abc_InfoSetBit( pCexCare->pData, c );
911 }
912
913 Vec_IntFree( vNums );
914 Abc_CexFreeP( ppCex );
915 if ( ppCex )
916 *ppCex = pCex;
917 else
918 Abc_CexFree( pCex );
919 Abc_CexFreeP( ppCexCare );
920 if ( ppCexCare )
921 *ppCexCare = pCexCare;
922 else
923 Abc_CexFree( pCexCare );
924
925 if ( pnFrames )
926 *pnFrames = nFrames;
927 return status;
928}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
void Abc_CexFree(Abc_Cex_t *p)
Definition utilCex.c:382
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
Definition utilCex.c:51
Here is the call graph for this function:

◆ Bmc_CexCareBits()

Abc_Cex_t * Bmc_CexCareBits ( Gia_Man_t * p,
Abc_Cex_t * pCexState,
Abc_Cex_t * pCexImpl,
Abc_Cex_t * pCexEss,
int fFindAll,
int fVerbose )
extern

Definition at line 597 of file bmcCexTools.c.

598{
599 Abc_Cex_t * pNew;
600 Gia_Obj_t * pObj;
601 int fCompl0, fCompl1;
602 int i, k, iBit;
603 assert( pCexState->nRegs == 0 );
604 // start the counter-example
605 pNew = Abc_CexAlloc( 0, Gia_ManCiNum(p), pCexState->iFrame + 1 );
606 pNew->iFrame = pCexState->iFrame;
607 pNew->iPo = pCexState->iPo;
608 // set initial state
610 // set const0
611 Gia_ManConst0(p)->fMark0 = 0;
612 Gia_ManConst0(p)->fMark1 = 1;
613 for ( i = pCexState->iFrame; i >= 0; i-- )
614 {
615 // set correct values
616 iBit = pCexState->nPis * i;
617 Gia_ManForEachCi( p, pObj, k )
618 {
619 pObj->fMark0 = Abc_InfoHasBit(pCexState->pData, iBit+k);
620 pObj->fMark1 = 0;
621 if ( pCexImpl )
622 pObj->fMark1 |= Abc_InfoHasBit(pCexImpl->pData, iBit+k);
623 if ( pCexEss )
624 pObj->fMark1 |= Abc_InfoHasBit(pCexEss->pData, iBit+k);
625 }
626 Gia_ManForEachAnd( p, pObj, k )
627 {
628 fCompl0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
629 fCompl1 = Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj);
630 pObj->fMark0 = fCompl0 & fCompl1;
631 if ( pObj->fMark0 )
632 pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1 & Gia_ObjFanin1(pObj)->fMark1;
633 else if ( !fCompl0 && !fCompl1 )
634 pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1 | Gia_ObjFanin1(pObj)->fMark1;
635 else if ( !fCompl0 )
636 pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1;
637 else if ( !fCompl1 )
638 pObj->fMark1 = Gia_ObjFanin1(pObj)->fMark1;
639 else assert( 0 );
640 }
641 Gia_ManForEachCo( p, pObj, k )
642 pObj->fMark0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
643 // move values from COs to CIs
644 if ( i == pCexState->iFrame )
645 {
646 assert( Gia_ManPo(p, pCexState->iPo)->fMark0 == 1 );
647 if ( fFindAll )
648 Bmc_CexCareBits_rec( p, Gia_ObjFanin0(Gia_ManPo(p, pCexState->iPo)) );
649 else
650 Bmc_CexCareBits2_rec( p, Gia_ObjFanin0(Gia_ManPo(p, pCexState->iPo)) );
651 }
652 else
653 {
654 Gia_ManForEachRi( p, pObj, k )
655 if ( Abc_InfoHasBit(pNew->pData, pNew->nPis * (i+1) + Gia_ManPiNum(p) + k) )
656 {
657 if ( fFindAll )
658 Bmc_CexCareBits_rec( p, Gia_ObjFanin0(pObj) );
659 else
660 Bmc_CexCareBits2_rec( p, Gia_ObjFanin0(pObj) );
661 }
662 }
663 // save the results
664 Gia_ManForEachCi( p, pObj, k )
665 if ( pObj->fMark1 )
666 {
667 pObj->fMark1 = 0;
668 if ( pCexImpl == NULL || !Abc_InfoHasBit(pCexImpl->pData, pNew->nPis * i + k) )
669 Abc_InfoSetBit(pNew->pData, pNew->nPis * i + k);
670 }
671 }
672 if ( pCexEss )
673 printf( "Minimized: " );
674 else
675 printf( "Care bits: " );
676 Bmc_CexPrint( pNew, Gia_ManPiNum(p), fVerbose );
677 return pNew;
678}
void Bmc_CexPrint(Abc_Cex_t *pCex, int nRealPis, int fVerbose)
void Bmc_CexCareBits_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
void Bmc_CexCareBits2_rec(Gia_Man_t *p, Gia_Obj_t *pObj)
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
#define Gia_ManForEachCo(p, pObj, i)
Definition gia.h:1236
#define Gia_ManForEachCi(p, pObj, i)
Definition gia.h:1228
void Gia_ManCleanMark01(Gia_Man_t *p)
Definition giaUtil.c:218
#define Gia_ManForEachRi(p, pObj, i)
Definition gia.h:1254
unsigned fMark1
Definition gia.h:86
unsigned fMark0
Definition gia.h:81
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bmc_CexEssentialBits()

Abc_Cex_t * Bmc_CexEssentialBits ( Gia_Man_t * p,
Abc_Cex_t * pCexState,
Abc_Cex_t * pCexCare,
int fVerbose )
extern

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

Synopsis [Computes essential bits of the CEX.]

Description []

SideEffects []

SeeAlso []

Definition at line 802 of file bmcCexTools.c.

803{
804 Abc_Cex_t * pNew, * pTemp, * pPrev = NULL;
805 int b, fEqual = 0, fPrevStatus = 0;
806// abctime clk = Abc_Clock();
807 assert( pCexState->nBits == pCexCare->nBits );
808 // start the counter-example
809 pNew = Abc_CexAlloc( 0, Gia_ManCiNum(p), pCexState->iFrame + 1 );
810 pNew->iFrame = pCexState->iFrame;
811 pNew->iPo = pCexState->iPo;
812 // iterate through care-bits
813 for ( b = 0; b < pCexState->nBits; b++ )
814 {
815 // skip don't-care bits
816 if ( !Abc_InfoHasBit(pCexCare->pData, b) )
817 continue;
818
819 // skip state bits
820 if ( b % pCexCare->nPis >= Gia_ManPiNum(p) )
821 {
822 Abc_InfoSetBit( pNew->pData, b );
823 continue;
824 }
825
826 // check if this is an essential bit
827 pTemp = Bmc_CexEssentialBitOne( p, pCexState, b, pPrev, &fEqual );
828// pTemp = Bmc_CexEssentialBitOne( p, pCexState, b, NULL, &fEqual );
829 if ( pTemp == NULL )
830 {
831 if ( fEqual && fPrevStatus )
832 Abc_InfoSetBit( pNew->pData, b );
833 continue;
834 }
835// Bmc_CexPrint( pTemp, Gia_ManPiNum(p), fVerbose );
836 Abc_CexFree( pPrev );
837 pPrev = pTemp;
838
839 // record essential bit
840 fPrevStatus = !Gia_ManPo(p, pCexState->iPo)->fMark1;
841 if ( !Gia_ManPo(p, pCexState->iPo)->fMark1 )
842 Abc_InfoSetBit( pNew->pData, b );
843 }
844 Abc_CexFreeP( &pPrev );
845// Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
846 printf( "Essentials: " );
847 Bmc_CexPrint( pNew, Gia_ManPiNum(p), fVerbose );
848 return pNew;
849}
Abc_Cex_t * Bmc_CexEssentialBitOne(Gia_Man_t *p, Abc_Cex_t *pCexState, int iBit, Abc_Cex_t *pCexPrev, int *pfEqual)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bmc_CexInnerStates()

Abc_Cex_t * Bmc_CexInnerStates ( Gia_Man_t * p,
Abc_Cex_t * pCex,
Abc_Cex_t ** ppCexImpl,
int fVerbose )
extern

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

Synopsis [Computes internal states of the CEX.]

Description []

SideEffects []

SeeAlso []

Definition at line 435 of file bmcCexTools.c.

436{
437 Abc_Cex_t * pNew, * pNew2;
438 Gia_Obj_t * pObj, * pObjRo, * pObjRi;
439 int fCompl0, fCompl1;
440 int i, k, iBit = 0;
441 assert( pCex->nRegs > 0 );
442 // start the counter-example
443 pNew = Abc_CexAlloc( 0, Gia_ManCiNum(p), pCex->iFrame + 1 );
444 pNew->iFrame = pCex->iFrame;
445 pNew->iPo = pCex->iPo;
446 // start the counter-example
447 pNew2 = Abc_CexAlloc( 0, Gia_ManCiNum(p), pCex->iFrame + 1 );
448 pNew2->iFrame = pCex->iFrame;
449 pNew2->iPo = pCex->iPo;
450 // set initial state
452 // set const0
453 Gia_ManConst0(p)->fMark0 = 0;
454 Gia_ManConst0(p)->fMark1 = 1;
455 // set init state
456 Gia_ManForEachRi( p, pObjRi, k )
457 {
458 pObjRi->fMark0 = 0;
459 pObjRi->fMark1 = 1;
460 }
461 iBit = pCex->nRegs;
462 for ( i = 0; i <= pCex->iFrame; i++ )
463 {
464 Gia_ManForEachPi( p, pObj, k )
465 pObj->fMark0 = Abc_InfoHasBit(pCex->pData, iBit++);
466 Gia_ManForEachRiRo( p, pObjRi, pObjRo, k )
467 {
468 pObjRo->fMark0 = pObjRi->fMark0;
469 pObjRo->fMark1 = pObjRi->fMark1;
470 }
471 Gia_ManForEachCi( p, pObj, k )
472 {
473 if ( pObj->fMark0 )
474 Abc_InfoSetBit( pNew->pData, pNew->nPis * i + k );
475 if ( pObj->fMark1 )
476 Abc_InfoSetBit( pNew2->pData, pNew2->nPis * i + k );
477 }
478 Gia_ManForEachAnd( p, pObj, k )
479 {
480 fCompl0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
481 fCompl1 = Gia_ObjFanin1(pObj)->fMark0 ^ Gia_ObjFaninC1(pObj);
482 pObj->fMark0 = fCompl0 & fCompl1;
483 if ( pObj->fMark0 )
484 pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1 & Gia_ObjFanin1(pObj)->fMark1;
485 else if ( !fCompl0 && !fCompl1 )
486 pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1 | Gia_ObjFanin1(pObj)->fMark1;
487 else if ( !fCompl0 )
488 pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1;
489 else if ( !fCompl1 )
490 pObj->fMark1 = Gia_ObjFanin1(pObj)->fMark1;
491 else assert( 0 );
492 }
493 Gia_ManForEachCo( p, pObj, k )
494 {
495 pObj->fMark0 = Gia_ObjFanin0(pObj)->fMark0 ^ Gia_ObjFaninC0(pObj);
496 pObj->fMark1 = Gia_ObjFanin0(pObj)->fMark1;
497 }
498
499/*
500 // print input/state/output
501 printf( "%3d : ", i );
502 Gia_ManForEachPi( p, pObj, k )
503 printf( "%d", pObj->fMark0 );
504 printf( " " );
505 Gia_ManForEachRo( p, pObj, k )
506 printf( "%d", pObj->fMark0 );
507 printf( " " );
508 Gia_ManForEachPo( p, pObj, k )
509 printf( "%d", pObj->fMark0 );
510 printf( "\n" );
511*/
512 }
513 assert( iBit == pCex->nBits );
514 assert( Gia_ManPo(p, pCex->iPo)->fMark0 == 1 );
515
516 printf( "Inner states: " );
517 Bmc_CexPrint( pNew, Gia_ManPiNum(p), fVerbose );
518 printf( "Implications: " );
519 Bmc_CexPrint( pNew2, Gia_ManPiNum(p), fVerbose );
520 if ( ppCexImpl )
521 *ppCexImpl = pNew2;
522 else
523 Abc_CexFree( pNew2 );
524 return pNew;
525}
#define Gia_ManForEachPi(p, pObj, i)
Definition gia.h:1248
#define Gia_ManForEachRiRo(p, pObjRi, pObjRo, i)
Definition gia.h:1256
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Io_End()

void Io_End ( Abc_Frame_t * pAbc)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 192 of file io.c.

193{
194}
Here is the caller graph for this function:

◆ Io_Init()

void Io_Init ( Abc_Frame_t * pAbc)

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 117 of file io.c.

118{
119 Cmd_CommandAdd( pAbc, "I/O", "read", IoCommandRead, 1 );
120 Cmd_CommandAdd( pAbc, "I/O", "read_aiger", IoCommandReadAiger, 1 );
121 Cmd_CommandAdd( pAbc, "I/O", "read_baf", IoCommandReadBaf, 1 );
122 Cmd_CommandAdd( pAbc, "I/O", "read_bblif", IoCommandReadBblif, 1 );
123 Cmd_CommandAdd( pAbc, "I/O", "read_blif", IoCommandReadBlif, 1 );
124 Cmd_CommandAdd( pAbc, "I/O", "read_blif_mv", IoCommandReadBlifMv, 1 );
125 Cmd_CommandAdd( pAbc, "I/O", "read_bench", IoCommandReadBench, 1 );
126 Cmd_CommandAdd( pAbc, "I/O", "read_cex", IoCommandReadCex, 1 );
127 Cmd_CommandAdd( pAbc, "I/O", "read_dsd", IoCommandReadDsd, 1 );
128 Cmd_CommandAdd( pAbc, "I/O", "read_formula", IoCommandReadDsd, 1 );
129// Cmd_CommandAdd( pAbc, "I/O", "read_edif", IoCommandReadEdif, 1 );
130 Cmd_CommandAdd( pAbc, "I/O", "read_eqn", IoCommandReadEqn, 1 );
131 Cmd_CommandAdd( pAbc, "I/O", "read_fins", IoCommandReadFins, 0 );
132 Cmd_CommandAdd( pAbc, "I/O", "read_init", IoCommandReadInit, 1 );
133 Cmd_CommandAdd( pAbc, "I/O", "read_pla", IoCommandReadPla, 1 );
134 Cmd_CommandAdd( pAbc, "I/O", "read_plamo", IoCommandReadPlaMo, 1 );
135 Cmd_CommandAdd( pAbc, "I/O", "read_truth", IoCommandReadTruth, 1 );
136 Cmd_CommandAdd( pAbc, "I/O", "read_cnf", IoCommandReadCnf, 1 );
137 Cmd_CommandAdd( pAbc, "I/O", "read_verilog", IoCommandReadVerilog, 1 );
138 Cmd_CommandAdd( pAbc, "I/O", "read_status", IoCommandReadStatus, 0 );
139 Cmd_CommandAdd( pAbc, "I/O", "&read_gig", IoCommandReadGig, 0 );
140 Cmd_CommandAdd( pAbc, "I/O", "read_json", IoCommandReadJson, 0 );
141 Cmd_CommandAdd( pAbc, "I/O", "read_sf", IoCommandReadSF, 0 );
142 Cmd_CommandAdd( pAbc, "I/O", "read_rom", IoCommandReadRom, 1 );
143 Cmd_CommandAdd( pAbc, "I/O", "read_mm", IoCommandReadMM, 1 );
144 Cmd_CommandAdd( pAbc, "I/O", "&read_mm", IoCommandReadMMGia, 1 );
145
146 Cmd_CommandAdd( pAbc, "I/O", "write", IoCommandWrite, 0 );
147 Cmd_CommandAdd( pAbc, "I/O", "write_hie", IoCommandWriteHie, 0 );
148 Cmd_CommandAdd( pAbc, "I/O", "write_aiger", IoCommandWriteAiger, 0 );
149 Cmd_CommandAdd( pAbc, "I/O", "write_aiger_cex", IoCommandWriteAigerCex, 0 );
150 Cmd_CommandAdd( pAbc, "I/O", "write_baf", IoCommandWriteBaf, 0 );
151 Cmd_CommandAdd( pAbc, "I/O", "write_bblif", IoCommandWriteBblif, 0 );
152 Cmd_CommandAdd( pAbc, "I/O", "write_blif", IoCommandWriteBlif, 0 );
153 Cmd_CommandAdd( pAbc, "I/O", "write_blif_mv", IoCommandWriteBlifMv, 0 );
154 Cmd_CommandAdd( pAbc, "I/O", "write_bench", IoCommandWriteBench, 0 );
155 Cmd_CommandAdd( pAbc, "I/O", "write_book", IoCommandWriteBook, 0 );
156 Cmd_CommandAdd( pAbc, "I/O", "write_cellnet", IoCommandWriteCellNet, 0 );
157 Cmd_CommandAdd( pAbc, "I/O", "write_cex", IoCommandWriteCex, 0 );
158 Cmd_CommandAdd( pAbc, "I/O", "write_cnf", IoCommandWriteCnf, 0 );
159 Cmd_CommandAdd( pAbc, "I/O", "&write_cnf", IoCommandWriteCnf2, 0 );
160 Cmd_CommandAdd( pAbc, "I/O", "write_dot", IoCommandWriteDot, 0 );
161 Cmd_CommandAdd( pAbc, "I/O", "write_eqn", IoCommandWriteEqn, 0 );
162 Cmd_CommandAdd( pAbc, "I/O", "write_edgelist",IoCommandWriteEdgelist, 0 );
163 Cmd_CommandAdd( pAbc, "I/O", "write_gml", IoCommandWriteGml, 0 );
164// Cmd_CommandAdd( pAbc, "I/O", "write_list", IoCommandWriteList, 0 );
165 Cmd_CommandAdd( pAbc, "I/O", "write_hmetis", IoCommandWriteHMetis, 0 );
166 Cmd_CommandAdd( pAbc, "I/O", "write_pla", IoCommandWritePla, 0 );
167 Cmd_CommandAdd( pAbc, "I/O", "write_verilog", IoCommandWriteVerilog, 0 );
168// Cmd_CommandAdd( pAbc, "I/O", "write_verlib", IoCommandWriteVerLib, 0 );
169 Cmd_CommandAdd( pAbc, "I/O", "write_sorter_cnf", IoCommandWriteSortCnf, 0 );
170 Cmd_CommandAdd( pAbc, "I/O", "write_truth", IoCommandWriteTruth, 0 );
171 Cmd_CommandAdd( pAbc, "I/O", "&write_truth", IoCommandWriteTruths, 0 );
172 Cmd_CommandAdd( pAbc, "I/O", "&write_truths", IoCommandWriteTruths, 0 );
173 Cmd_CommandAdd( pAbc, "I/O", "write_status", IoCommandWriteStatus, 0 );
174 Cmd_CommandAdd( pAbc, "I/O", "write_smv", IoCommandWriteSmv, 0 );
175 Cmd_CommandAdd( pAbc, "I/O", "write_json", IoCommandWriteJson, 0 );
176 Cmd_CommandAdd( pAbc, "I/O", "&write_resub", IoCommandWriteResub, 0 );
177 Cmd_CommandAdd( pAbc, "I/O", "write_mm", IoCommandWriteMM, 0 );
178 Cmd_CommandAdd( pAbc, "I/O", "&write_mm", IoCommandWriteMMGia, 0 );
179}
void Cmd_CommandAdd(Abc_Frame_t *pAbc, const char *sGroup, const char *sName, Cmd_CommandFuncType pFunc, int fChanges)
Definition cmdApi.c:63
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ glo_fMapped

int glo_fMapped
extern

Definition at line 80 of file verCore.c.