ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
pla.h File Reference
#include "aig/gia/gia.h"
#include "misc/extra/extra.h"
#include "base/main/mainInt.h"
Include dependency graph for pla.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Pla_Man_t_
 

Macros

#define MASK55   ABC_CONST(0x5555555555555555)
 INCLUDES ///.
 
#define Pla_ForEachCubeIn(p, pCube, i)
 MACRO DEFINITIONS ///.
 
#define Pla_ForEachCubeInStart(p, pCube, i, Start)
 
#define Pla_ForEachCubeOut(p, pCube, i)
 
#define Pla_ForEachCubeInOut(p, pCubeIn, pCubeOut, i)
 
#define Pla_CubeForEachLit(nVars, pCube, Lit, i)
 
#define Pla_CubeForEachLitIn(p, pCube, Lit, i)
 
#define Pla_CubeForEachLitOut(p, pCube, Lit, i)
 

Typedefs

typedef struct Pla_Man_t_ Pla_Man_t
 

Enumerations

enum  Pla_File_t {
  PLA_FILE_FD = 0 , PLA_FILE_F , PLA_FILE_FR , PLA_FILE_FDR ,
  PLA_FILE_NONE
}
 BASIC TYPES ///. More...
 
enum  Pla_Lit_t { PLA_LIT_DASH = 0 , PLA_LIT_ZERO , PLA_LIT_ONE , PLA_LIT_FULL }
 

Functions

int Pla_ManHashDist1NumTest (Pla_Man_t *p)
 
void Pla_ManComputeDist1Test (Pla_Man_t *p)
 
Vec_Bit_tPla_ManPrimesTable (int nVars)
 
Pla_Man_tPla_ManPrimesDetector (int nVars)
 
Pla_Man_tPla_ManGenerate (int nIns, int nOuts, int nCubes, int fVerbose)
 
void Pla_ManConvertFromBits (Pla_Man_t *p)
 
void Pla_ManConvertToBits (Pla_Man_t *p)
 
int Pla_ManDist1NumTest (Pla_Man_t *p)
 
int Pla_ManDist1Merge (Pla_Man_t *p)
 DECLARATIONS ///.
 
int Pla_ManFxPerformSimple (int nVars)
 
Pla_Man_tPla_ReadPla (char *pFileName)
 
void Pla_WritePla (Pla_Man_t *p, char *pFileName)
 

Macro Definition Documentation

◆ MASK55

#define MASK55   ABC_CONST(0x5555555555555555)

INCLUDES ///.

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

FileName [pla.h]

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
pla.h,v 1.00 2014/09/12 00:00:00 alanmi Exp

] PARAMETERS ///

Definition at line 39 of file pla.h.

◆ Pla_CubeForEachLit

#define Pla_CubeForEachLit ( nVars,
pCube,
Lit,
i )
Value:
for ( i = 0; (i < nVars) && (((Lit) = Pla_CubeGetLit(pCube, i)), 1); i++ )

Definition at line 124 of file pla.h.

124#define Pla_CubeForEachLit( nVars, pCube, Lit, i ) \
125 for ( i = 0; (i < nVars) && (((Lit) = Pla_CubeGetLit(pCube, i)), 1); i++ )

◆ Pla_CubeForEachLitIn

#define Pla_CubeForEachLitIn ( p,
pCube,
Lit,
i )
Value:
Pla_CubeForEachLit( Pla_ManInNum(p), pCube, Lit, i )
Cube * p
Definition exorList.c:222
#define Pla_CubeForEachLit(nVars, pCube, Lit, i)
Definition pla.h:124

Definition at line 126 of file pla.h.

126#define Pla_CubeForEachLitIn( p, pCube, Lit, i ) \
127 Pla_CubeForEachLit( Pla_ManInNum(p), pCube, Lit, i )

◆ Pla_CubeForEachLitOut

#define Pla_CubeForEachLitOut ( p,
pCube,
Lit,
i )
Value:
Pla_CubeForEachLit( Pla_ManOutNum(p), pCube, Lit, i )

Definition at line 128 of file pla.h.

128#define Pla_CubeForEachLitOut( p, pCube, Lit, i ) \
129 Pla_CubeForEachLit( Pla_ManOutNum(p), pCube, Lit, i )

◆ Pla_ForEachCubeIn

#define Pla_ForEachCubeIn ( p,
pCube,
i )
Value:
for ( i = 0; (i < Pla_ManCubeNum(p)) && (((pCube) = Pla_CubeIn(p, i)), 1); i++ )

MACRO DEFINITIONS ///.

ITERATORS ///

Definition at line 114 of file pla.h.

114#define Pla_ForEachCubeIn( p, pCube, i ) \
115 for ( i = 0; (i < Pla_ManCubeNum(p)) && (((pCube) = Pla_CubeIn(p, i)), 1); i++ )

◆ Pla_ForEachCubeInOut

#define Pla_ForEachCubeInOut ( p,
pCubeIn,
pCubeOut,
i )
Value:
for ( i = 0; (i < Pla_ManCubeNum(p)) && (((pCubeIn) = Pla_CubeIn(p, i)), 1) && (((pCubeOut) = Pla_CubeOut(p, i)), 1); i++ )

Definition at line 121 of file pla.h.

121#define Pla_ForEachCubeInOut( p, pCubeIn, pCubeOut, i ) \
122 for ( i = 0; (i < Pla_ManCubeNum(p)) && (((pCubeIn) = Pla_CubeIn(p, i)), 1) && (((pCubeOut) = Pla_CubeOut(p, i)), 1); i++ )

◆ Pla_ForEachCubeInStart

#define Pla_ForEachCubeInStart ( p,
pCube,
i,
Start )
Value:
for ( i = Start; (i < Pla_ManCubeNum(p)) && (((pCube) = Pla_CubeIn(p, i)), 1); i++ )

Definition at line 116 of file pla.h.

116#define Pla_ForEachCubeInStart( p, pCube, i, Start ) \
117 for ( i = Start; (i < Pla_ManCubeNum(p)) && (((pCube) = Pla_CubeIn(p, i)), 1); i++ )

◆ Pla_ForEachCubeOut

#define Pla_ForEachCubeOut ( p,
pCube,
i )
Value:
for ( i = 0; (i < Pla_ManCubeNum(p)) && (((pCube) = Pla_CubeOut(p, i)), 1); i++ )

Definition at line 119 of file pla.h.

119#define Pla_ForEachCubeOut( p, pCube, i ) \
120 for ( i = 0; (i < Pla_ManCubeNum(p)) && (((pCube) = Pla_CubeOut(p, i)), 1); i++ )

Typedef Documentation

◆ Pla_Man_t

typedef struct Pla_Man_t_ Pla_Man_t

Definition at line 63 of file pla.h.

Enumeration Type Documentation

◆ Pla_File_t

enum Pla_File_t

BASIC TYPES ///.

Enumerator
PLA_FILE_FD 
PLA_FILE_F 
PLA_FILE_FR 
PLA_FILE_FDR 
PLA_FILE_NONE 

Definition at line 46 of file pla.h.

46 {
47 PLA_FILE_FD = 0,
Pla_File_t
BASIC TYPES ///.
Definition pla.h:46
@ PLA_FILE_FR
Definition pla.h:49
@ PLA_FILE_FDR
Definition pla.h:50
@ PLA_FILE_NONE
Definition pla.h:51
@ PLA_FILE_F
Definition pla.h:48
@ PLA_FILE_FD
Definition pla.h:47

◆ Pla_Lit_t

enum Pla_Lit_t
Enumerator
PLA_LIT_DASH 
PLA_LIT_ZERO 
PLA_LIT_ONE 
PLA_LIT_FULL 

Definition at line 55 of file pla.h.

55 {
56 PLA_LIT_DASH = 0,
60} Pla_Lit_t;
Pla_Lit_t
Definition pla.h:55
@ PLA_LIT_ONE
Definition pla.h:58
@ PLA_LIT_FULL
Definition pla.h:59
@ PLA_LIT_ZERO
Definition pla.h:57
@ PLA_LIT_DASH
Definition pla.h:56

Function Documentation

◆ Pla_ManComputeDist1Test()

void Pla_ManComputeDist1Test ( Pla_Man_t * p)
extern

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
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_ManConvertFromBits()

void Pla_ManConvertFromBits ( Pla_Man_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 221 of file plaMan.c.

222{
223 Vec_Int_t * vCube;
224 word * pCube; int i, k, Lit, Count;
225 Vec_WecClear( &p->vCubeLits );
226 Vec_WecClear( &p->vOccurs );
227 Vec_WecInit( &p->vCubeLits, Pla_ManCubeNum(p) );
228 Vec_WecInit( &p->vOccurs, 2*Pla_ManInNum(p) );
229 Pla_ForEachCubeIn( p, pCube, i )
230 {
231 vCube = Vec_WecEntry( &p->vCubeLits, i );
232
233 Count = 0;
234 Pla_CubeForEachLitIn( p, pCube, Lit, k )
235 if ( Lit != PLA_LIT_DASH )
236 Count++;
237 Vec_IntGrow( vCube, Count );
238
239 Count = 0;
240 Pla_CubeForEachLitIn( p, pCube, Lit, k )
241 if ( Lit != PLA_LIT_DASH )
242 {
243 Lit = Abc_Var2Lit( k, Lit == PLA_LIT_ZERO );
244 Vec_WecPush( &p->vCubeLits, i, Lit );
245// Vec_WecPush( &p->vOccurs, Lit, Pla_CubeHandle(i, Count++) );
246 Vec_WecPush( &p->vOccurs, Lit, i );
247 }
248 assert( Vec_IntSize(vCube) == Vec_IntCap(vCube) );
249 }
250}
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
#define Pla_ForEachCubeIn(p, pCube, i)
MACRO DEFINITIONS ///.
Definition pla.h:114
#define Pla_CubeForEachLitIn(p, pCube, Lit, i)
Definition pla.h:126
#define assert(ex)
Definition util_old.h:213
Here is the caller graph for this function:

◆ Pla_ManConvertToBits()

void Pla_ManConvertToBits ( Pla_Man_t * p)
extern

Definition at line 251 of file plaMan.c.

252{
253 Vec_Int_t * vCube; int i, k, Lit;
254 Vec_IntFillNatural( &p->vCubes, Vec_WecSize(&p->vCubeLits) );
255 Vec_WrdFill( &p->vInBits, Pla_ManCubeNum(p) * p->nInWords, 0 );
256 Vec_WecForEachLevel( &p->vCubeLits, vCube, i )
257 Vec_IntForEachEntry( vCube, Lit, k )
258 Pla_CubeSetLit( Pla_CubeIn(p, i), Abc_Lit2Var(Lit), Abc_LitIsCompl(Lit) ? PLA_LIT_ZERO : PLA_LIT_ONE );
259}
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
Definition vecWec.h:55

◆ Pla_ManDist1Merge()

int Pla_ManDist1Merge ( Pla_Man_t * p)
extern

DECLARATIONS ///.

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

FileName [plaMerge.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
plaMerge.c,v 1.00 2014/09/12 00:00:00 alanmi Exp

] FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 44 of file plaMerge.c.

45{
46 return 0;
47}

◆ Pla_ManDist1NumTest()

int Pla_ManDist1NumTest ( Pla_Man_t * p)
extern

Definition at line 285 of file plaMan.c.

286{
287 abctime clk = Abc_Clock();
288 int Count = Pla_ManDist1Num( p );
289 printf( "Found %d pairs among %d cubes using cube pair enumeration. ", Count, Pla_ManCubeNum(p) );
290 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
291 return 1;
292}
ABC_INT64_T abctime
Definition abc_global.h:332
int Pla_ManDist1Num(Pla_Man_t *p)
Definition plaMan.c:272
Here is the call graph for this function:

◆ Pla_ManFxPerformSimple()

int Pla_ManFxPerformSimple ( int nVars)
extern

Definition at line 323 of file plaSimple.c.

324{
325 char Buffer[100];
326 Pla_Man_t * p = Pla_ManFxPrepare( nVars );
327 sprintf( Buffer, "primesmin%02d.pla", nVars );
328 Pla_ManDumpPla( p, Buffer );
329 Pla_ManFree( p );
330 return 1;
331}
ABC_NAMESPACE_IMPL_START void Pla_ManDumpPla(Pla_Man_t *p, char *pFileName)
DECLARATIONS ///.
Definition plaSimple.c:44
Pla_Man_t * Pla_ManFxPrepare(int nVars)
Definition plaSimple.c:301
struct Pla_Man_t_ Pla_Man_t
Definition pla.h:63
char * sprintf()
Here is the call graph for this function:

◆ Pla_ManGenerate()

Pla_Man_t * Pla_ManGenerate ( int nIns,
int nOuts,
int nCubes,
int fVerbose )
extern

Definition at line 168 of file plaMan.c.

169{
170 Pla_Man_t * p;
171 Vec_Bit_t * vBits;
172 int i, k, Count;
173 word * pCube;
174 char Buffer[1000];
175 sprintf( Buffer, "%s_%d_%d_%d", "rand", nInputs, nOutputs, nCubes );
176 p = Pla_ManAlloc( Buffer, nInputs, nOutputs, nCubes );
177 // generate nCube random input minterms
178 vBits = Pla_GenRandom( nInputs, nCubes, 0 );
179 for ( i = Count = 0; i < Vec_BitSize(vBits); i++ )
180 if ( Vec_BitEntry(vBits, i) )
181 {
182 pCube = Pla_CubeIn( p, Count++ );
183 for ( k = 0; k < nInputs; k++ )
184 Pla_CubeSetLit( pCube, k, ((i >> k) & 1) ? PLA_LIT_ONE : PLA_LIT_ZERO );
185 }
186 assert( Count == nCubes );
187 Vec_BitFree( vBits );
188 // generate nCube random output minterms
189 if ( nOutputs > 1 )
190 {
191 vBits = Pla_GenRandom( nOutputs, nCubes, 1 );
192 for ( i = Count = 0; i < Vec_BitSize(vBits); i++ )
193 if ( Vec_BitEntry(vBits, i) )
194 {
195 pCube = Pla_CubeOut( p, Count++ );
196 for ( k = 0; k < nOutputs; k++ )
197 Pla_CubeSetLit( pCube, k, ((i >> k) & 1) ? PLA_LIT_ONE : PLA_LIT_ZERO );
198 }
199 assert( Count == nCubes );
200 Vec_BitFree( vBits );
201 }
202 else
203 {
204 Pla_ForEachCubeOut( p, pCube, i )
205 Pla_CubeSetLit( pCube, 0, PLA_LIT_ONE );
206 }
207 return p;
208}
Vec_Bit_t * Pla_GenRandom(int nVars, int nNums, int fNonZero)
Definition plaMan.c:150
#define Pla_ForEachCubeOut(p, pCube, i)
Definition pla.h:119
typedefABC_NAMESPACE_HEADER_START struct Vec_Bit_t_ Vec_Bit_t
INCLUDES ///.
Definition vecBit.h:42
Here is the call graph for this function:

◆ Pla_ManHashDist1NumTest()

int Pla_ManHashDist1NumTest ( Pla_Man_t * p)
extern

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_ManPrimesDetector()

Pla_Man_t * Pla_ManPrimesDetector ( int nVars)
extern

Definition at line 128 of file plaMan.c.

129{
130 char pName[1000];
131 Pla_Man_t * p;
132 Vec_Int_t * vMints = Pla_GenPrimes( nVars );
133 sprintf( pName, "primes%02d", nVars );
134 p = Pla_GenFromMinterms( pName, vMints, nVars );
135 Vec_IntFree( vMints );
136 return p;
137}
Pla_Man_t * Pla_GenFromMinterms(char *pName, Vec_Int_t *vMints, int nVars)
Definition plaMan.c:113
Vec_Int_t * Pla_GenPrimes(int nVars)
Definition plaMan.c:100
Here is the call graph for this function:

◆ Pla_ManPrimesTable()

Vec_Bit_t * Pla_ManPrimesTable ( int nVars)
extern

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

Synopsis [Generates prime detector for the given bit-widths.]

Description []

SideEffects []

SeeAlso []

Definition at line 85 of file plaMan.c.

86{
87 int i, n, nBits = 1 << nVars;
88 Vec_Bit_t * vMap = Vec_BitStartFull( Abc_MaxInt(64, nBits) );
89 for ( i = nBits; i < 64; i++ )
90 Vec_BitWriteEntry( vMap, i, 0 );
91 Vec_BitShrink( vMap, nBits );
92 Vec_BitWriteEntry( vMap, 0, 0 );
93 Vec_BitWriteEntry( vMap, 1, 0 );
94 for ( n = 2; n < nBits; n++ )
95 if ( Vec_BitEntry(vMap, n) )
96 for ( i = 2*n; i < nBits; i += n )
97 Vec_BitWriteEntry( vMap, i, 0 );
98 return vMap;
99}
Here is the caller graph for this function:

◆ Pla_ReadPla()

Pla_Man_t * Pla_ReadPla ( char * pFileName)
extern

Definition at line 186 of file plaRead.c.

187{
188 Pla_Man_t * p;
189 Vec_Str_t * vLits;
190 int nIns, nOuts, nCubes, Type;
191 char * pBuffer, * pLimit;
192 pBuffer = Pla_ReadFile( pFileName, &pLimit );
193 if ( pBuffer == NULL )
194 return NULL;
195 Pla_ReadPlaRemoveComments( pBuffer, pLimit );
196 if ( Pla_ReadPlaHeader( pBuffer, pLimit, &nIns, &nOuts, &nCubes, &Type ) )
197 {
198 vLits = Pla_ReadPlaBody( pBuffer, pLimit, (Pla_File_t)Type );
199 if ( Vec_StrSize(vLits) % (nIns + nOuts) == 0 )
200 {
201 if ( nCubes == -1 )
202 nCubes = Vec_StrSize(vLits) / (nIns + nOuts);
203 p = Pla_ManAlloc( pFileName, nIns, nOuts, nCubes );
204 p->Type = (Pla_File_t)Type;
205 Pla_ReadAddBody( p, vLits );
206 Vec_StrFree( vLits );
207 ABC_FREE( pBuffer );
208 return p;
209 }
210 printf( "Literal count is incorrect (in = %d; out = %d; lit = %d).\n", nIns, nOuts, Vec_StrSize(vLits) );
211 Vec_StrFree( vLits );
212 }
213 ABC_FREE( pBuffer );
214 return NULL;
215}
#define ABC_FREE(obj)
Definition abc_global.h:267
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46
void Pla_ReadPlaRemoveComments(char *pBuffer, char *pLimit)
Definition plaRead.c:82
ABC_NAMESPACE_IMPL_START char * Pla_ReadFile(char *pFileName, char **ppLimit)
DECLARATIONS ///.
Definition plaRead.c:44
Vec_Str_t * Pla_ReadPlaBody(char *pBuffer, char *pLimit, Pla_File_t Type)
Definition plaRead.c:128
void Pla_ReadAddBody(Pla_Man_t *p, Vec_Str_t *vLits)
Definition plaRead.c:157
int Pla_ReadPlaHeader(char *pBuffer, char *pLimit, int *pnIns, int *pnOuts, int *pnCubes, int *pType)
Definition plaRead.c:90
Here is the call graph for this function:

◆ Pla_WritePla()

void Pla_WritePla ( Pla_Man_t * p,
char * pFileName )
extern

Definition at line 88 of file plaWrite.c.

89{
90 Vec_Str_t * vOut = Pla_WritePlaInt( p );
91 if ( Vec_StrSize(vOut) > 0 )
92 {
93 FILE * pFile = fopen( pFileName, "wb" );
94 if ( pFile == NULL )
95 printf( "Cannot open file \"%s\" for writing.\n", pFileName );
96 else
97 {
98 fwrite( Vec_StrArray(vOut), 1, Vec_StrSize(vOut), pFile );
99 fclose( pFile );
100 }
101 }
102 Vec_StrFreeP( &vOut );
103}
ABC_NAMESPACE_IMPL_START Vec_Str_t * Pla_WritePlaInt(Pla_Man_t *p)
DECLARATIONS ///.
Definition plaWrite.c:44
Here is the call graph for this function: