ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
amapUniq.c File Reference
#include "amapInt.h"
Include dependency graph for amapUniq.c:

Go to the source code of this file.

Functions

int Amap_LibFindNode (Amap_Lib_t *pLib, int iFan0, int iFan1, int fXor)
 
int Amap_LibFindMux (Amap_Lib_t *p, int iFan0, int iFan1, int iFan2)
 
Amap_Nod_tAmap_LibCreateObj (Amap_Lib_t *p)
 
int Amap_LibCreateVar (Amap_Lib_t *p)
 
int Amap_LibCreateNode (Amap_Lib_t *p, int iFan0, int iFan1, int fXor)
 
int Amap_LibCreateMux (Amap_Lib_t *p, int iFan0, int iFan1, int iFan2)
 
int ** Amap_LibLookupTableAlloc (Vec_Ptr_t *vVec, int fVerbose)
 

Function Documentation

◆ Amap_LibCreateMux()

int Amap_LibCreateMux ( Amap_Lib_t * p,
int iFan0,
int iFan1,
int iFan2 )

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

Synopsis [Creates a new node.]

Description []

SideEffects []

SeeAlso []

Definition at line 244 of file amapUniq.c.

245{
246 Amap_Nod_t * pNode;
247 pNode = Amap_LibCreateObj( p );
248 pNode->Type = AMAP_OBJ_MUX;
249 pNode->nSuppSize = p->pNodes[Abc_Lit2Var(iFan0)].nSuppSize + p->pNodes[Abc_Lit2Var(iFan1)].nSuppSize + p->pNodes[Abc_Lit2Var(iFan2)].nSuppSize;
250 pNode->iFan0 = iFan0;
251 pNode->iFan1 = iFan1;
252 pNode->iFan2 = iFan2;
253if ( p->fVerbose )
254printf( "Creating node %5d %c : iFan0 = %5d%c iFan1 = %5d%c iFan2 = %5d%c\n",
255pNode->Id, 'm',
256Abc_Lit2Var(iFan0), (Abc_LitIsCompl(iFan0)?'-':'+'),
257Abc_Lit2Var(iFan1), (Abc_LitIsCompl(iFan1)?'-':'+'),
258Abc_Lit2Var(iFan2), (Abc_LitIsCompl(iFan2)?'-':'+') );
259
260 Vec_IntPush( p->vRules3, iFan0 );
261 Vec_IntPush( p->vRules3, iFan1 );
262 Vec_IntPush( p->vRules3, iFan2 );
263 Vec_IntPush( p->vRules3, pNode->Id );
264 return pNode->Id;
265}
@ AMAP_OBJ_MUX
Definition amapInt.h:57
struct Amap_Nod_t_ Amap_Nod_t
Definition amapInt.h:67
Amap_Nod_t * Amap_LibCreateObj(Amap_Lib_t *p)
Definition amapUniq.c:135
Cube * p
Definition exorList.c:222
unsigned Type
Definition amapInt.h:177
short iFan0
Definition amapInt.h:178
unsigned nSuppSize
Definition amapInt.h:176
short iFan2
Definition amapInt.h:180
short iFan1
Definition amapInt.h:179
unsigned Id
Definition amapInt.h:175
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Amap_LibCreateNode()

int Amap_LibCreateNode ( Amap_Lib_t * p,
int iFan0,
int iFan1,
int fXor )

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

Synopsis [Creates a new node.]

Description []

SideEffects []

SeeAlso []

Definition at line 189 of file amapUniq.c.

190{
191 Amap_Nod_t * pNode;
192 int iFan;
193 if ( iFan0 < iFan1 )
194 {
195 iFan = iFan0;
196 iFan0 = iFan1;
197 iFan1 = iFan;
198 }
199 pNode = Amap_LibCreateObj( p );
200 pNode->Type = fXor? AMAP_OBJ_XOR : AMAP_OBJ_AND;
201 pNode->nSuppSize = p->pNodes[Abc_Lit2Var(iFan0)].nSuppSize + p->pNodes[Abc_Lit2Var(iFan1)].nSuppSize;
202 pNode->iFan0 = iFan0;
203 pNode->iFan1 = iFan1;
204if ( p->fVerbose )
205printf( "Creating node %5d %c : iFan0 = %5d%c iFan1 = %5d%c\n",
206pNode->Id, (fXor?'x':' '),
207Abc_Lit2Var(iFan0), (Abc_LitIsCompl(iFan0)?'-':'+'),
208Abc_Lit2Var(iFan1), (Abc_LitIsCompl(iFan1)?'-':'+') );
209
210 if ( fXor )
211 {
212 if ( iFan0 == iFan1 )
213 Vec_IntPushOrderWithMask( (Vec_Int_t *)Vec_PtrEntry(p->vRulesX, iFan0), (pNode->Id << 16) | iFan1 );
214 else
215 {
216 Vec_IntPushOrderWithMask( (Vec_Int_t *)Vec_PtrEntry(p->vRulesX, iFan0), (pNode->Id << 16) | iFan1 );
217 Vec_IntPushOrderWithMask( (Vec_Int_t *)Vec_PtrEntry(p->vRulesX, iFan1), (pNode->Id << 16) | iFan0 );
218 }
219 }
220 else
221 {
222 if ( iFan0 == iFan1 )
223 Vec_IntPushOrderWithMask( (Vec_Int_t *)Vec_PtrEntry(p->vRules, iFan0), (pNode->Id << 16) | iFan1 );
224 else
225 {
226 Vec_IntPushOrderWithMask( (Vec_Int_t *)Vec_PtrEntry(p->vRules, iFan0), (pNode->Id << 16) | iFan1 );
227 Vec_IntPushOrderWithMask( (Vec_Int_t *)Vec_PtrEntry(p->vRules, iFan1), (pNode->Id << 16) | iFan0 );
228 }
229 }
230 return pNode->Id;
231}
@ AMAP_OBJ_XOR
Definition amapInt.h:56
@ AMAP_OBJ_AND
Definition amapInt.h:55
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Amap_LibCreateObj()

Amap_Nod_t * Amap_LibCreateObj ( Amap_Lib_t * p)

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

Synopsis [Creates a new node.]

Description []

SideEffects []

SeeAlso []

Definition at line 135 of file amapUniq.c.

136{
137 Amap_Nod_t * pNode;
138 if ( p->nNodes == p->nNodesAlloc )
139 {
140 p->pNodes = ABC_REALLOC( Amap_Nod_t, p->pNodes, 2*p->nNodesAlloc );
141 p->nNodesAlloc *= 2;
142 }
143 pNode = Amap_LibNod( p, p->nNodes );
144 memset( pNode, 0, sizeof(Amap_Nod_t) );
145 pNode->Id = p->nNodes++;
146 Vec_PtrPush( p->vRules, Vec_IntAlloc(8) );
147 Vec_PtrPush( p->vRules, Vec_IntAlloc(8) );
148 Vec_PtrPush( p->vRulesX, Vec_IntAlloc(8) );
149 Vec_PtrPush( p->vRulesX, Vec_IntAlloc(8) );
150 return pNode;
151}
#define ABC_REALLOC(type, obj, num)
Definition abc_global.h:268
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Amap_LibCreateVar()

int Amap_LibCreateVar ( Amap_Lib_t * p)

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

Synopsis [Creates a new node.]

Description []

SideEffects []

SeeAlso []

Definition at line 164 of file amapUniq.c.

165{
166 Amap_Nod_t * pNode;
167 // start the manager
168 assert( p->pNodes == NULL );
169 p->nNodesAlloc = 256;
170 p->pNodes = ABC_ALLOC( Amap_Nod_t, p->nNodesAlloc );
171 // create the first node
172 pNode = Amap_LibCreateObj( p );
173 p->pNodes->Type = AMAP_OBJ_PI;
174 p->pNodes->nSuppSize = 1;
175 return 0;
176}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
@ AMAP_OBJ_PI
Definition amapInt.h:53
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Amap_LibFindMux()

int Amap_LibFindMux ( Amap_Lib_t * p,
int iFan0,
int iFan1,
int iFan2 )

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

Synopsis [Checks if the three-argument rule exist.]

Description []

SideEffects []

SeeAlso []

Definition at line 109 of file amapUniq.c.

110{
111 int x;
112 for ( x = 0; x < Vec_IntSize(p->vRules3); x += 4 )
113 {
114 if ( Vec_IntEntry(p->vRules3, x) == iFan0 &&
115 Vec_IntEntry(p->vRules3, x+1) == iFan1 &&
116 Vec_IntEntry(p->vRules3, x+2) == iFan2 )
117 {
118 return Vec_IntEntry(p->vRules3, x+3);
119 }
120 }
121 return -1;
122}
Here is the caller graph for this function:

◆ Amap_LibFindNode()

int Amap_LibFindNode ( Amap_Lib_t * pLib,
int iFan0,
int iFan1,
int fXor )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 90 of file amapUniq.c.

91{
92 if ( fXor )
93 return Vec_IntCheckWithMask( (Vec_Int_t *)Vec_PtrEntry(pLib->vRulesX, iFan0), iFan1 );
94 else
95 return Vec_IntCheckWithMask( (Vec_Int_t *)Vec_PtrEntry(pLib->vRules, iFan0), iFan1 );
96}
Here is the caller graph for this function:

◆ Amap_LibLookupTableAlloc()

int ** Amap_LibLookupTableAlloc ( Vec_Ptr_t * vVec,
int fVerbose )

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

Synopsis [Allocates triangular lookup table.]

Description []

SideEffects []

SeeAlso []

Definition at line 278 of file amapUniq.c.

279{
280 Vec_Int_t * vOne;
281 int ** pRes;
282 int i, k, nTotal, nSize, nEntries, Value;
283 // count the total size
284 nEntries = nSize = Vec_PtrSize( vVec );
285 Vec_PtrForEachEntry( Vec_Int_t *, vVec, vOne, i )
286 nEntries += Vec_IntSize(vOne);
287 pRes = (int **)ABC_ALLOC( char, nSize * sizeof(void *) + nEntries * sizeof(int) );
288 pRes[0] = (int *)((char *)pRes + nSize * sizeof(void *));
289 nTotal = 0;
290 Vec_PtrForEachEntry( Vec_Int_t *, vVec, vOne, i )
291 {
292 pRes[i] = pRes[0] + nTotal;
293 nTotal += Vec_IntSize(vOne) + 1;
294 if ( fVerbose )
295 printf( "%d : ", i );
296 Vec_IntForEachEntry( vOne, Value, k )
297 {
298 pRes[i][k] = Value;
299 if ( fVerbose )
300 printf( "%d(%d) ", Value&0xffff, Value>>16 );
301 }
302 if ( fVerbose )
303 printf( "\n" );
304 pRes[i][k] = 0;
305 }
306 assert( nTotal == nEntries );
307 return pRes;
308}
int nTotal
DECLARATIONS ///.
Definition cutTruth.c:37
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the caller graph for this function: