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

Go to the source code of this file.

Functions

void Cec_ManTransformClasses (Gia_Man_t *p)
 
int * Cec_ManDetectIsomorphism (Gia_Man_t *p)
 

Function Documentation

◆ Cec_ManDetectIsomorphism()

int * Cec_ManDetectIsomorphism ( Gia_Man_t * p)

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

Synopsis [Finds node correspondences in the miter.]

Description [Assumes that the colors are assigned.]

SideEffects []

SeeAlso []

Definition at line 297 of file cecIso.c.

298{
299 int nWords = 2;
300 Gia_Obj_t * pObj;
301 Vec_Int_t * vNodesA, * vNodesB;
302 unsigned * pStore, Counter;
303 int i, * pIso, * pTable, nTableSize;
304 // start equivalence classes
305 pIso = ABC_CALLOC( int, Gia_ManObjNum(p) );
306 Gia_ManForEachObj( p, pObj, i )
307 {
308 if ( Gia_ObjIsCo(pObj) )
309 {
310 assert( Gia_ObjColors(p, i) == 0 );
311 continue;
312 }
313 assert( Gia_ObjColors(p, i) );
314 if ( Gia_ObjColors(p, i) == 3 )
315 pIso[i] = i;
316 }
317 // start simulation info
318 pStore = ABC_ALLOC( unsigned, Gia_ManObjNum(p) * nWords );
319 // simulate and create table
320 nTableSize = Abc_PrimeCudd( 100 + Gia_ManObjNum(p)/2 );
321 pTable = ABC_CALLOC( int, nTableSize );
323 Gia_ManForEachObj1( p, pObj, i )
324 {
325 if ( Gia_ObjIsCo(pObj) )
326 continue;
327 if ( pIso[i] == 0 ) // simulate
328 Gia_ManIsoSimulate( pObj, i, pStore, nWords );
329 else if ( pIso[i] < i ) // copy
330 Gia_ManIsoCopy( i, pIso[i], pStore, nWords );
331 else // generate
332 Gia_ManIsoRandom( i, pStore, nWords );
333 if ( pIso[i] == 0 )
334 Gia_ManIsoTableAdd( p, i, pStore, nWords, pTable, nTableSize );
335 }
336 // create equivalence classes
337 vNodesA = Vec_IntAlloc( 100 );
338 vNodesB = Vec_IntAlloc( 100 );
339 for ( i = 0; i < nTableSize; i++ )
340 if ( Gia_ManIsoExtractClasses( p, pTable[i], pStore, nWords, vNodesA, vNodesB ) )
341 Gia_ManIsoMatchNodes( pIso, pStore, nWords, vNodesA, vNodesB );
342 Vec_IntFree( vNodesA );
343 Vec_IntFree( vNodesB );
344 // collect info
345 Counter = 0;
346 Gia_ManForEachObj1( p, pObj, i )
347 {
348 Counter += (pIso[i] && pIso[i] < i);
349/*
350 if ( pIso[i] && pIso[i] < i )
351 {
352 if ( (Gia_ObjIsHead(p,pIso[i]) && Gia_ObjRepr(p,i)==pIso[i]) ||
353 (Gia_ObjIsClass(p,pIso[i]) && Gia_ObjRepr(p,i)==Gia_ObjRepr(p,pIso[i])) )
354 Abc_Print( 1, "1" );
355 else
356 Abc_Print( 1, "0" );
357 }
358*/
359 }
360 Abc_Print( 1, "Computed %d pairs of structurally equivalent nodes.\n", Counter );
361// p->pIso = pIso;
362// Cec_ManTransformClasses( p );
363
364 ABC_FREE( pTable );
365 ABC_FREE( pStore );
366 return pIso;
367}
int nWords
Definition abcNpn.c:127
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define ABC_FREE(obj)
Definition abc_global.h:267
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Cube * p
Definition exorList.c:222
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
#define Gia_ManForEachObj1(p, pObj, i)
Definition gia.h:1192
void Gia_ManCleanValue(Gia_Man_t *p)
Definition giaUtil.c:351
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition gia.h:1190
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:

◆ Cec_ManTransformClasses()

void Cec_ManTransformClasses ( Gia_Man_t * p)

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

Synopsis [Transforms iso into equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 268 of file cecIso.c.

269{
270 Gia_Obj_t * pObj;
271 int i;
272 assert( p->pReprs && p->pNexts && p->pIso );
273 memset( p->pReprs, 0, sizeof(int) * Gia_ManObjNum(p) );
274 memset( p->pNexts, 0, sizeof(int) * Gia_ManObjNum(p) );
275 Gia_ManForEachObj( p, pObj, i )
276 {
277 p->pReprs[i].iRepr = GIA_VOID;
278 if ( p->pIso[i] && p->pIso[i] < i )
279 {
280 p->pReprs[i].iRepr = p->pIso[i];
281 p->pNexts[p->pIso[i]] = i;
282 }
283 }
284}
#define GIA_VOID
Definition gia.h:46
char * memset()
Here is the call graph for this function: