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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START Lpk_Fun_tLpk_FunAlloc (int nVars)
 DECLARATIONS ///.
 
void Lpk_FunFree (Lpk_Fun_t *p)
 
Lpk_Fun_tLpk_FunCreate (Abc_Ntk_t *pNtk, Vec_Ptr_t *vLeaves, unsigned *pTruth, int nLutK, int AreaLim, int DelayLim)
 
Lpk_Fun_tLpk_FunDup (Lpk_Fun_t *p, unsigned *pTruth)
 
int Lpk_FunSuppMinimize (Lpk_Fun_t *p)
 
void Lpk_FunComputeCofSupps (Lpk_Fun_t *p)
 
int Lpk_SuppDelay (unsigned uSupp, int *pDelays)
 
int Lpk_SuppToVars (unsigned uBoundSet, char *pVars)
 

Function Documentation

◆ Lpk_FunAlloc()

ABC_NAMESPACE_IMPL_START Lpk_Fun_t * Lpk_FunAlloc ( int nVars)

DECLARATIONS ///.

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

FileName [lpkAbcUtil.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Fast Boolean matching for LUT structures.]

Synopsis [Procedures working on decomposed functions.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - April 28, 2007.]

Revision [

Id
lpkAbcUtil.c,v 1.00 2007/04/28 00:00:00 alanmi Exp

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

Synopsis [Allocates the function.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file lpkAbcUtil.c.

46{
47 Lpk_Fun_t * p;
48 p = (Lpk_Fun_t *)ABC_ALLOC( char, sizeof(Lpk_Fun_t) + sizeof(unsigned) * Kit_TruthWordNum(nVars) * 3 );
49 memset( p, 0, sizeof(Lpk_Fun_t) );
50 return p;
51}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
Cube * p
Definition exorList.c:222
struct Lpk_Fun_t_ Lpk_Fun_t
Definition lpkInt.h:144
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lpk_FunComputeCofSupps()

void Lpk_FunComputeCofSupps ( Lpk_Fun_t * p)

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

Synopsis [Computes cofactors w.r.t. each variable.]

Description []

SideEffects []

SeeAlso []

Definition at line 186 of file lpkAbcUtil.c.

187{
188 unsigned * pTruth = Lpk_FunTruth( p, 0 );
189 unsigned * pTruth0 = Lpk_FunTruth( p, 1 );
190 unsigned * pTruth1 = Lpk_FunTruth( p, 2 );
191 int Var;
192 assert( p->fSupports == 0 );
193// Lpk_SuppForEachVar( p->uSupp, Var )
194 for ( Var = 0; Var < (int)p->nVars; Var++ )
195 {
196 Kit_TruthCofactor0New( pTruth0, pTruth, p->nVars, Var );
197 Kit_TruthCofactor1New( pTruth1, pTruth, p->nVars, Var );
198 p->puSupps[2*Var+0] = Kit_TruthSupport( pTruth0, p->nVars );
199 p->puSupps[2*Var+1] = Kit_TruthSupport( pTruth1, p->nVars );
200 }
201 p->fSupports = 1;
202}
int Var
Definition exorList.c:228
unsigned Kit_TruthSupport(unsigned *pTruth, int nVars)
Definition kitTruth.c:346
void Kit_TruthCofactor1New(unsigned *pOut, unsigned *pIn, int nVars, int iVar)
Definition kitTruth.c:573
void Kit_TruthCofactor0New(unsigned *pOut, unsigned *pIn, int nVars, int iVar)
Definition kitTruth.c:521
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lpk_FunCreate()

Lpk_Fun_t * Lpk_FunCreate ( Abc_Ntk_t * pNtk,
Vec_Ptr_t * vLeaves,
unsigned * pTruth,
int nLutK,
int AreaLim,
int DelayLim )

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

Synopsis [Creates the starting function.]

Description []

SideEffects []

SeeAlso []

Definition at line 80 of file lpkAbcUtil.c.

81{
82 Lpk_Fun_t * p;
83 Abc_Obj_t * pNode;
84 int i;
85 p = Lpk_FunAlloc( Vec_PtrSize(vLeaves) );
86 p->Id = Vec_PtrSize(vLeaves);
87 p->vNodes = vLeaves;
88 p->nVars = Vec_PtrSize(vLeaves);
89 p->nLutK = nLutK;
90 p->nAreaLim = AreaLim;
91 p->nDelayLim = DelayLim;
92 p->uSupp = Kit_TruthSupport( pTruth, p->nVars );
93 Kit_TruthCopy( Lpk_FunTruth(p,0), pTruth, p->nVars );
94 Vec_PtrForEachEntry( Abc_Obj_t *, vLeaves, pNode, i )
95 {
96 p->pFanins[i] = i;
97 p->pDelays[i] = pNode->Level;
98 }
99 Vec_PtrPush( p->vNodes, p );
100 return p;
101}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
ABC_NAMESPACE_IMPL_START Lpk_Fun_t * Lpk_FunAlloc(int nVars)
DECLARATIONS ///.
Definition lpkAbcUtil.c:45
unsigned Level
Definition abc.h:142
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lpk_FunDup()

Lpk_Fun_t * Lpk_FunDup ( Lpk_Fun_t * p,
unsigned * pTruth )

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

Synopsis [Creates the new function with the given truth table.]

Description []

SideEffects []

SeeAlso []

Definition at line 114 of file lpkAbcUtil.c.

115{
116 Lpk_Fun_t * pNew;
117 pNew = Lpk_FunAlloc( p->nVars );
118 pNew->Id = Vec_PtrSize(p->vNodes);
119 pNew->vNodes = p->vNodes;
120 pNew->nVars = p->nVars;
121 pNew->nLutK = p->nLutK;
122 pNew->nAreaLim = p->nAreaLim;
123 pNew->nDelayLim = p->nDelayLim;
124 pNew->uSupp = Kit_TruthSupport( pTruth, p->nVars );
125 Kit_TruthCopy( Lpk_FunTruth(pNew,0), pTruth, p->nVars );
126 memcpy( pNew->pFanins, p->pFanins, 16 );
127 memcpy( pNew->pDelays, p->pDelays, sizeof(int)*16 );
128 Vec_PtrPush( p->vNodes, pNew );
129 return pNew;
130}
int pDelays[16]
Definition lpkInt.h:157
unsigned nAreaLim
Definition lpkInt.h:151
unsigned nLutK
Definition lpkInt.h:150
char pFanins[16]
Definition lpkInt.h:158
unsigned nDelayLim
Definition lpkInt.h:156
unsigned nVars
Definition lpkInt.h:149
unsigned uSupp
Definition lpkInt.h:154
unsigned Id
Definition lpkInt.h:148
Vec_Ptr_t * vNodes
Definition lpkInt.h:147
char * memcpy()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lpk_FunFree()

void Lpk_FunFree ( Lpk_Fun_t * p)

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

Synopsis [Deletes the function]

Description []

SideEffects []

SeeAlso []

Definition at line 64 of file lpkAbcUtil.c.

65{
66 ABC_FREE( p );
67}
#define ABC_FREE(obj)
Definition abc_global.h:267
Here is the caller graph for this function:

◆ Lpk_FunSuppMinimize()

int Lpk_FunSuppMinimize ( Lpk_Fun_t * p)

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

Synopsis [Minimizes support of the function.]

Description []

SideEffects []

SeeAlso []

Definition at line 143 of file lpkAbcUtil.c.

144{
145 int i, k, nVarsNew;
146 // compress the truth table
147 if ( p->uSupp == Kit_BitMask(p->nVars) )
148 return 0;
149 // invalidate support info
150 p->fSupports = 0;
151//Extra_PrintBinary( stdout, &p->uSupp, p->nVars ); printf( "\n" );
152 // minimize support
153 nVarsNew = Kit_WordCountOnes(p->uSupp);
154 Kit_TruthShrink( Lpk_FunTruth(p, 1), Lpk_FunTruth(p, 0), nVarsNew, p->nVars, p->uSupp, 1 );
155 k = 0;
156 Lpk_SuppForEachVar( p->uSupp, i )
157 {
158 p->pFanins[k] = p->pFanins[i];
159 p->pDelays[k] = p->pDelays[i];
160/*
161 if ( p->fSupports )
162 {
163 p->puSupps[2*k+0] = p->puSupps[2*i+0];
164 p->puSupps[2*k+1] = p->puSupps[2*i+1];
165 }
166*/
167 k++;
168 }
169 assert( k == nVarsNew );
170 p->nVars = k;
171 p->uSupp = Kit_BitMask(p->nVars);
172 return 1;
173}
void Kit_TruthShrink(unsigned *pOut, unsigned *pIn, int nVars, int nVarsAll, unsigned Phase, int fReturnIn)
Definition kitTruth.c:200
#define Lpk_SuppForEachVar(Supp, Var)
Definition lpkInt.h:196
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lpk_SuppDelay()

int Lpk_SuppDelay ( unsigned uSupp,
int * pDelays )

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

Synopsis [Get the delay of the bound set.]

Description []

SideEffects []

SeeAlso []

Definition at line 215 of file lpkAbcUtil.c.

216{
217 int Delay, Var;
218 Delay = 0;
219 Lpk_SuppForEachVar( uSupp, Var )
220 Delay = Abc_MaxInt( Delay, pDelays[Var] );
221 return Delay + 1;
222}
Here is the caller graph for this function:

◆ Lpk_SuppToVars()

int Lpk_SuppToVars ( unsigned uBoundSet,
char * pVars )

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

Synopsis [Converts support into variables.]

Description []

SideEffects []

SeeAlso []

Definition at line 235 of file lpkAbcUtil.c.

236{
237 int i, nVars = 0;
238 Lpk_SuppForEachVar( uBoundSet, i )
239 pVars[nVars++] = i;
240 return nVars;
241}