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

Go to the source code of this file.

Classes

struct  Tab_Obj_t_
 
struct  Tab_Man_t_
 

Macros

#define PLA_HASH_VALUE_NUM   256
 DECLARATIONS ///.
 
#define PLA_LIT_UNUSED   0xFFFF
 

Typedefs

typedef struct Tab_Obj_t_ Tab_Obj_t
 
typedef struct Tab_Man_t_ Tab_Man_t
 

Functions

void Pla_ManHashCubes (Pla_Man_t *p, Tab_Man_t *pTab)
 
int Pla_ManHashDistance1 (Pla_Man_t *p)
 
int Pla_ManHashDist1NumTest (Pla_Man_t *p)
 
void Pla_PrintCube (Vec_Int_t *vLits, int nVars, int iVar)
 
void Pla_ManHashCubes2 (Pla_Man_t *p, Tab_Man_t *pTab)
 
void Vec_IntCopySkip (Vec_Int_t *vCube, int iVar, Vec_Int_t *vRes)
 
Vec_Int_tPla_ManComputeDistance1Int (Pla_Man_t *p)
 
Vec_Int_tPla_ManComputeDistance1 (Pla_Man_t *p)
 
void Pla_ManComputeDist1Test (Pla_Man_t *p)
 

Macro Definition Documentation

◆ PLA_HASH_VALUE_NUM

#define PLA_HASH_VALUE_NUM   256

DECLARATIONS ///.

CFile****************************************************************

FileName [plaHash.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [SOP manager.]

Synopsis [Scalable SOP transformations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - March 18, 2015.]

Revision [

Id
plaHash.c,v 1.00 2014/09/12 00:00:00 alanmi Exp

]

Definition at line 29 of file plaHash.c.

◆ PLA_LIT_UNUSED

#define PLA_LIT_UNUSED   0xFFFF

Definition at line 69 of file plaHash.c.

Typedef Documentation

◆ Tab_Man_t

typedef struct Tab_Man_t_ Tab_Man_t

Definition at line 80 of file plaHash.c.

◆ Tab_Obj_t

typedef struct Tab_Obj_t_ Tab_Obj_t

Definition at line 71 of file plaHash.c.

Function Documentation

◆ Pla_ManComputeDist1Test()

void Pla_ManComputeDist1Test ( Pla_Man_t * p)

Definition at line 333 of file plaHash.c.

334{
335 Vec_Int_t * vPairs;
337 vPairs = Pla_ManComputeDistance1( p );
338 Vec_IntFree( vPairs );
339}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Cube * p
Definition exorList.c:222
Vec_Int_t * Pla_ManComputeDistance1(Pla_Man_t *p)
Definition plaHash.c:325
void Pla_ManConvertFromBits(Pla_Man_t *p)
Definition plaMan.c:221
Here is the call graph for this function:

◆ Pla_ManComputeDistance1()

Vec_Int_t * Pla_ManComputeDistance1 ( Pla_Man_t * p)

Definition at line 325 of file plaHash.c.

326{
327 abctime clk = Abc_Clock();
329 printf( "Found %d pairs among %d cubes using cube hashing. ", Vec_IntSize(vPairs)/4, Pla_ManCubeNum(p) );
330 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
331 return vPairs;
332}
ABC_INT64_T abctime
Definition abc_global.h:332
Vec_Int_t * Pla_ManComputeDistance1Int(Pla_Man_t *p)
Definition plaHash.c:265
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pla_ManComputeDistance1Int()

Vec_Int_t * Pla_ManComputeDistance1Int ( Pla_Man_t * p)

Definition at line 265 of file plaHash.c.

266{
267 Tab_Man_t * pTab;
268 Vec_Int_t * vCube1, * vCube2;
269 Vec_Int_t * vTemp1 = Vec_IntAlloc( 100 );
270 Vec_Int_t * vTemp2 = Vec_IntAlloc( 100 );
271 Vec_Int_t * vPairs = Vec_IntAlloc( 1000 );
272 Vec_Int_t * vCounts = Vec_IntStart( Vec_WecSize(&p->vCubeLits) );
273 Vec_Int_t * vEntries = Vec_IntAlloc( p->nIns );
274 int nBits = Abc_Base2Log( Vec_WecSizeSize(&p->vCubeLits) ) + 2;
275 int v, i, k;//, Count = 0;
276 int iCube1, iCube2, iVar1, iVar2;
277 assert( nBits <= 26 );
278 pTab = Tab_ManAlloc( nBits, p );
279 //Pla_ManConvertFromBits( p );
280 Pla_ManHashCubes2( p, pTab );
281 // iterate through the hash bins
282 for ( v = 0; v <= pTab->SizeMask; v++ )
283 {
284 Tab_ManHashCollect( pTab, v, vEntries );
285 for ( i = 0; i < Vec_IntSize(vEntries)/2; i++ )
286 for ( k = i+1; k < Vec_IntSize(vEntries)/2; k++ )
287 {
288 iCube1 = Vec_IntEntry(vEntries, 2*i);
289 iCube2 = Vec_IntEntry(vEntries, 2*k);
290 iVar1 = Vec_IntEntry(vEntries, 2*i+1);
291 iVar2 = Vec_IntEntry(vEntries, 2*k+1);
292
293 vCube1 = Vec_WecEntry(&p->vCubeLits, iCube1);
294 vCube2 = Vec_WecEntry(&p->vCubeLits, iCube2);
295/*
296 Pla_PrintCube( vCube1, p->nIns, iVar1 );
297 Pla_PrintCube( vCube2, p->nIns, iVar2 );
298 printf( "\n" );
299*/
300 if ( Vec_IntSize(vCube1) != Vec_IntSize(vCube2) )
301 continue;
302 Vec_IntCopySkip( vCube1, iVar1, vTemp1 );
303 Vec_IntCopySkip( vCube2, iVar2, vTemp2 );
304 if ( !Vec_IntEqual( vTemp1, vTemp2 ) )
305 continue;
306
307 printf( "%d %d ", iCube1, iCube2 );
308
309 Vec_IntPushTwo( vPairs, iCube1, iVar1 );
310 Vec_IntPushTwo( vPairs, iCube2, iVar2 );
311
312 Vec_IntAddToEntry( vCounts, iCube1, 1 );
313 Vec_IntAddToEntry( vCounts, iCube2, 1 );
314 }
315 }
316 Vec_IntPrint( vCounts );
317
318 Vec_IntFree( vCounts );
319 Vec_IntFree( vTemp1 );
320 Vec_IntFree( vTemp2 );
321 Vec_IntFree( vEntries );
322 Tab_ManFree( pTab );
323 return vPairs;
324}
void Vec_IntCopySkip(Vec_Int_t *vCube, int iVar, Vec_Int_t *vRes)
Definition plaHash.c:257
void Pla_ManHashCubes2(Pla_Man_t *p, Tab_Man_t *pTab)
Definition plaHash.c:242
struct Tab_Man_t_ Tab_Man_t
Definition plaHash.c:80
int SizeMask
Definition plaHash.c:83
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pla_ManHashCubes()

void Pla_ManHashCubes ( Pla_Man_t * p,
Tab_Man_t * pTab )

Definition at line 166 of file plaHash.c.

167{
168 Vec_Int_t * vCube; int i, Value;
169 Vec_IntClear( &p->vHashes );
170 Vec_IntGrow( &p->vHashes, Pla_ManCubeNum(p) );
171 Vec_WecForEachLevel( &p->vCubeLits, vCube, i )
172 {
173 Value = Pla_CubeHashValue(vCube);
174 Vec_IntPush( &p->vHashes, Value );
175 Tab_ManHashInsert( pTab, Value, i, PLA_LIT_UNUSED );
176 }
177}
#define PLA_LIT_UNUSED
Definition plaHash.c:69
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
Definition vecWec.h:55
Here is the caller graph for this function:

◆ Pla_ManHashCubes2()

void Pla_ManHashCubes2 ( Pla_Man_t * p,
Tab_Man_t * pTab )

Definition at line 242 of file plaHash.c.

243{
244 Vec_Int_t * vCube;
245 int i, v, Lit, Value;
246 Vec_WecForEachLevel( &p->vCubeLits, vCube, i )
247 {
248 Value = Pla_CubeHashValue(vCube);
249 Vec_IntForEachEntry( vCube, Lit, v )
250 {
251 Value -= Pla_HashValue(Lit);
252 Tab_ManHashInsert( pTab, Value, i, v );
253 Value += Pla_HashValue(Lit);
254 }
255 }
256}
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the caller graph for this function:

◆ Pla_ManHashDist1NumTest()

int Pla_ManHashDist1NumTest ( Pla_Man_t * p)

Definition at line 212 of file plaHash.c.

213{
214 abctime clk = Abc_Clock();
215 int Count = Pla_ManHashDistance1( p );
216 printf( "Found %d pairs among %d cubes using cube hashing. ", Count, Pla_ManCubeNum(p) );
217 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
218 return 1;
219}
int Pla_ManHashDistance1(Pla_Man_t *p)
Definition plaHash.c:178
Here is the call graph for this function:

◆ Pla_ManHashDistance1()

int Pla_ManHashDistance1 ( Pla_Man_t * p)

Definition at line 178 of file plaHash.c.

179{
180 Tab_Man_t * pTab;
181 Vec_Int_t * vCube;
182 Vec_Int_t * vCubeCopy = Vec_IntAlloc( p->nIns );
183 int nBits = Abc_Base2Log( Pla_ManCubeNum(p) ) + 2;
184 int i, k, Lit, Value, ValueCopy, Count = 0;
185 assert( nBits <= 26 );
186 pTab = Tab_ManAlloc( nBits, p );
188 Pla_ManHashCubes( p, pTab );
189 Vec_WecForEachLevel( &p->vCubeLits, vCube, i )
190 {
191 Vec_IntClear( vCubeCopy );
192 Vec_IntAppend( vCubeCopy, vCube );
193 Value = ValueCopy = Vec_IntEntry( &p->vHashes, i );
194 Vec_IntForEachEntry( vCubeCopy, Lit, k )
195 {
196 // create new
197 Value += Pla_HashValue(Abc_LitNot(Lit)) - Pla_HashValue(Lit);
198 Vec_IntWriteEntry( vCubeCopy, k, Abc_LitNot(Lit) );
199 // check the cube
200 Count += Tab_ManHashLookup( pTab, Value, vCubeCopy );
201 // create old
202 Value -= Pla_HashValue(Abc_LitNot(Lit)) - Pla_HashValue(Lit);
203 Vec_IntWriteEntry( vCubeCopy, k, Lit );
204 }
205 assert( Value == ValueCopy );
206 }
207 Vec_IntFree( vCubeCopy );
208 Tab_ManFree( pTab );
209 assert( !(Count & 1) );
210 return Count/2;
211}
void Pla_ManHashCubes(Pla_Man_t *p, Tab_Man_t *pTab)
Definition plaHash.c:166
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Pla_PrintCube()

void Pla_PrintCube ( Vec_Int_t * vLits,
int nVars,
int iVar )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 232 of file plaHash.c.

233{
234 int v, Lit;
235 Vec_Str_t * vStr = Vec_StrStart( nVars + 1 );
236 Vec_StrFill( vStr, nVars, '-' );
237 Vec_IntForEachEntry( vLits, Lit, v )
238 Vec_StrWriteEntry( vStr, Abc_Lit2Var(Lit), (char)(Abc_LitIsCompl(Lit) ? '0' : '1') );
239 fprintf( stdout, "%s %d\n", Vec_StrArray(vStr), iVar );
240 Vec_StrFree( vStr );
241}
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46

◆ Vec_IntCopySkip()

void Vec_IntCopySkip ( Vec_Int_t * vCube,
int iVar,
Vec_Int_t * vRes )

Definition at line 257 of file plaHash.c.

258{
259 int i;
260 Vec_IntClear( vRes );
261 for ( i = 0; i < Vec_IntSize(vCube); i++ )
262 if ( i != iVar )
263 Vec_IntPush( vRes, Vec_IntEntry(vCube, i) );
264}
Here is the caller graph for this function: