ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
abcExact.c File Reference
#include "base/abc/abc.h"
#include "aig/gia/gia.h"
#include "misc/util/utilTruth.h"
#include "misc/vec/vecInt.h"
#include "misc/vec/vecPtr.h"
#include "proof/cec/cec.h"
#include "sat/bsat/satSolver.h"
Include dependency graph for abcExact.c:

Go to the source code of this file.

Classes

struct  Ses_Man_t_
 
struct  Ses_TimesEntry_t_
 
struct  Ses_TruthEntry_t_
 
struct  Ses_Store_t_
 

Macros

#define ABC_EXACT_SOL_NVARS   0
 
#define ABC_EXACT_SOL_NFUNC   1
 
#define ABC_EXACT_SOL_NGATES   2
 
#define ANSI_COLOR_RED   "\x1b[31m"
 
#define ANSI_COLOR_GREEN   "\x1b[32m"
 
#define ANSI_COLOR_YELLOW   "\x1b[33m"
 
#define ANSI_COLOR_BLUE   "\x1b[34m"
 
#define ANSI_COLOR_MAGENTA   "\x1b[35m"
 
#define ANSI_COLOR_CYAN   "\x1b[36m"
 
#define ANSI_COLOR_RESET   "\x1b[0m"
 
#define SES_STORE_TABLE_SIZE   1024
 

Typedefs

typedef struct Ses_Man_t_ Ses_Man_t
 
typedef struct Ses_TimesEntry_t_ Ses_TimesEntry_t
 
typedef struct Ses_TruthEntry_t_ Ses_TruthEntry_t
 
typedef struct Ses_Store_t_ Ses_Store_t
 

Functions

int Ses_StoreAddEntry (Ses_Store_t *pStore, word *pTruth, int nVars, int *pArrTimeProfile, char *pSol, int fResLimit)
 
int Ses_StoreGetEntrySimple (Ses_Store_t *pStore, word *pTruth, int nVars, int *pArrTimeProfile, char **pSol)
 
int Ses_StoreGetEntry (Ses_Store_t *pStore, word *pTruth, int nVars, int *pArrTimeProfile, char **pSol)
 
Abc_Ntk_tAbc_NtkFindExact (word *pTruth, int nVars, int nFunc, int nMaxDepth, int *pArrTimeProfile, int nBTLimit, int nStartGates, int fVerbose)
 
Gia_Man_tGia_ManFindExact (word *pTruth, int nVars, int nFunc, int nMaxDepth, int *pArrTimeProfile, int nBTLimit, int nStartGates, int fVerbose)
 
Abc_Ntk_tAbc_NtkFromTruthTable (word *pTruth, int nVars)
 
void Abc_ExactTestSingleOutput (int fVerbose)
 
void Abc_ExactTestSingleOutputAIG (int fVerbose)
 
void Abc_ExactTest (int fVerbose)
 
int Abc_ExactIsRunning ()
 
int Abc_ExactInputNum ()
 
void Abc_ExactStart (int nBTLimit, int fMakeAIG, int fVerbose, int fVeryVerbose, const char *pFilename)
 
void Abc_ExactStop (const char *pFilename)
 
void Abc_ExactStats ()
 
int Abc_ExactDelayCost (word *pTruth, int nVars, int *pArrTimeProfile, char *pPerm, int *Cost, int AigLevel)
 
Abc_Obj_tAbc_ExactBuildNode (word *pTruth, int nVars, int *pArrTimeProfile, Abc_Obj_t **pFanins, Abc_Ntk_t *pNtk)
 
void Abc_ExactStoreTest (int fVerbose)
 

Macro Definition Documentation

◆ ABC_EXACT_SOL_NFUNC

#define ABC_EXACT_SOL_NFUNC   1

Definition at line 204 of file abcExact.c.

◆ ABC_EXACT_SOL_NGATES

#define ABC_EXACT_SOL_NGATES   2

Definition at line 205 of file abcExact.c.

◆ ABC_EXACT_SOL_NVARS

#define ABC_EXACT_SOL_NVARS   0

Definition at line 203 of file abcExact.c.

◆ ANSI_COLOR_BLUE

#define ANSI_COLOR_BLUE   "\x1b[34m"

Definition at line 210 of file abcExact.c.

◆ ANSI_COLOR_CYAN

#define ANSI_COLOR_CYAN   "\x1b[36m"

Definition at line 212 of file abcExact.c.

◆ ANSI_COLOR_GREEN

#define ANSI_COLOR_GREEN   "\x1b[32m"

Definition at line 208 of file abcExact.c.

◆ ANSI_COLOR_MAGENTA

#define ANSI_COLOR_MAGENTA   "\x1b[35m"

Definition at line 211 of file abcExact.c.

◆ ANSI_COLOR_RED

#define ANSI_COLOR_RED   "\x1b[31m"

Definition at line 207 of file abcExact.c.

◆ ANSI_COLOR_RESET

#define ANSI_COLOR_RESET   "\x1b[0m"

Definition at line 213 of file abcExact.c.

◆ ANSI_COLOR_YELLOW

#define ANSI_COLOR_YELLOW   "\x1b[33m"

Definition at line 209 of file abcExact.c.

◆ SES_STORE_TABLE_SIZE

#define SES_STORE_TABLE_SIZE   1024

Definition at line 311 of file abcExact.c.

Typedef Documentation

◆ Ses_Man_t

typedef struct Ses_Man_t_ Ses_Man_t

Definition at line 215 of file abcExact.c.

◆ Ses_Store_t

typedef struct Ses_Store_t_ Ses_Store_t

Definition at line 312 of file abcExact.c.

◆ Ses_TimesEntry_t

Definition at line 293 of file abcExact.c.

◆ Ses_TruthEntry_t

Definition at line 302 of file abcExact.c.

Function Documentation

◆ Abc_ExactBuildNode()

Abc_Obj_t * Abc_ExactBuildNode ( word * pTruth,
int nVars,
int * pArrTimeProfile,
Abc_Obj_t ** pFanins,
Abc_Ntk_t * pNtk )

Definition at line 2894 of file abcExact.c.

2895{
2896 char * pSol = NULL;
2897 int i, j, nMaxArrival;
2898 int pNormalArrTime[8];
2899 char const * p;
2900 Abc_Obj_t * pObj;
2901 Vec_Ptr_t * pGates;
2902 char pGateTruth[5];
2903 char * pSopCover;
2904 abctime timeStart = Abc_Clock();
2905
2906 if ( nVars == 0 )
2907 {
2908 s_pSesStore->timeTotal += ( Abc_Clock() - timeStart );
2909 return (pTruth[0] & 1) ? Abc_NtkCreateNodeConst1(pNtk) : Abc_NtkCreateNodeConst0(pNtk);
2910 }
2911 if ( nVars == 1 )
2912 {
2913 s_pSesStore->timeTotal += ( Abc_Clock() - timeStart );
2914 return (pTruth[0] & 1) ? Abc_NtkCreateNodeInv(pNtk, pFanins[0]) : Abc_NtkCreateNodeBuf(pNtk, pFanins[0]);
2915 }
2916
2917 for ( i = 0; i < nVars; ++i )
2918 pNormalArrTime[i] = pArrTimeProfile[i];
2919 Abc_NormalizeArrivalTimes( pNormalArrTime, nVars, &nMaxArrival );
2920 assert( Ses_StoreGetEntry( s_pSesStore, pTruth, nVars, pNormalArrTime, &pSol ) );
2921 if ( !pSol )
2922 {
2923 s_pSesStore->timeTotal += ( Abc_Clock() - timeStart );
2924 return NULL;
2925 }
2926
2927 assert( pSol[ABC_EXACT_SOL_NVARS] == nVars );
2928 assert( pSol[ABC_EXACT_SOL_NFUNC] == 1 );
2929
2930 pGates = Vec_PtrAlloc( nVars + pSol[ABC_EXACT_SOL_NGATES] );
2931 pGateTruth[3] = '0';
2932 pGateTruth[4] = '\0';
2933
2934 /* primary inputs */
2935 for ( i = 0; i < nVars; ++i )
2936 {
2937 assert( pFanins[i] );
2938 Vec_PtrPush( pGates, pFanins[i] );
2939 }
2940
2941 /* gates */
2942 p = pSol + 3;
2943 for ( i = 0; i < pSol[ABC_EXACT_SOL_NGATES]; ++i )
2944 {
2945 pGateTruth[2] = '0' + ( *p & 1 );
2946 pGateTruth[1] = '0' + ( ( *p >> 1 ) & 1 );
2947 pGateTruth[0] = '0' + ( ( *p >> 2 ) & 1 );
2948 ++p;
2949
2950 assert( *p == 2 ); /* binary gate */
2951 ++p;
2952
2953 /* invert truth table if we are last gate and inverted */
2954 if ( i + 1 == pSol[ABC_EXACT_SOL_NGATES] && Abc_LitIsCompl( *( p + 2 ) ) )
2955 for ( j = 0; j < 4; ++j )
2956 pGateTruth[j] = ( pGateTruth[j] == '0' ) ? '1' : '0';
2957
2958 pSopCover = Abc_SopFromTruthBin( pGateTruth );
2959 pObj = Abc_NtkCreateNode( pNtk );
2960 assert( pObj );
2961 pObj->pData = Abc_SopRegister( (Mem_Flex_t*)pNtk->pManFunc, pSopCover );
2962 Vec_PtrPush( pGates, pObj );
2963 ABC_FREE( pSopCover );
2964
2965 Abc_ObjAddFanin( pObj, (Abc_Obj_t *)Vec_PtrEntry( pGates, *p++ ) );
2966 Abc_ObjAddFanin( pObj, (Abc_Obj_t *)Vec_PtrEntry( pGates, *p++ ) );
2967 }
2968
2969 /* output */
2970 pObj = (Abc_Obj_t *)Vec_PtrEntry( pGates, nVars + Abc_Lit2Var( *p ) );
2971
2972 Vec_PtrFree( pGates );
2973
2974 s_pSesStore->timeTotal += ( Abc_Clock() - timeStart );
2975 return pObj;
2976}
#define ABC_EXACT_SOL_NGATES
Definition abcExact.c:205
int Ses_StoreGetEntry(Ses_Store_t *pStore, word *pTruth, int nVars, int *pArrTimeProfile, char **pSol)
Definition abcExact.c:768
#define ABC_EXACT_SOL_NVARS
Definition abcExact.c:203
#define ABC_EXACT_SOL_NFUNC
Definition abcExact.c:204
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition abcFanio.c:84
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst1(Abc_Ntk_t *pNtk)
Definition abcObj.c:643
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeBuf(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition abcObj.c:706
ABC_DLL char * Abc_SopFromTruthBin(char *pTruth)
Definition abcSop.c:964
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst0(Abc_Ntk_t *pNtk)
Definition abcObj.c:612
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition abcObj.c:674
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, const char *pName)
DECLARATIONS ///.
Definition abcSop.c:62
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_FREE(obj)
Definition abc_global.h:267
Cube * p
Definition exorList.c:222
struct Mem_Flex_t_ Mem_Flex_t
Definition mem.h:34
void * pManFunc
Definition abc.h:191
void * pData
Definition abc.h:145
#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_ExactDelayCost()

int Abc_ExactDelayCost ( word * pTruth,
int nVars,
int * pArrTimeProfile,
char * pPerm,
int * Cost,
int AigLevel )

Definition at line 2716 of file abcExact.c.

2717{
2718 int i, nMaxArrival, nDelta, l;
2719 Ses_Man_t * pSes = NULL;
2720 char * pSol = NULL, * pSol2 = NULL, * p;
2721 int pNormalArrTime[8];
2722 int Delay = ABC_INFINITY, nMaxDepth, fResLimit;
2723 abctime timeStart = Abc_Clock(), timeStartExact;
2724
2725 /* some checks */
2726 if ( nVars < 0 || nVars > 8 )
2727 {
2728 printf( "invalid truth table size %d\n", nVars );
2729 assert( 0 );
2730 }
2731
2732 /* statistics */
2733 s_pSesStore->nCutCount++;
2734 s_pSesStore->pCutCount[nVars]++;
2735
2736 if ( nVars == 0 )
2737 {
2738 s_pSesStore->nSynthesizedTrivial++;
2739 s_pSesStore->pSynthesizedTrivial[0]++;
2740
2741 *Cost = 0;
2742 s_pSesStore->timeTotal += ( Abc_Clock() - timeStart );
2743 return 0;
2744 }
2745
2746 if ( nVars == 1 )
2747 {
2748 s_pSesStore->nSynthesizedTrivial++;
2749 s_pSesStore->pSynthesizedTrivial[1]++;
2750
2751 *Cost = 0;
2752 pPerm[0] = (char)0;
2753 s_pSesStore->timeTotal += ( Abc_Clock() - timeStart );
2754 return pArrTimeProfile[0];
2755 }
2756
2757 for ( l = 0; l < nVars; ++l )
2758 pNormalArrTime[l] = pArrTimeProfile[l];
2759
2760 nDelta = Abc_NormalizeArrivalTimes( pNormalArrTime, nVars, &nMaxArrival );
2761
2762 *Cost = ABC_INFINITY;
2763
2764 if ( Ses_StoreGetEntry( s_pSesStore, pTruth, nVars, pNormalArrTime, &pSol ) )
2765 {
2766 s_pSesStore->nCacheHits++;
2767 s_pSesStore->pCacheHits[nVars]++;
2768 }
2769 else
2770 {
2771 if ( s_pSesStore->fVeryVerbose )
2772 {
2773 printf( ANSI_COLOR_CYAN );
2774 Abc_TtPrintHexRev( stdout, pTruth, nVars );
2775 printf( ANSI_COLOR_RESET );
2776 printf( " [%d", pNormalArrTime[0] );
2777 for ( l = 1; l < nVars; ++l )
2778 printf( " %d", pNormalArrTime[l] );
2779 printf( "]@%d:", AigLevel );
2780 fflush( stdout );
2781 }
2782
2783 nMaxDepth = pNormalArrTime[0];
2784 for ( i = 1; i < nVars; ++i )
2785 nMaxDepth = Abc_MaxInt( nMaxDepth, pNormalArrTime[i] );
2786 nMaxDepth += nVars + 1;
2787 if ( AigLevel != -1 )
2788 nMaxDepth = Abc_MinInt( AigLevel - nDelta, nMaxDepth + nVars + 1 );
2789
2790 timeStartExact = Abc_Clock();
2791
2792 pSes = Ses_ManAlloc( pTruth, nVars, 1 /* nSpecFunc */, nMaxDepth, pNormalArrTime, s_pSesStore->fMakeAIG, s_pSesStore->nBTLimit, s_pSesStore->fVerbose );
2793 pSes->fVeryVerbose = s_pSesStore->fVeryVerbose;
2794 pSes->pSat = s_pSesStore->pSat;
2795 pSes->nStartGates = nVars - 2;
2796
2797 while ( pSes->nMaxDepth ) /* there is improvement */
2798 {
2799 if ( s_pSesStore->fVeryVerbose )
2800 {
2801 printf( " %d", pSes->nMaxDepth );
2802 fflush( stdout );
2803 }
2804
2805 if ( ( pSol2 = Ses_ManFindMinimumSize( pSes ) ) != NULL )
2806 {
2807 if ( s_pSesStore->fVeryVerbose )
2808 {
2809 if ( pSes->nMaxDepth >= 10 ) printf( "\b" );
2810 printf( "\b" ANSI_COLOR_GREEN "%d" ANSI_COLOR_RESET, pSes->nMaxDepth );
2811 }
2812 if ( pSol )
2813 ABC_FREE( pSol );
2814 pSol = pSol2;
2815 pSes->nMaxDepth--;
2816 }
2817 else
2818 {
2819 if ( s_pSesStore->fVeryVerbose )
2820 {
2821 if ( pSes->nMaxDepth >= 10 ) printf( "\b" );
2822 printf( "\b%s%d" ANSI_COLOR_RESET, pSes->fHitResLimit ? ANSI_COLOR_RED : ANSI_COLOR_YELLOW, pSes->nMaxDepth );
2823 }
2824 break;
2825 }
2826 }
2827
2828 if ( s_pSesStore->fVeryVerbose )
2829 printf( " \n" );
2830
2831 /* log unsuccessful case for debugging */
2832 if ( s_pSesStore->pDebugEntries && pSes->fHitResLimit )
2833 Ses_StorePrintDebugEntry( s_pSesStore, pTruth, nVars, pNormalArrTime, pSes->nMaxDepth, pSol, nVars - 2 );
2834
2835 pSes->timeTotal = Abc_Clock() - timeStartExact;
2836
2837 /* statistics */
2838 s_pSesStore->nSatCalls += pSes->nSatCalls;
2839 s_pSesStore->nUnsatCalls += pSes->nUnsatCalls;
2840 s_pSesStore->nUndefCalls += pSes->nUndefCalls;
2841
2842 s_pSesStore->timeSat += pSes->timeSat;
2843 s_pSesStore->timeSatSat += pSes->timeSatSat;
2844 s_pSesStore->timeSatUnsat += pSes->timeSatUnsat;
2845 s_pSesStore->timeSatUndef += pSes->timeSatUndef;
2846 s_pSesStore->timeInstance += pSes->timeInstance;
2847 s_pSesStore->timeExact += pSes->timeTotal;
2848
2849 /* cleanup (we need to clean before adding since pTruth may have been modified by pSes) */
2850 fResLimit = pSes->fHitResLimit;
2851 Ses_ManCleanLight( pSes );
2852
2853 /* store solution */
2854 Ses_StoreAddEntry( s_pSesStore, pTruth, nVars, pNormalArrTime, pSol, fResLimit );
2855 }
2856
2857 if ( pSol )
2858 {
2859 *Cost = pSol[ABC_EXACT_SOL_NGATES];
2860 p = pSol + 3 + 4 * pSol[ABC_EXACT_SOL_NGATES] + 1;
2861 Delay = *p++;
2862 for ( l = 0; l < nVars; ++l )
2863 pPerm[l] = *p++;
2864 }
2865
2866 if ( pSol )
2867 {
2868 int Delay2 = 0;
2869 for ( l = 0; l < nVars; ++l )
2870 {
2871 //printf( "%d ", pPerm[l] );
2872 Delay2 = Abc_MaxInt( Delay2, pArrTimeProfile[l] + pPerm[l] );
2873 }
2874 //printf( " output arrival = %d recomputed = %d\n", Delay, Delay2 );
2875 //if ( Delay != Delay2 )
2876 //{
2877 // printf( "^--- BUG!\n" );
2878 // assert( 0 );
2879 //}
2880
2881 s_pSesStore->timeTotal += ( Abc_Clock() - timeStart );
2882 return Delay2;
2883 }
2884 else
2885 {
2886 assert( *Cost == ABC_INFINITY );
2887
2888 s_pSesStore->timeTotal += ( Abc_Clock() - timeStart );
2889 return ABC_INFINITY;
2890 }
2891}
#define ANSI_COLOR_RED
Definition abcExact.c:207
#define ANSI_COLOR_YELLOW
Definition abcExact.c:209
#define ANSI_COLOR_CYAN
Definition abcExact.c:212
#define ANSI_COLOR_RESET
Definition abcExact.c:213
#define ANSI_COLOR_GREEN
Definition abcExact.c:208
int Ses_StoreAddEntry(Ses_Store_t *pStore, word *pTruth, int nVars, int *pArrTimeProfile, char *pSol, int fResLimit)
Definition abcExact.c:629
struct Ses_Man_t_ Ses_Man_t
Definition abcExact.c:215
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
int nMaxDepth
Definition abcExact.c:226
int nSatCalls
Definition abcExact.c:275
abctime timeSatUnsat
Definition abcExact.c:270
int fHitResLimit
Definition abcExact.c:266
abctime timeSatSat
Definition abcExact.c:269
abctime timeSat
Definition abcExact.c:268
int nUndefCalls
Definition abcExact.c:277
abctime timeSatUndef
Definition abcExact.c:271
sat_solver * pSat
Definition abcExact.c:218
int nStartGates
Definition abcExact.c:246
int fVeryVerbose
Definition abcExact.c:235
abctime timeInstance
Definition abcExact.c:272
abctime timeTotal
Definition abcExact.c:273
int nUnsatCalls
Definition abcExact.c:276
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ExactInputNum()

int Abc_ExactInputNum ( )

Definition at line 2611 of file abcExact.c.

2612{
2613 return 8;
2614}

◆ Abc_ExactIsRunning()

int Abc_ExactIsRunning ( )

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

Synopsis [APIs for integraging with the mapper.]

Definition at line 2605 of file abcExact.c.

2606{
2607 return s_pSesStore != NULL;
2608}

◆ Abc_ExactStart()

void Abc_ExactStart ( int nBTLimit,
int fMakeAIG,
int fVerbose,
int fVeryVerbose,
const char * pFilename )

Definition at line 2616 of file abcExact.c.

2617{
2618 if ( !s_pSesStore )
2619 {
2620 s_pSesStore = Ses_StoreAlloc( nBTLimit, fMakeAIG, fVerbose );
2621 s_pSesStore->fVeryVerbose = fVeryVerbose;
2622 if ( pFilename )
2623 {
2624 Ses_StoreRead( s_pSesStore, pFilename, 1, 0, 0, 0 );
2625
2626 s_pSesStore->szDBName = ABC_CALLOC( char, strlen( pFilename ) + 1 );
2627 strcpy( s_pSesStore->szDBName, pFilename );
2628 }
2629 if ( s_pSesStore->fVeryVerbose )
2630 {
2631 s_pSesStore->pDebugEntries = fopen( "bms.debug", "w" );
2632 }
2633 }
2634 else
2635 printf( "BMS manager already started\n" );
2636}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
int strlen()
char * strcpy()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ExactStats()

void Abc_ExactStats ( )

Definition at line 2652 of file abcExact.c.

2653{
2654 int i;
2655
2656 if ( !s_pSesStore )
2657 {
2658 printf( "BMS manager has not been started\n" );
2659 return;
2660 }
2661
2662 printf( "-------------------------------------------------------------------------------------------------------------------------------\n" );
2663 printf( " 0 1 2 3 4 5 6 7 8 total\n" );
2664 printf( "-------------------------------------------------------------------------------------------------------------------------------\n" );
2665 printf( "number of considered cuts :" );
2666 for ( i = 0; i < 9; ++i )
2667 printf( "%10lu", s_pSesStore->pCutCount[i] );
2668 printf( "%10lu\n", s_pSesStore->nCutCount );
2669 printf( " - trivial :" );
2670 for ( i = 0; i < 9; ++i )
2671 printf( "%10lu", s_pSesStore->pSynthesizedTrivial[i] );
2672 printf( "%10lu\n", s_pSesStore->nSynthesizedTrivial );
2673 printf( " - synth (imp) :" );
2674 for ( i = 0; i < 9; ++i )
2675 printf( "%10lu", s_pSesStore->pSynthesizedImp[i] );
2676 printf( "%10lu\n", s_pSesStore->nSynthesizedImp );
2677 printf( " - synth (res) :" );
2678 for ( i = 0; i < 9; ++i )
2679 printf( "%10lu", s_pSesStore->pSynthesizedRL[i] );
2680 printf( "%10lu\n", s_pSesStore->nSynthesizedRL );
2681 printf( " - not synth (imp) :" );
2682 for ( i = 0; i < 9; ++i )
2683 printf( "%10lu", s_pSesStore->pUnsynthesizedImp[i] );
2684 printf( "%10lu\n", s_pSesStore->nUnsynthesizedImp );
2685 printf( " - not synth (res) :" );
2686 for ( i = 0; i < 9; ++i )
2687 printf( "%10lu", s_pSesStore->pUnsynthesizedRL[i] );
2688 printf( "%10lu\n", s_pSesStore->nUnsynthesizedRL );
2689 printf( " - cache hits :" );
2690 for ( i = 0; i < 9; ++i )
2691 printf( "%10lu", s_pSesStore->pCacheHits[i] );
2692 printf( "%10lu\n", s_pSesStore->nCacheHits );
2693 printf( "-------------------------------------------------------------------------------------------------------------------------------\n" );
2694 printf( "number of entries : %d\n", s_pSesStore->nEntriesCount );
2695 printf( "number of valid entries : %d\n", s_pSesStore->nValidEntriesCount );
2696 printf( "number of invalid entries : %d\n", s_pSesStore->nEntriesCount - s_pSesStore->nValidEntriesCount );
2697 printf( "-------------------------------------------------------------------------------------------------------------------------------\n" );
2698 printf( "number of SAT calls : %lu\n", s_pSesStore->nSatCalls );
2699 printf( "number of UNSAT calls : %lu\n", s_pSesStore->nUnsatCalls );
2700 printf( "number of UNDEF calls : %lu\n", s_pSesStore->nUndefCalls );
2701
2702 printf( "-------------------------------------------------------------------------------------------------------------------------------\n" );
2703 printf( "Runtime breakdown:\n" );
2704 ABC_PRTP( "Exact ", s_pSesStore->timeExact, s_pSesStore->timeTotal );
2705 ABC_PRTP( " Sat ", s_pSesStore->timeSat, s_pSesStore->timeTotal );
2706 ABC_PRTP( " Sat ", s_pSesStore->timeSatSat, s_pSesStore->timeTotal );
2707 ABC_PRTP( " Unsat ", s_pSesStore->timeSatUnsat, s_pSesStore->timeTotal );
2708 ABC_PRTP( " Undef ", s_pSesStore->timeSatUndef, s_pSesStore->timeTotal );
2709 ABC_PRTP( " Instance", s_pSesStore->timeInstance, s_pSesStore->timeTotal );
2710 ABC_PRTP( "Other ", s_pSesStore->timeTotal - s_pSesStore->timeExact, s_pSesStore->timeTotal );
2711 ABC_PRTP( "ALL ", s_pSesStore->timeTotal, s_pSesStore->timeTotal );
2712}
#define ABC_PRTP(a, t, T)
Definition abc_global.h:258

◆ Abc_ExactStop()

void Abc_ExactStop ( const char * pFilename)

Definition at line 2638 of file abcExact.c.

2639{
2640 if ( s_pSesStore )
2641 {
2642 if ( pFilename )
2643 Ses_StoreWrite( s_pSesStore, pFilename, 1, 0, 0, 0 );
2644 if ( s_pSesStore->pDebugEntries )
2645 fclose( s_pSesStore->pDebugEntries );
2646 Ses_StoreClean( s_pSesStore );
2647 }
2648 else
2649 printf( "BMS manager has not been started\n" );
2650}
Here is the caller graph for this function:

◆ Abc_ExactStoreTest()

void Abc_ExactStoreTest ( int fVerbose)

Definition at line 2978 of file abcExact.c.

2979{
2980 int i;
2981 word pTruth[4] = {0xcafe, 0, 0, 0};
2982 int pArrTimeProfile[4] = {6, 2, 8, 5};
2983 Abc_Ntk_t * pNtk;
2984 Abc_Obj_t * pFanins[4];
2985 Vec_Ptr_t * vNames;
2986 char pPerm[4] = {0};
2987 int Cost = 0;
2988
2990 pNtk->pName = Extra_UtilStrsav( "exact" );
2991 vNames = Abc_NodeGetFakeNames( 4u );
2992
2993 /* primary inputs */
2994 Vec_PtrPush( pNtk->vObjs, NULL );
2995 for ( i = 0; i < 4; ++i )
2996 {
2997 pFanins[i] = Abc_NtkCreatePi( pNtk );
2998 Abc_ObjAssignName( pFanins[i], (char*)Vec_PtrEntry( vNames, i ), NULL );
2999 }
3000 Abc_NodeFreeNames( vNames );
3001
3002 Abc_ExactStart( 10000, 1, fVerbose, 0, NULL );
3003
3004 assert( !Abc_ExactBuildNode( pTruth, 4, pArrTimeProfile, pFanins, pNtk ) );
3005
3006 assert( Abc_ExactDelayCost( pTruth, 4, pArrTimeProfile, pPerm, &Cost, 12 ) == 1 );
3007
3008 assert( Abc_ExactBuildNode( pTruth, 4, pArrTimeProfile, pFanins, pNtk ) );
3009
3010 (*pArrTimeProfile)++;
3011 assert( !Abc_ExactBuildNode( pTruth, 4, pArrTimeProfile, pFanins, pNtk ) );
3012 (*pArrTimeProfile)--;
3013
3014 Abc_ExactStop( NULL );
3015
3016 Abc_NtkDelete( pNtk );
3017}
int Abc_ExactDelayCost(word *pTruth, int nVars, int *pArrTimeProfile, char *pPerm, int *Cost, int AigLevel)
Definition abcExact.c:2716
Abc_Obj_t * Abc_ExactBuildNode(word *pTruth, int nVars, int *pArrTimeProfile, Abc_Obj_t **pFanins, Abc_Ntk_t *pNtk)
Definition abcExact.c:2894
void Abc_ExactStop(const char *pFilename)
Definition abcExact.c:2638
void Abc_ExactStart(int nBTLimit, int fMakeAIG, int fVerbose, int fVeryVerbose, const char *pFilename)
Definition abcExact.c:2616
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_NodeFreeNames(Vec_Ptr_t *vNames)
Definition abcNames.c:264
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition abcNames.c:69
@ ABC_NTK_LOGIC
Definition abc.h:57
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition abcNtk.c:1421
@ ABC_FUNC_SOP
Definition abc.h:65
ABC_DLL Vec_Ptr_t * Abc_NodeGetFakeNames(int nNames)
Definition abcNames.c:228
char * Extra_UtilStrsav(const char *s)
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
char * pName
Definition abc.h:158
Vec_Ptr_t * vObjs
Definition abc.h:162
Here is the call graph for this function:

◆ Abc_ExactTest()

void Abc_ExactTest ( int fVerbose)

Definition at line 2589 of file abcExact.c.

2590{
2591 Abc_ExactTestSingleOutput( fVerbose );
2592 Abc_ExactTestSingleOutputAIG( fVerbose );
2593
2594 printf( "\n" );
2595}
void Abc_ExactTestSingleOutput(int fVerbose)
Definition abcExact.c:2509
void Abc_ExactTestSingleOutputAIG(int fVerbose)
Definition abcExact.c:2547
Here is the call graph for this function:

◆ Abc_ExactTestSingleOutput()

void Abc_ExactTestSingleOutput ( int fVerbose)

Definition at line 2509 of file abcExact.c.

2510{
2511 extern void Abc_NtkCecSat( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nConfLimit, int nInsLimit );
2512
2513 word pTruth[4] = {0xcafe, 0, 0, 0};
2514 Abc_Ntk_t * pNtk, * pNtk2, * pNtk3, * pNtk4;
2515 int pArrTimeProfile[4] = {6, 2, 8, 5};
2516
2517 pNtk = Abc_NtkFromTruthTable( pTruth, 4 );
2518
2519 pNtk2 = Abc_NtkFindExact( pTruth, 4, 1, -1, NULL, 0, 0, fVerbose );
2520 Abc_NtkShortNames( pNtk2 );
2521 Abc_NtkCecSat( pNtk, pNtk2, 10000, 0 );
2522 assert( pNtk2 );
2523 assert( Abc_NtkNodeNum( pNtk2 ) == 6 );
2524 Abc_NtkDelete( pNtk2 );
2525
2526 pNtk3 = Abc_NtkFindExact( pTruth, 4, 1, 3, NULL, 0, 0, fVerbose );
2527 Abc_NtkShortNames( pNtk3 );
2528 Abc_NtkCecSat( pNtk, pNtk3, 10000, 0 );
2529 assert( pNtk3 );
2530 assert( Abc_NtkLevel( pNtk3 ) <= 3 );
2531 Abc_NtkDelete( pNtk3 );
2532
2533 pNtk4 = Abc_NtkFindExact( pTruth, 4, 1, 9, pArrTimeProfile, 50000, 0, fVerbose );
2534 Abc_NtkShortNames( pNtk4 );
2535 Abc_NtkCecSat( pNtk, pNtk4, 10000, 0 );
2536 assert( pNtk4 );
2537 assert( Abc_NtkLevel( pNtk4 ) <= 9 );
2538 Abc_NtkDelete( pNtk4 );
2539
2540 assert( !Abc_NtkFindExact( pTruth, 4, 1, 2, NULL, 50000, 0, fVerbose ) );
2541
2542 assert( !Abc_NtkFindExact( pTruth, 4, 1, 8, pArrTimeProfile, 50000, 0, fVerbose ) );
2543
2544 Abc_NtkDelete( pNtk );
2545}
Abc_Ntk_t * Abc_NtkFromTruthTable(word *pTruth, int nVars)
Definition abcExact.c:2494
Abc_Ntk_t * Abc_NtkFindExact(word *pTruth, int nVars, int nFunc, int nMaxDepth, int *pArrTimeProfile, int nBTLimit, int nStartGates, int fVerbose)
Definition abcExact.c:2414
void Abc_NtkCecSat(Abc_Ntk_t *pNtk1, Abc_Ntk_t *pNtk2, int nConfLimit, int nInsLimit)
FUNCTION DEFINITIONS ///.
Definition abcVerify.c:56
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition abcDfs.c:1449
ABC_DLL void Abc_NtkShortNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:619
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ExactTestSingleOutputAIG()

void Abc_ExactTestSingleOutputAIG ( int fVerbose)

Definition at line 2547 of file abcExact.c.

2548{
2549 word pTruth[4] = {0xcafe, 0, 0, 0};
2550 Abc_Ntk_t * pNtk;
2551 Gia_Man_t * pGia, * pGia2, * pGia3, * pGia4, * pMiter;
2552 Cec_ParCec_t ParsCec, * pPars = &ParsCec;
2553 int pArrTimeProfile[4] = {6, 2, 8, 5};
2554
2556
2557 pNtk = Abc_NtkFromTruthTable( pTruth, 4 );
2558 Abc_NtkToAig( pNtk );
2559 pGia = Abc_NtkAigToGia( pNtk, 1 );
2560
2561 pGia2 = Gia_ManFindExact( pTruth, 4, 1, -1, NULL, 0, 0, fVerbose );
2562 pMiter = Gia_ManMiter( pGia, pGia2, 0, 1, 0, 0, 1 );
2563 assert( pMiter );
2564 Cec_ManVerify( pMiter, pPars );
2565 Gia_ManStop( pMiter );
2566
2567 pGia3 = Gia_ManFindExact( pTruth, 4, 1, 3, NULL, 0, 0, fVerbose );
2568 pMiter = Gia_ManMiter( pGia, pGia3, 0, 1, 0, 0, 1 );
2569 assert( pMiter );
2570 Cec_ManVerify( pMiter, pPars );
2571 Gia_ManStop( pMiter );
2572
2573 pGia4 = Gia_ManFindExact( pTruth, 4, 1, 9, pArrTimeProfile, 50000, 0, fVerbose );
2574 pMiter = Gia_ManMiter( pGia, pGia4, 0, 1, 0, 0, 1 );
2575 assert( pMiter );
2576 Cec_ManVerify( pMiter, pPars );
2577 Gia_ManStop( pMiter );
2578
2579 assert( !Gia_ManFindExact( pTruth, 4, 1, 2, NULL, 50000, 0, fVerbose ) );
2580
2581 assert( !Gia_ManFindExact( pTruth, 4, 1, 8, pArrTimeProfile, 50000, 0, fVerbose ) );
2582
2583 Gia_ManStop( pGia );
2584 Gia_ManStop( pGia2 );
2585 Gia_ManStop( pGia3 );
2586 Gia_ManStop( pGia4 );
2587}
Gia_Man_t * Gia_ManFindExact(word *pTruth, int nVars, int nFunc, int nMaxDepth, int *pArrTimeProfile, int nBTLimit, int nStartGates, int fVerbose)
Definition abcExact.c:2450
ABC_DLL Gia_Man_t * Abc_NtkAigToGia(Abc_Ntk_t *p, int fGiaSimple)
Definition abcFunc.c:1050
ABC_DLL int Abc_NtkToAig(Abc_Ntk_t *pNtk)
Definition abcFunc.c:1333
void Cec_ManCecSetDefaultParams(Cec_ParCec_t *p)
Definition cecCore.c:159
struct Cec_ParCec_t_ Cec_ParCec_t
Definition cec.h:129
int Cec_ManVerify(Gia_Man_t *p, Cec_ParCec_t *pPars)
MACRO DEFINITIONS ///.
Definition cecCec.c:326
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Gia_Man_t * Gia_ManMiter(Gia_Man_t *pAig0, Gia_Man_t *pAig1, int nInsDup, int fDualOut, int fSeq, int fImplic, int fVerbose)
Definition giaDup.c:2983
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkFindExact()

Abc_Ntk_t * Abc_NtkFindExact ( word * pTruth,
int nVars,
int nFunc,
int nMaxDepth,
int * pArrTimeProfile,
int nBTLimit,
int nStartGates,
int fVerbose )

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

Synopsis [Find minimum size networks with a SAT solver.]

Description [If nMaxDepth is -1, then depth constraints are ignored. If nMaxDepth is not -1, one can set pArrTimeProfile which should have the length of nVars. One can ignore pArrTimeProfile by setting it to NULL.]

SideEffects []

SeeAlso []

Definition at line 2414 of file abcExact.c.

2415{
2416 Ses_Man_t * pSes;
2417 char * pSol;
2418 Abc_Ntk_t * pNtk = NULL;
2419 abctime timeStart;
2420
2421 /* some checks */
2422 assert( nVars >= 2 && nVars <= 8 );
2423
2424 timeStart = Abc_Clock();
2425
2426 pSes = Ses_ManAlloc( pTruth, nVars, nFunc, nMaxDepth, pArrTimeProfile, 0, nBTLimit, fVerbose );
2427 pSes->nStartGates = nStartGates;
2428 pSes->fReasonVerbose = 0;
2429 pSes->fSatVerbose = 0;
2430 if ( fVerbose )
2431 Ses_ManPrintFuncs( pSes );
2432
2433 if ( ( pSol = Ses_ManFindMinimumSize( pSes ) ) != NULL )
2434 {
2435 pNtk = Ses_ManExtractNtk( pSol );
2436 ABC_FREE( pSol );
2437 }
2438
2439 pSes->timeTotal = Abc_Clock() - timeStart;
2440
2441 if ( fVerbose )
2442 Ses_ManPrintRuntime( pSes );
2443
2444 /* cleanup */
2445 Ses_ManClean( pSes );
2446
2447 return pNtk;
2448}
int fSatVerbose
Definition abcExact.c:237
int fReasonVerbose
Definition abcExact.c:238
Here is the caller graph for this function:

◆ Abc_NtkFromTruthTable()

Abc_Ntk_t * Abc_NtkFromTruthTable ( word * pTruth,
int nVars )

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

Synopsis [Some test cases.]

Definition at line 2494 of file abcExact.c.

2495{
2496 Abc_Ntk_t * pNtk;
2497 Mem_Flex_t * pMan;
2498 char * pSopCover;
2499
2500 pMan = Mem_FlexStart();
2501 pSopCover = Abc_SopCreateFromTruth( pMan, nVars, (unsigned*)pTruth );
2502 pNtk = Abc_NtkCreateWithNode( pSopCover );
2503 Abc_NtkShortNames( pNtk );
2504 Mem_FlexStop( pMan, 0 );
2505
2506 return pNtk;
2507}
ABC_DLL char * Abc_SopCreateFromTruth(Mem_Flex_t *pMan, int nVars, unsigned *pTruth)
Definition abcSop.c:383
ABC_DLL Abc_Ntk_t * Abc_NtkCreateWithNode(char *pSop)
Definition abcNtk.c:1333
Mem_Flex_t * Mem_FlexStart()
Definition mem.c:327
void Mem_FlexStop(Mem_Flex_t *p, int fVerbose)
Definition mem.c:359
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManFindExact()

Gia_Man_t * Gia_ManFindExact ( word * pTruth,
int nVars,
int nFunc,
int nMaxDepth,
int * pArrTimeProfile,
int nBTLimit,
int nStartGates,
int fVerbose )

Definition at line 2450 of file abcExact.c.

2451{
2452 Ses_Man_t * pSes;
2453 char * pSol;
2454 Gia_Man_t * pGia = NULL;
2455 abctime timeStart;
2456
2457 /* some checks */
2458 assert( nVars >= 2 && nVars <= 8 );
2459
2460 timeStart = Abc_Clock();
2461
2462 pSes = Ses_ManAlloc( pTruth, nVars, nFunc, nMaxDepth, pArrTimeProfile, 1, nBTLimit, fVerbose );
2463 pSes->nStartGates = nStartGates;
2464 pSes->fVeryVerbose = 1;
2465 pSes->fExtractVerbose = 0;
2466 pSes->fSatVerbose = 0;
2467 pSes->fReasonVerbose = 1;
2468 if ( fVerbose )
2469 Ses_ManPrintFuncs( pSes );
2470
2471 if ( ( pSol = Ses_ManFindMinimumSize( pSes ) ) != NULL )
2472 {
2473 pGia = Ses_ManExtractGia( pSol );
2474 ABC_FREE( pSol );
2475 }
2476
2477 pSes->timeTotal = Abc_Clock() - timeStart;
2478
2479 if ( fVerbose )
2480 Ses_ManPrintRuntime( pSes );
2481
2482 /* cleanup */
2483 Ses_ManClean( pSes );
2484
2485 return pGia;
2486}
int fExtractVerbose
Definition abcExact.c:236
Here is the caller graph for this function:

◆ Ses_StoreAddEntry()

int Ses_StoreAddEntry ( Ses_Store_t * pStore,
word * pTruth,
int nVars,
int * pArrTimeProfile,
char * pSol,
int fResLimit )

Definition at line 629 of file abcExact.c.

630{
631 int key, fAdded;
632 Ses_TruthEntry_t * pTEntry;
633 Ses_TimesEntry_t * pTiEntry;
634
635 if ( pSol )
636 Abc_ExactNormalizeArrivalTimesForNetwork( nVars, pArrTimeProfile, pSol );
637
638 key = Ses_StoreTableHash( pTruth, nVars );
639 pTEntry = pStore->pEntries[key];
640
641 /* does truth table already exist? */
642 while ( pTEntry )
643 {
644 if ( Ses_StoreTruthEqual( pTEntry, pTruth, nVars ) )
645 break;
646 else
647 pTEntry = pTEntry->next;
648 }
649
650 /* entry does not yet exist, so create new one and enqueue */
651 if ( !pTEntry )
652 {
653 pTEntry = ABC_CALLOC( Ses_TruthEntry_t, 1 );
654 Ses_StoreTruthCopy( pTEntry, pTruth, nVars );
655 pTEntry->next = pStore->pEntries[key];
656 pStore->pEntries[key] = pTEntry;
657 }
658
659 /* does arrival time already exist? */
660 pTiEntry = pTEntry->head;
661 while ( pTiEntry )
662 {
663 if ( Ses_StoreTimesEqual( pArrTimeProfile, pTiEntry->pArrTimeProfile, nVars ) )
664 break;
665 else
666 pTiEntry = pTiEntry->next;
667 }
668
669 /* entry does not yet exist, so create new one and enqueue */
670 if ( !pTiEntry )
671 {
672 pTiEntry = ABC_CALLOC( Ses_TimesEntry_t, 1 );
673 Ses_StoreTimesCopy( pTiEntry->pArrTimeProfile, pArrTimeProfile, nVars );
674 pTiEntry->pNetwork = pSol;
675 pTiEntry->fResLimit = fResLimit;
676 pTiEntry->next = pTEntry->head;
677 pTEntry->head = pTiEntry;
678
679 /* item has been added */
680 fAdded = 1;
681 pStore->nEntriesCount++;
682 if ( pSol )
683 pStore->nValidEntriesCount++;
684 }
685 else
686 {
687 //assert( 0 );
688 /* item was already present */
689 fAdded = 0;
690 }
691
692 /* statistics */
693 if ( pSol )
694 {
695 if ( fResLimit )
696 {
697 pStore->nSynthesizedRL++;
698 pStore->pSynthesizedRL[nVars]++;
699 }
700 else
701 {
702 pStore->nSynthesizedImp++;
703 pStore->pSynthesizedImp[nVars]++;
704 }
705 }
706 else
707 {
708 if ( fResLimit )
709 {
710 pStore->nUnsynthesizedRL++;
711 pStore->pUnsynthesizedRL[nVars]++;
712 }
713 else
714 {
715 pStore->nUnsynthesizedImp++;
716 pStore->pUnsynthesizedImp[nVars]++;
717 }
718 }
719
720 if ( fAdded && pStore->szDBName )
721 Ses_StoreWrite( pStore, pStore->szDBName, 1, 0, 0, 0 );
722
723 return fAdded;
724}
struct Ses_TruthEntry_t_ Ses_TruthEntry_t
Definition abcExact.c:302
struct Ses_TimesEntry_t_ Ses_TimesEntry_t
Definition abcExact.c:293
enum keys key
Definition main.h:25
unsigned long nSynthesizedRL
Definition abcExact.c:337
unsigned long pUnsynthesizedRL[9]
Definition abcExact.c:332
unsigned long nSynthesizedImp
Definition abcExact.c:335
unsigned long pSynthesizedImp[9]
Definition abcExact.c:336
unsigned long pSynthesizedRL[9]
Definition abcExact.c:338
unsigned long pUnsynthesizedImp[9]
Definition abcExact.c:330
Ses_TruthEntry_t * pEntries[SES_STORE_TABLE_SIZE]
Definition abcExact.c:321
int nEntriesCount
Definition abcExact.c:319
unsigned long nUnsynthesizedImp
Definition abcExact.c:329
unsigned long nUnsynthesizedRL
Definition abcExact.c:331
char * szDBName
Definition abcExact.c:324
int nValidEntriesCount
Definition abcExact.c:320
Ses_TimesEntry_t * next
Definition abcExact.c:298
int pArrTimeProfile[8]
Definition abcExact.c:296
Ses_TruthEntry_t * next
Definition abcExact.c:307
Ses_TimesEntry_t * head
Definition abcExact.c:308
Here is the caller graph for this function:

◆ Ses_StoreGetEntry()

int Ses_StoreGetEntry ( Ses_Store_t * pStore,
word * pTruth,
int nVars,
int * pArrTimeProfile,
char ** pSol )

Definition at line 768 of file abcExact.c.

769{
770 int key;
771 Ses_TruthEntry_t * pTEntry;
772 Ses_TimesEntry_t * pTiEntry;
773 int pTimes[8];
774
775 key = Ses_StoreTableHash( pTruth, nVars );
776 pTEntry = pStore->pEntries[key];
777
778 /* find truth table entry */
779 while ( pTEntry )
780 {
781 if ( Ses_StoreTruthEqual( pTEntry, pTruth, nVars ) )
782 break;
783 else
784 pTEntry = pTEntry->next;
785 }
786
787 /* no entry found? */
788 if ( !pTEntry )
789 return 0;
790
791 /* find times entry */
792 pTiEntry = pTEntry->head;
793 while ( pTiEntry )
794 {
795 /* found after normalization wrt. to network */
796 if ( pTiEntry->pNetwork )
797 {
798 memcpy( pTimes, pArrTimeProfile, sizeof(int) * nVars );
799 Abc_ExactNormalizeArrivalTimesForNetwork( nVars, pTimes, pTiEntry->pNetwork );
800
801 if ( Ses_StoreTimesEqual( pTimes, pTiEntry->pArrTimeProfile, nVars ) )
802 break;
803 }
804 /* found for non synthesized network */
805 else if ( Ses_StoreTimesEqual( pArrTimeProfile, pTiEntry->pArrTimeProfile, nVars ) )
806 break;
807 else
808 pTiEntry = pTiEntry->next;
809 }
810
811 /* no entry found? */
812 if ( !pTiEntry )
813 return 0;
814
815 *pSol = pTiEntry->pNetwork;
816 return 1;
817}
char * memcpy()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ses_StoreGetEntrySimple()

int Ses_StoreGetEntrySimple ( Ses_Store_t * pStore,
word * pTruth,
int nVars,
int * pArrTimeProfile,
char ** pSol )

Definition at line 728 of file abcExact.c.

729{
730 int key;
731 Ses_TruthEntry_t * pTEntry;
732 Ses_TimesEntry_t * pTiEntry;
733
734 key = Ses_StoreTableHash( pTruth, nVars );
735 pTEntry = pStore->pEntries[key];
736
737 /* find truth table entry */
738 while ( pTEntry )
739 {
740 if ( Ses_StoreTruthEqual( pTEntry, pTruth, nVars ) )
741 break;
742 else
743 pTEntry = pTEntry->next;
744 }
745
746 /* no entry found? */
747 if ( !pTEntry )
748 return 0;
749
750 /* find times entry */
751 pTiEntry = pTEntry->head;
752 while ( pTiEntry )
753 {
754 if ( Ses_StoreTimesEqual( pArrTimeProfile, pTiEntry->pArrTimeProfile, nVars ) )
755 break;
756 else
757 pTiEntry = pTiEntry->next;
758 }
759
760 /* no entry found? */
761 if ( !pTiEntry )
762 return 0;
763
764 *pSol = pTiEntry->pNetwork;
765 return 1;
766}