abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
bdcTable.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [bdcTable.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Truth-table-based bi-decomposition engine.]
8 
9  Synopsis [Hash table for intermediate nodes.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - January 30, 2007.]
16 
17  Revision [$Id: bdcTable.c,v 1.00 2007/01/30 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "bdcInt.h"
22 
24 
25 
26 ////////////////////////////////////////////////////////////////////////
27 /// DECLARATIONS ///
28 ////////////////////////////////////////////////////////////////////////
29 
30 ////////////////////////////////////////////////////////////////////////
31 /// FUNCTION DEFINITIONS ///
32 ////////////////////////////////////////////////////////////////////////
33 
34 /**Function*************************************************************
35 
36  Synopsis [Checks containment of the function in the ISF.]
37 
38  Description []
39 
40  SideEffects []
41 
42  SeeAlso []
43 
44 ***********************************************************************/
45 int Bdc_TableCheckContainment( Bdc_Man_t * p, Bdc_Isf_t * pIsf, unsigned * puTruth )
46 {
47  return Kit_TruthIsImply( pIsf->puOn, puTruth, p->nVars ) &&
48  Kit_TruthIsDisjoint( puTruth, pIsf->puOff, p->nVars );
49 }
50 
51 /**Function*************************************************************
52 
53  Synopsis [Adds the new entry to the hash table.]
54 
55  Description []
56 
57  SideEffects []
58 
59  SeeAlso []
60 
61 ***********************************************************************/
63 {
64  int fDisableCache = 0;
65  Bdc_Fun_t * pFunc;
66  if ( fDisableCache && Kit_WordCountOnes(pIsf->uSupp) > 1 )
67  return NULL;
68  if ( pIsf->uSupp == 0 )
69  {
70  assert( p->pTable[pIsf->uSupp] == p->pNodes );
71  if ( Kit_TruthIsConst1( pIsf->puOn, p->nVars ) )
72  return p->pNodes;
73  assert( Kit_TruthIsConst1( pIsf->puOff, p->nVars ) );
74  return Bdc_Not(p->pNodes);
75  }
76  for ( pFunc = p->pTable[pIsf->uSupp]; pFunc; pFunc = pFunc->pNext )
77  if ( Bdc_TableCheckContainment( p, pIsf, pFunc->puFunc ) )
78  return pFunc;
79  Bdc_IsfNot( pIsf );
80  for ( pFunc = p->pTable[pIsf->uSupp]; pFunc; pFunc = pFunc->pNext )
81  if ( Bdc_TableCheckContainment( p, pIsf, pFunc->puFunc ) )
82  {
83  Bdc_IsfNot( pIsf );
84  return Bdc_Not(pFunc);
85  }
86  Bdc_IsfNot( pIsf );
87  return NULL;
88 }
89 
90 /**Function*************************************************************
91 
92  Synopsis [Adds the new entry to the hash table.]
93 
94  Description []
95 
96  SideEffects []
97 
98  SeeAlso []
99 
100 ***********************************************************************/
101 void Bdc_TableAdd( Bdc_Man_t * p, Bdc_Fun_t * pFunc )
102 {
103  if ( p->pTable[pFunc->uSupp] == NULL )
104  Vec_IntPush( p->vSpots, pFunc->uSupp );
105  pFunc->pNext = p->pTable[pFunc->uSupp];
106  p->pTable[pFunc->uSupp] = pFunc;
107 }
108 
109 /**Function*************************************************************
110 
111  Synopsis [Adds the new entry to the hash table.]
112 
113  Description []
114 
115  SideEffects []
116 
117  SeeAlso []
118 
119 ***********************************************************************/
121 {
122  int Spot, i;
123  Vec_IntForEachEntry( p->vSpots, Spot, i )
124  p->pTable[Spot] = NULL;
125  Vec_IntClear( p->vSpots );
126 }
127 
128 ////////////////////////////////////////////////////////////////////////
129 /// END OF FILE ///
130 ////////////////////////////////////////////////////////////////////////
131 
132 
134 
unsigned uSupp
Definition: bdcInt.h:75
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Bdc_Fun_t * Bdc_TableLookup(Bdc_Man_t *p, Bdc_Isf_t *pIsf)
Definition: bdcTable.c:62
int nVars
Definition: bdcInt.h:85
static int Kit_TruthIsImply(unsigned *pIn1, unsigned *pIn2, int nVars)
Definition: kit.h:331
unsigned * puOff
Definition: bdcInt.h:78
Vec_Int_t * vSpots
Definition: bdcInt.h:98
static int Kit_TruthIsConst1(unsigned *pIn, int nVars)
Definition: kit.h:323
typedefABC_NAMESPACE_HEADER_START struct Bdc_Fun_t_ Bdc_Fun_t
INCLUDES ///.
Definition: bdc.h:42
void Bdc_TableAdd(Bdc_Man_t *p, Bdc_Fun_t *pFunc)
Definition: bdcTable.c:101
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
ABC_NAMESPACE_IMPL_START int Bdc_TableCheckContainment(Bdc_Man_t *p, Bdc_Isf_t *pIsf, unsigned *puTruth)
DECLARATIONS ///.
Definition: bdcTable.c:45
static int Kit_TruthIsDisjoint(unsigned *pIn1, unsigned *pIn2, int nVars)
Definition: kit.h:339
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
Bdc_Fun_t ** pTable
Definition: bdcInt.h:96
unsigned * puOn
Definition: bdcInt.h:77
Bdc_Fun_t * pNodes
Definition: bdcInt.h:90
static Bdc_Fun_t * Bdc_Not(Bdc_Fun_t *p)
Definition: bdc.h:56
void Bdc_TableClear(Bdc_Man_t *p)
Definition: bdcTable.c:120
#define assert(ex)
Definition: util_old.h:213
static int Kit_WordCountOnes(unsigned uWord)
Definition: kit.h:243
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static void Bdc_IsfNot(Bdc_Isf_t *p)
Definition: bdcInt.h:134