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

Go to the source code of this file.

Classes

struct  Amap_Man_t_
 
struct  Amap_Lib_t_
 
struct  Amap_Pin_t_
 
struct  Amap_Gat_t_
 
struct  Amap_Set_t_
 
struct  Amap_Nod_t_
 
struct  Amap_Cut_t_
 
struct  Amap_Mat_t_
 
struct  Amap_Obj_t_
 

Macros

#define AMAP_MAXINS   15
 INCLUDES ///.
 
#define AMAP_STRING_CONST0   "CONST0"
 
#define AMAP_STRING_CONST1   "CONST1"
 
#define Amap_ManForEachPi(p, pObj, i)
 MACRO DEFINITIONS ///.
 
#define Amap_ManForEachPo(p, pObj, i)
 
#define Amap_ManForEachObj(p, pObj, i)
 
#define Amap_ManForEachNode(p, pObj, i)
 
#define Amap_LibForEachGate(pLib, pGate, i)
 
#define Amap_GateForEachPin(pGate, pPin)
 
#define Amap_NodeForEachCut(pNode, pCut, i)
 
#define Amap_LibNodeForEachSet(pNod, pSet)
 
#define Amap_MatchForEachFaninCompl(p, pM, pFanin, fCompl, i)
 
#define Amap_MatchForEachFanin(p, pM, pFanin, i)
 

Typedefs

typedef struct Amap_Pin_t_ Amap_Pin_t
 BASIC TYPES ///.
 
typedef struct Amap_Gat_t_ Amap_Gat_t
 
typedef struct Amap_Nod_t_ Amap_Nod_t
 
typedef struct Amap_Set_t_ Amap_Set_t
 
typedef struct Amap_Man_t_ Amap_Man_t
 
typedef struct Amap_Obj_t_ Amap_Obj_t
 
typedef struct Amap_Cut_t_ Amap_Cut_t
 
typedef struct Amap_Mat_t_ Amap_Mat_t
 

Enumerations

enum  Amap_Type_t {
  AMAP_OBJ_NONE , AMAP_OBJ_CONST1 , AMAP_OBJ_PI , AMAP_OBJ_PO ,
  AMAP_OBJ_AND , AMAP_OBJ_XOR , AMAP_OBJ_MUX , AMAP_OBJ_VOID
}
 

Functions

void Kit_DsdPrintFromTruth (unsigned *pTruth, int nVars)
 
Amap_Obj_tAmap_ManCreatePi (Amap_Man_t *p)
 FUNCTION DECLARATIONS ///.
 
Amap_Obj_tAmap_ManCreatePo (Amap_Man_t *p, Amap_Obj_t *pFan0)
 
Amap_Obj_tAmap_ManCreateAnd (Amap_Man_t *p, Amap_Obj_t *pFan0, Amap_Obj_t *pFan1)
 
Amap_Obj_tAmap_ManCreateXor (Amap_Man_t *p, Amap_Obj_t *pFan0, Amap_Obj_t *pFan1)
 
Amap_Obj_tAmap_ManCreateMux (Amap_Man_t *p, Amap_Obj_t *pFanC, Amap_Obj_t *pFan1, Amap_Obj_t *pFan0)
 
void Amap_ManCreateChoice (Amap_Man_t *p, Amap_Obj_t *pObj)
 
void Amap_ManCreate (Amap_Man_t *p, Aig_Man_t *pAig)
 
Amap_Lib_tAmap_LibAlloc ()
 DECLARATIONS ///.
 
int Amap_LibNumPinsMax (Amap_Lib_t *p)
 
void Amap_LibWrite (FILE *pFile, Amap_Lib_t *pLib, int fPrintDsd)
 
Vec_Ptr_tAmap_LibSelectGates (Amap_Lib_t *p, int fVerbose)
 
Amap_Man_tAmap_ManStart (int nNodes)
 DECLARATIONS ///.
 
void Amap_ManStop (Amap_Man_t *p)
 
void Amap_ManMap (Amap_Man_t *p)
 
void Amap_ManMerge (Amap_Man_t *p)
 
Vec_Ptr_tAmap_ManProduceMapped (Amap_Man_t *p)
 
int Amap_LibParseEquations (Amap_Lib_t *p, int fVerbose)
 
Amap_Lib_tAmap_LibReadBuffer (char *pBuffer, int fVerbose)
 
Amap_Lib_tAmap_LibReadFile (char *pFileName, int fVerbose)
 
short * Amap_LibTableFindNode (Amap_Lib_t *p, int iFan0, int iFan1, int fXor)
 
void Amap_LibCreateRules (Amap_Lib_t *p, int fVeryVerbose)
 
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)
 
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)
 

Macro Definition Documentation

◆ Amap_GateForEachPin

#define Amap_GateForEachPin ( pGate,
pPin )
Value:
for ( pPin = pGate->Pins; pPin < pGate->Pins + pGate->nPins; pPin++ )

Definition at line 297 of file amapInt.h.

297#define Amap_GateForEachPin( pGate, pPin ) \
298 for ( pPin = pGate->Pins; pPin < pGate->Pins + pGate->nPins; pPin++ )

◆ Amap_LibForEachGate

#define Amap_LibForEachGate ( pLib,
pGate,
i )
Value:
Vec_PtrForEachEntry( Amap_Gat_t *, pLib->vGates, pGate, i )
struct Amap_Gat_t_ Amap_Gat_t
Definition amapInt.h:66
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55

Definition at line 294 of file amapInt.h.

294#define Amap_LibForEachGate( pLib, pGate, i ) \
295 Vec_PtrForEachEntry( Amap_Gat_t *, pLib->vGates, pGate, i )

◆ Amap_LibNodeForEachSet

#define Amap_LibNodeForEachSet ( pNod,
pSet )
Value:
for ( pSet = pNod->pSets; pSet; pSet = pSet->pNext )

Definition at line 306 of file amapInt.h.

306#define Amap_LibNodeForEachSet( pNod, pSet ) \
307 for ( pSet = pNod->pSets; pSet; pSet = pSet->pNext )

◆ Amap_ManForEachNode

#define Amap_ManForEachNode ( p,
pObj,
i )
Value:
Vec_PtrForEachEntry( Amap_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL || !Amap_ObjIsNode(pObj) ) {} else
struct Amap_Obj_t_ Amap_Obj_t
Definition amapInt.h:71
Cube * p
Definition exorList.c:222

Definition at line 290 of file amapInt.h.

290#define Amap_ManForEachNode( p, pObj, i ) \
291 Vec_PtrForEachEntry( Amap_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL || !Amap_ObjIsNode(pObj) ) {} else

◆ Amap_ManForEachObj

#define Amap_ManForEachObj ( p,
pObj,
i )
Value:
Vec_PtrForEachEntry( Amap_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL ) {} else

Definition at line 287 of file amapInt.h.

287#define Amap_ManForEachObj( p, pObj, i ) \
288 Vec_PtrForEachEntry( Amap_Obj_t *, p->vObjs, pObj, i ) if ( (pObj) == NULL ) {} else

◆ Amap_ManForEachPi

#define Amap_ManForEachPi ( p,
pObj,
i )
Value:
Vec_PtrForEachEntry( Amap_Obj_t *, p->vPis, pObj, i )

MACRO DEFINITIONS ///.

Definition at line 281 of file amapInt.h.

281#define Amap_ManForEachPi( p, pObj, i ) \
282 Vec_PtrForEachEntry( Amap_Obj_t *, p->vPis, pObj, i )

◆ Amap_ManForEachPo

#define Amap_ManForEachPo ( p,
pObj,
i )
Value:
Vec_PtrForEachEntry( Amap_Obj_t *, p->vPos, pObj, i )

Definition at line 284 of file amapInt.h.

284#define Amap_ManForEachPo( p, pObj, i ) \
285 Vec_PtrForEachEntry( Amap_Obj_t *, p->vPos, pObj, i )

◆ Amap_MatchForEachFanin

#define Amap_MatchForEachFanin ( p,
pM,
pFanin,
i )
Value:
for ( i = 0; i < (int)(pM)->pCut->nFans && \
((pFanin = Amap_ManObj((p), Abc_Lit2Var((pM)->pCut->Fans[Abc_Lit2Var((pM)->pSet->Ins[i])]))), 1); \
i++ )

Definition at line 317 of file amapInt.h.

317#define Amap_MatchForEachFanin( p, pM, pFanin, i ) \
318 for ( i = 0; i < (int)(pM)->pCut->nFans && \
319 ((pFanin = Amap_ManObj((p), Abc_Lit2Var((pM)->pCut->Fans[Abc_Lit2Var((pM)->pSet->Ins[i])]))), 1); \
320 i++ )

◆ Amap_MatchForEachFaninCompl

#define Amap_MatchForEachFaninCompl ( p,
pM,
pFanin,
fCompl,
i )
Value:
for ( i = 0; i < (int)(pM)->pCut->nFans && \
((pFanin = Amap_ManObj((p), Abc_Lit2Var((pM)->pCut->Fans[Abc_Lit2Var((pM)->pSet->Ins[i])]))), 1) && \
((fCompl = Abc_LitIsCompl((pM)->pSet->Ins[i]) ^ Abc_LitIsCompl((pM)->pCut->Fans[Abc_Lit2Var((pM)->pSet->Ins[i])])), 1); \
i++ )

Definition at line 310 of file amapInt.h.

310#define Amap_MatchForEachFaninCompl( p, pM, pFanin, fCompl, i ) \
311 for ( i = 0; i < (int)(pM)->pCut->nFans && \
312 ((pFanin = Amap_ManObj((p), Abc_Lit2Var((pM)->pCut->Fans[Abc_Lit2Var((pM)->pSet->Ins[i])]))), 1) && \
313 ((fCompl = Abc_LitIsCompl((pM)->pSet->Ins[i]) ^ Abc_LitIsCompl((pM)->pCut->Fans[Abc_Lit2Var((pM)->pSet->Ins[i])])), 1); \
314 i++ )

◆ AMAP_MAXINS

#define AMAP_MAXINS   15

INCLUDES ///.

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

FileName [amapInt.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Technology mapper for standard cells.]

Synopsis [Internal declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
amapInt.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

] PARAMETERS ///

Definition at line 44 of file amapInt.h.

◆ Amap_NodeForEachCut

#define Amap_NodeForEachCut ( pNode,
pCut,
i )
Value:
for ( i = 0, pCut = (Amap_Cut_t *)pNode->pData; i < (int)pNode->nCuts; \
i++, pCut = Amap_ManCutNext(pCut) )
struct Amap_Cut_t_ Amap_Cut_t
Definition amapInt.h:72

Definition at line 301 of file amapInt.h.

301#define Amap_NodeForEachCut( pNode, pCut, i ) \
302 for ( i = 0, pCut = (Amap_Cut_t *)pNode->pData; i < (int)pNode->nCuts; \
303 i++, pCut = Amap_ManCutNext(pCut) )

◆ AMAP_STRING_CONST0

#define AMAP_STRING_CONST0   "CONST0"

Definition at line 46 of file amapInt.h.

◆ AMAP_STRING_CONST1

#define AMAP_STRING_CONST1   "CONST1"

Definition at line 47 of file amapInt.h.

Typedef Documentation

◆ Amap_Cut_t

typedef struct Amap_Cut_t_ Amap_Cut_t

Definition at line 72 of file amapInt.h.

◆ Amap_Gat_t

typedef struct Amap_Gat_t_ Amap_Gat_t

Definition at line 66 of file amapInt.h.

◆ Amap_Man_t

typedef struct Amap_Man_t_ Amap_Man_t

Definition at line 70 of file amapInt.h.

◆ Amap_Mat_t

typedef struct Amap_Mat_t_ Amap_Mat_t

Definition at line 73 of file amapInt.h.

◆ Amap_Nod_t

typedef struct Amap_Nod_t_ Amap_Nod_t

Definition at line 67 of file amapInt.h.

◆ Amap_Obj_t

typedef struct Amap_Obj_t_ Amap_Obj_t

Definition at line 71 of file amapInt.h.

◆ Amap_Pin_t

typedef struct Amap_Pin_t_ Amap_Pin_t

BASIC TYPES ///.

Definition at line 65 of file amapInt.h.

◆ Amap_Set_t

typedef struct Amap_Set_t_ Amap_Set_t

Definition at line 68 of file amapInt.h.

Enumeration Type Documentation

◆ Amap_Type_t

Enumerator
AMAP_OBJ_NONE 
AMAP_OBJ_CONST1 
AMAP_OBJ_PI 
AMAP_OBJ_PO 
AMAP_OBJ_AND 
AMAP_OBJ_XOR 
AMAP_OBJ_MUX 
AMAP_OBJ_VOID 

Definition at line 50 of file amapInt.h.

50 {
51 AMAP_OBJ_NONE, // 0: non-existent object
52 AMAP_OBJ_CONST1, // 1: constant 1
53 AMAP_OBJ_PI, // 2: primary input
54 AMAP_OBJ_PO, // 3: primary output
55 AMAP_OBJ_AND, // 4: AND node
56 AMAP_OBJ_XOR, // 5: XOR node
57 AMAP_OBJ_MUX, // 6: MUX node
58 AMAP_OBJ_VOID // 7: unused object
Amap_Type_t
Definition amapInt.h:50
@ AMAP_OBJ_NONE
Definition amapInt.h:51
@ AMAP_OBJ_VOID
Definition amapInt.h:58
@ AMAP_OBJ_XOR
Definition amapInt.h:56
@ AMAP_OBJ_AND
Definition amapInt.h:55
@ AMAP_OBJ_CONST1
Definition amapInt.h:52
@ AMAP_OBJ_PO
Definition amapInt.h:54
@ AMAP_OBJ_PI
Definition amapInt.h:53
@ AMAP_OBJ_MUX
Definition amapInt.h:57

Function Documentation

◆ Amap_LibAlloc()

Amap_Lib_t * Amap_LibAlloc ( )
extern

DECLARATIONS ///.

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

FileName [amapLib.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Technology mapper for standard cells.]

Synopsis [Standard-cell library.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
amapLib.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

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

Synopsis [Allocs a library.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file amapLib.c.

46{
47 Amap_Lib_t * p;
49 memset( p, 0, sizeof(Amap_Lib_t) );
50 p->vGates = Vec_PtrAlloc( 100 );
51 p->pMemGates = Aig_MmFlexStart();
52 p->pMemSet = Aig_MmFlexStart();
53 return p;
54}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
Aig_MmFlex_t * Aig_MmFlexStart()
Definition aigMem.c:305
typedefABC_NAMESPACE_HEADER_START struct Amap_Lib_t_ Amap_Lib_t
INCLUDES ///.
Definition amap.h:42
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Amap_LibCreateMux()

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

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}
struct Amap_Nod_t_ Amap_Nod_t
Definition amapInt.h:67
Amap_Nod_t * Amap_LibCreateObj(Amap_Lib_t *p)
Definition amapUniq.c:135
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 )
extern

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}
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_LibCreateRules()

void Amap_LibCreateRules ( Amap_Lib_t * pLib,
int fVeryVerbose )
extern

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

Synopsis [Creates rules for the given gate]

Description []

SideEffects []

SeeAlso []

Definition at line 426 of file amapRule.c.

427{
428 Amap_Gat_t * pGate;
429 int i, nGates = 0;
430// abctime clk = Abc_Clock();
431 pLib->fVerbose = fVeryVerbose;
432 pLib->vRules = Vec_PtrAlloc( 100 );
433 pLib->vRulesX = Vec_PtrAlloc( 100 );
434 pLib->vRules3 = Vec_IntAlloc( 100 );
435 Amap_LibCreateVar( pLib );
436 Vec_PtrForEachEntry( Amap_Gat_t *, pLib->vSelect, pGate, i )
437 {
438 if ( pGate->nPins < 2 )
439 continue;
440 if ( pGate->pFunc == NULL )
441 {
442 printf( "Amap_LibCreateRules(): Skipping gate %s (%s).\n", pGate->pName, pGate->pForm );
443 continue;
444 }
445 Amap_CreateRulesForGate( pLib, pGate );
446 nGates++;
447 }
448 assert( Vec_PtrSize(pLib->vRules) == 2*pLib->nNodes );
449 assert( Vec_PtrSize(pLib->vRulesX) == 2*pLib->nNodes );
450 pLib->pRules = Amap_LibLookupTableAlloc( pLib->vRules, 0 );
451 pLib->pRulesX = Amap_LibLookupTableAlloc( pLib->vRulesX, 0 );
452 Vec_VecFree( (Vec_Vec_t *)pLib->vRules ); pLib->vRules = NULL;
453 Vec_VecFree( (Vec_Vec_t *)pLib->vRulesX ); pLib->vRulesX = NULL;
454}
int Amap_LibCreateVar(Amap_Lib_t *p)
Definition amapUniq.c:164
int ** Amap_LibLookupTableAlloc(Vec_Ptr_t *vVec, int fVerbose)
Definition amapUniq.c:278
void Amap_CreateRulesForGate(Amap_Lib_t *pLib, Amap_Gat_t *pGate)
Definition amapRule.c:330
char * pForm
Definition amapInt.h:158
unsigned nPins
Definition amapInt.h:162
char * pName
Definition amapInt.h:155
unsigned * pFunc
Definition amapInt.h:159
#define assert(ex)
Definition util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition vecVec.h:42
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)
extern

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}
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 )
extern

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 )
extern

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 )
extern

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
Here is the caller graph for this function:

◆ Amap_LibNumPinsMax()

int Amap_LibNumPinsMax ( Amap_Lib_t * p)
extern

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

Synopsis [Returns the largest gate size.]

Description []

SideEffects []

SeeAlso []

Definition at line 103 of file amapLib.c.

104{
105 Amap_Gat_t * pGate;
106 int i, Counter = 0;
107 Amap_LibForEachGate( p, pGate, i )
108 if ( Counter < (int)pGate->nPins )
109 Counter = pGate->nPins;
110 return Counter;
111}
#define Amap_LibForEachGate(pLib, pGate, i)
Definition amapInt.h:294
Here is the caller graph for this function:

◆ Amap_LibParseEquations()

int Amap_LibParseEquations ( Amap_Lib_t * p,
int fVerbose )
extern

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

Synopsis [Parses equations for the gates.]

Description []

SideEffects []

SeeAlso []

Definition at line 392 of file amapParse.c.

393{
394// extern int Kit_TruthSupportSize( unsigned * pTruth, int nVars );
395 Hop_Man_t * pMan;
396 Hop_Obj_t * pObj;
397 Vec_Ptr_t * vNames;
398 Vec_Int_t * vTruth;
399 Amap_Gat_t * pGate;
400 Amap_Pin_t * pPin;
401 unsigned * pTruth;
402 int i, nPinMax;
403 nPinMax = Amap_LibNumPinsMax(p);
404 if ( nPinMax > AMAP_MAXINS )
405 printf( "Gates with more than %d inputs will be ignored.\n", AMAP_MAXINS );
406 vTruth = Vec_IntAlloc( 1 << 16 );
407 vNames = Vec_PtrAlloc( 100 );
408 pMan = Hop_ManStart();
409 Hop_IthVar( pMan, nPinMax - 1 );
410 Vec_PtrForEachEntry( Amap_Gat_t *, p->vGates, pGate, i )
411 {
412 if ( pGate->nPins == 0 )
413 {
414 pGate->pFunc = (unsigned *)Aig_MmFlexEntryFetch( p->pMemGates, 4 );
415 if ( strcmp( pGate->pForm, AMAP_STRING_CONST0 ) == 0 )
416 pGate->pFunc[0] = 0;
417 else if ( strcmp( pGate->pForm, AMAP_STRING_CONST1 ) == 0 )
418 pGate->pFunc[0] = ~0;
419 else
420 {
421 printf( "Cannot parse formula \"%s\" of gate \"%s\" with no pins.\n", pGate->pForm, pGate->pName );
422 break;
423 }
424 continue;
425 }
426 if ( pGate->nPins > AMAP_MAXINS )
427 continue;
428 Vec_PtrClear( vNames );
429 Amap_GateForEachPin( pGate, pPin )
430 Vec_PtrPush( vNames, pPin->pName );
431 pObj = Amap_ParseFormula( stdout, pGate->pForm, vNames, pMan, pGate->pName );
432 if ( pObj == NULL )
433 break;
434 pTruth = Hop_ManConvertAigToTruth( pMan, pObj, pGate->nPins, vTruth, 0 );
435 if ( Kit_TruthSupportSize(pTruth, pGate->nPins) < (int)pGate->nPins )
436 {
437 if ( fVerbose )
438 printf( "Skipping gate \"%s\" because its output \"%s\" does not depend on all input variables.\n", pGate->pName, pGate->pForm );
439 continue;
440 }
441 pGate->pFunc = (unsigned *)Aig_MmFlexEntryFetch( p->pMemGates, sizeof(unsigned)*Abc_TruthWordNum(pGate->nPins) );
442 memcpy( pGate->pFunc, pTruth, sizeof(unsigned)*Abc_TruthWordNum(pGate->nPins) );
443 }
444 Vec_PtrFree( vNames );
445 Vec_IntFree( vTruth );
446 Hop_ManStop( pMan );
447 return i == Vec_PtrSize(p->vGates);
448}
char * Aig_MmFlexEntryFetch(Aig_MmFlex_t *p, int nBytes)
Definition aigMem.c:366
#define Amap_GateForEachPin(pGate, pPin)
Definition amapInt.h:297
int Amap_LibNumPinsMax(Amap_Lib_t *p)
Definition amapLib.c:103
#define AMAP_STRING_CONST1
Definition amapInt.h:47
#define AMAP_STRING_CONST0
Definition amapInt.h:46
#define AMAP_MAXINS
INCLUDES ///.
Definition amapInt.h:44
struct Amap_Pin_t_ Amap_Pin_t
BASIC TYPES ///.
Definition amapInt.h:65
Hop_Obj_t * Amap_ParseFormula(FILE *pOutput, char *pFormInit, Vec_Ptr_t *vVarNames, Hop_Man_t *pMan, char *pGateName)
Definition amapParse.c:106
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition hop.h:49
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition hopOper.c:63
void Hop_ManStop(Hop_Man_t *p)
Definition hopMan.c:84
unsigned * Hop_ManConvertAigToTruth(Hop_Man_t *p, Hop_Obj_t *pRoot, int nVars, Vec_Int_t *vTruth, int fMsbFirst)
Definition hopTruth.c:143
Hop_Man_t * Hop_ManStart()
DECLARATIONS ///.
Definition hopMan.c:45
struct Hop_Obj_t_ Hop_Obj_t
Definition hop.h:50
int Kit_TruthSupportSize(unsigned *pTruth, int nVars)
Definition kitTruth.c:327
char * pName
Definition amapInt.h:141
char * memcpy()
int strcmp()
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Amap_LibReadBuffer()

Amap_Lib_t * Amap_LibReadBuffer ( char * pBuffer,
int fVerbose )
extern

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

Synopsis [Reads the library from the input file.]

Description []

SideEffects []

SeeAlso []

Definition at line 458 of file amapRead.c.

459{
460 Amap_Lib_t * pLib;
461 Vec_Ptr_t * vTokens;
462 Amap_RemoveComments( pBuffer, NULL, NULL );
463 vTokens = Amap_DeriveTokens( pBuffer );
464 pLib = Amap_ParseTokens( vTokens, fVerbose );
465 if ( pLib == NULL )
466 {
467 Vec_PtrFree( vTokens );
468 return NULL;
469 }
470 Vec_PtrFree( vTokens );
471 return pLib;
472}
void Amap_RemoveComments(char *pBuffer, int *pnDots, int *pnLines)
Definition amapRead.c:121
Vec_Ptr_t * Amap_DeriveTokens(char *pBuffer)
Definition amapRead.c:188
Amap_Lib_t * Amap_ParseTokens(Vec_Ptr_t *vTokens, int fVerbose)
Definition amapRead.c:338
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Amap_LibReadFile()

Amap_Lib_t * Amap_LibReadFile ( char * pFileName,
int fVerbose )
extern

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

Synopsis [Reads the library from the input file.]

Description []

SideEffects []

SeeAlso []

Definition at line 485 of file amapRead.c.

486{
487 Amap_Lib_t * pLib;
488 char * pBuffer;
489 pBuffer = Amap_LoadFile( pFileName );
490 if ( pBuffer == NULL )
491 return NULL;
492 pLib = Amap_LibReadBuffer( pBuffer, fVerbose );
493 if ( pLib )
494 pLib->pName = Abc_UtilStrsav( pFileName );
495 ABC_FREE( pBuffer );
496 return pLib;
497}
#define ABC_FREE(obj)
Definition abc_global.h:267
Amap_Lib_t * Amap_LibReadBuffer(char *pBuffer, int fVerbose)
Definition amapRead.c:458
char * Amap_LoadFile(char *pFileName)
FUNCTION DEFINITIONS ///.
Definition amapRead.c:74
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Amap_LibSelectGates()

Vec_Ptr_t * Amap_LibSelectGates ( Amap_Lib_t * p,
int fVerbose )
extern

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

Synopsis [Selects gates useful for area-only mapping.]

Description []

SideEffects []

SeeAlso []

Definition at line 264 of file amapLib.c.

265{
266 Vec_Ptr_t * vSelect;
267 Amap_Gat_t * pGate, * pGate2;
268 int i, k;//, clk = Abc_Clock();
269 p->pGate0 = Amap_LibFindGate( p, 0 );
270 p->pGate1 = Amap_LibFindGate( p, ~0 );
271 p->pGateBuf = Amap_LibFindGate( p, 0xAAAAAAAA );
272 p->pGateInv = Amap_LibFindGate( p, ~0xAAAAAAAA );
273 vSelect = Vec_PtrAlloc( 100 );
274 Vec_PtrForEachEntry( Amap_Gat_t *, p->vSorted, pGate, i )
275 {
276 if ( pGate->pFunc == NULL || pGate->pTwin != NULL )
277 continue;
278 Vec_PtrForEachEntryStop( Amap_Gat_t *, p->vSorted, pGate2, k, i )
279 {
280 if ( pGate2->pFunc == NULL || pGate2->pTwin != NULL )
281 continue;
282 if ( pGate2->nPins != pGate->nPins )
283 continue;
284 if ( !memcmp( pGate2->pFunc, pGate->pFunc, sizeof(unsigned) * Abc_TruthWordNum(pGate->nPins) ) )
285 break;
286 }
287 if ( k < i )
288 continue;
289 Vec_PtrPush( vSelect, pGate );
290 }
291 return vSelect;
292}
Amap_Gat_t * Amap_LibFindGate(Amap_Lib_t *p, unsigned uTruth)
Definition amapLib.c:240
Amap_Gat_t * pTwin
Definition amapInt.h:154
int memcmp()
#define Vec_PtrForEachEntryStop(Type, vVec, pEntry, i, Stop)
Definition vecPtr.h:59
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Amap_LibTableFindNode()

short * Amap_LibTableFindNode ( Amap_Lib_t * p,
int iFan0,
int iFan1,
int fXor )
extern

◆ Amap_LibWrite()

void Amap_LibWrite ( FILE * pFile,
Amap_Lib_t * pLib,
int fPrintDsd )
extern

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

Synopsis [Writes library.]

Description []

SideEffects []

SeeAlso []

Definition at line 179 of file amapLib.c.

180{
181 Amap_Gat_t * pGate;
182 int i;
183 fprintf( pFile, "# The genlib library \"%s\".\n", pLib->pName );
184 Amap_LibForEachGate( pLib, pGate, i )
185 Amap_LibWriteGate( pFile, pGate, fPrintDsd );
186}
void Amap_LibWriteGate(FILE *pFile, Amap_Gat_t *pGate, int fPrintDsd)
Definition amapLib.c:150
Here is the call graph for this function:

◆ Amap_ManCreate()

void Amap_ManCreate ( Amap_Man_t * p,
Aig_Man_t * pAig )
extern

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

Synopsis [Starts the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 323 of file amapGraph.c.

324{
325 Vec_Ptr_t * vNodes;
326 Amap_Obj_t * pChoices[4];
327 Aig_Obj_t * pObj, * pFanin, * pPrev, * pFan0, * pFan1, * pFanC;
328 int i, fChoices;
329 if ( pAig->pEquivs )
330 vNodes = Aig_ManDfsChoices( pAig );
331 else
332 vNodes = Aig_ManDfs( pAig, 1 );
333 p->pConst1 = Amap_ManCreateConst1( p );
334 // print warning about excessive memory usage
335 if ( p->pPars->fVerbose )
336 {
337 if ( 1.0 * Aig_ManObjNum(pAig) * sizeof(Amap_Obj_t) / (1<<30) > 0.1 )
338 printf( "Warning: Mapper allocates %.3f GB for subject graph with %d objects.\n",
339 1.0 * Aig_ManObjNum(pAig) * sizeof(Amap_Obj_t) / (1<<30), Aig_ManObjNum(pAig) );
340 }
341 // create PIs and remember them in the old nodes
342 Aig_ManCleanData(pAig);
343 Aig_ManConst1(pAig)->pData = Amap_ManConst1( p );
344 Aig_ManForEachCi( pAig, pObj, i )
345 pObj->pData = Amap_ManCreatePi( p );
346 // load the AIG into the mapper
347 Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
348 {
349 fChoices = 0;
350 if ( p->fUseXor && Aig_ObjRecognizeExor(pObj, &pFan0, &pFan1 ) )
351 {
352 Amap_ManCreateXorChoices( p, Amap_AndToObj(pFan0), Amap_AndToObj(pFan1), pChoices );
353 fChoices = 1;
354 }
355 else if ( p->fUseMux && Aig_ObjIsMuxType(pObj) )
356 {
357 pFanC = Aig_ObjRecognizeMux( pObj, &pFan1, &pFan0 );
358 Amap_ManCreateMuxChoices( p, Amap_AndToObj(pFan0), Amap_AndToObj(pFan1), Amap_AndToObj(pFanC), pChoices );
359 fChoices = 1;
360 }
361 pObj->pData = Amap_ManCreateAnd( p, (Amap_Obj_t *)Aig_ObjChild0Copy(pObj), (Amap_Obj_t *)Aig_ObjChild1Copy(pObj) );
362 if ( fChoices )
363 {
364 p->nChoicesAdded++;
365 Amap_ObjSetChoice( (Amap_Obj_t *)pObj->pData, pChoices[0] );
366 Amap_ObjSetChoice( pChoices[0], pChoices[1] );
367 Amap_ObjSetChoice( pChoices[1], pChoices[2] );
368 Amap_ObjSetChoice( pChoices[2], pChoices[3] );
370 }
371 if ( Aig_ObjIsChoice( pAig, pObj ) )
372 {
373// assert( !fChoices );
374 p->nChoicesGiven++;
375 for ( pPrev = pObj, pFanin = Aig_ObjEquiv(pAig, pObj); pFanin; pPrev = pFanin, pFanin = Aig_ObjEquiv(pAig, pFanin) )
376 {
377 ((Amap_Obj_t *)pFanin->pData)->fRepr = 0;
378 Amap_ObjSetChoice( Amap_ManGetLast_rec(p, (Amap_Obj_t *)pPrev->pData),
379 (Amap_Obj_t *)pFanin->pData );
380 }
382 }
383 }
384 Vec_PtrFree( vNodes );
385 // set the primary outputs without copying the phase
386 Aig_ManForEachCo( pAig, pObj, i )
387 pObj->pData = Amap_ManCreatePo( p, (Amap_Obj_t *)Aig_ObjChild0Copy(pObj) );
388 if ( p->pPars->fVerbose )
389 printf( "Performing mapping with %d given and %d created choices.\n",
390 p->nChoicesGiven, p->nChoicesAdded );
391}
Aig_Obj_t * Aig_ObjRecognizeMux(Aig_Obj_t *pObj, Aig_Obj_t **ppObjT, Aig_Obj_t **ppObjE)
Definition aigUtil.c:387
Vec_Ptr_t * Aig_ManDfsChoices(Aig_Man_t *p)
Definition aigDfs.c:405
int Aig_ObjRecognizeExor(Aig_Obj_t *pObj, Aig_Obj_t **ppFan0, Aig_Obj_t **ppFan1)
Definition aigUtil.c:343
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition aig.h:393
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
#define Aig_ManForEachCo(p, pObj, i)
Definition aig.h:398
Vec_Ptr_t * Aig_ManDfs(Aig_Man_t *p, int fNodesOnly)
Definition aigDfs.c:145
int Aig_ObjIsMuxType(Aig_Obj_t *pObj)
Definition aigUtil.c:307
void Aig_ManCleanData(Aig_Man_t *p)
Definition aigUtil.c:205
void Amap_ManCreateMuxChoices(Amap_Man_t *p, Amap_Obj_t *pFan0, Amap_Obj_t *pFan1, Amap_Obj_t *pFanC, Amap_Obj_t *pChoices[])
Definition amapGraph.c:270
Amap_Obj_t * Amap_ManCreatePo(Amap_Man_t *p, Amap_Obj_t *pFan0)
Definition amapGraph.c:110
void Amap_ManCreateXorChoices(Amap_Man_t *p, Amap_Obj_t *pFan0, Amap_Obj_t *pFan1, Amap_Obj_t *pChoices[])
Definition amapGraph.c:251
void Amap_ManCreateChoice(Amap_Man_t *p, Amap_Obj_t *pObj)
Definition amapGraph.c:222
Amap_Obj_t * Amap_ManCreatePi(Amap_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition amapGraph.c:88
Amap_Obj_t * Amap_ManCreateConst1(Amap_Man_t *p)
Definition amapGraph.c:67
Amap_Obj_t * Amap_ManCreateAnd(Amap_Man_t *p, Amap_Obj_t *pFan0, Amap_Obj_t *pFan1)
Definition amapGraph.c:137
Amap_Obj_t * Amap_ManGetLast_rec(Amap_Man_t *p, Amap_Obj_t *pObj)
Definition amapGraph.c:305
void * pData
Definition aig.h:87
void * pData
Definition amapInt.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Amap_ManCreateAnd()

Amap_Obj_t * Amap_ManCreateAnd ( Amap_Man_t * p,
Amap_Obj_t * pFan0,
Amap_Obj_t * pFan1 )
extern

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

Synopsis [Create the new node assuming it does not exist.]

Description []

SideEffects []

SeeAlso []

Definition at line 137 of file amapGraph.c.

138{
139 Amap_Obj_t * pObj;
140 pObj = Amap_ManSetupObj( p );
141 pObj->Type = AMAP_OBJ_AND;
142 pObj->Fan[0] = Amap_ObjToLit(pFan0); Amap_Regular(pFan0)->nRefs++;
143 pObj->Fan[1] = Amap_ObjToLit(pFan1); Amap_Regular(pFan1)->nRefs++;
144 assert( Abc_Lit2Var(pObj->Fan[0]) != Abc_Lit2Var(pObj->Fan[1]) );
145 pObj->fPhase = Amap_ObjPhaseReal(pFan0) & Amap_ObjPhaseReal(pFan1);
146 pObj->Level = 1 + Abc_MaxInt( Amap_Regular(pFan0)->Level, Amap_Regular(pFan1)->Level );
147 if ( p->nLevelMax < (int)pObj->Level )
148 p->nLevelMax = (int)pObj->Level;
149 assert( p->nLevelMax < 4094 ); // 2^12-2
150 p->nObjs[AMAP_OBJ_AND]++;
151 return pObj;
152}
ABC_NAMESPACE_IMPL_START Amap_Obj_t * Amap_ManSetupObj(Amap_Man_t *p)
DECLARATIONS ///.
Definition amapGraph.c:45
unsigned Type
Definition amapInt.h:201
int Fan[3]
Definition amapInt.h:211
unsigned Level
Definition amapInt.h:207
unsigned fPhase
Definition amapInt.h:204
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Amap_ManCreateChoice()

void Amap_ManCreateChoice ( Amap_Man_t * p,
Amap_Obj_t * pObj )
extern

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

Synopsis [Creates the choice node.]

Description [Should be called after the equivalence class nodes are linked.]

SideEffects []

SeeAlso []

Definition at line 222 of file amapGraph.c.

223{
224 Amap_Obj_t * pTemp;
225 // mark the node as a representative if its class
226// assert( pObj->fRepr == 0 );
227 pObj->fRepr = 1;
228 // update the level of this node (needed for correct required time computation)
229 for ( pTemp = pObj; pTemp; pTemp = Amap_ObjChoice(p, pTemp) )
230 {
231 pObj->Level = Abc_MaxInt( pObj->Level, pTemp->Level );
232// pTemp->nVisits++; pTemp->nVisitsCopy++;
233 }
234 // mark the largest level
235 if ( p->nLevelMax < (int)pObj->Level )
236 p->nLevelMax = (int)pObj->Level;
237 assert( p->nLevelMax < 4094 ); // 2^12-2
238}
unsigned fRepr
Definition amapInt.h:205
Here is the caller graph for this function:

◆ Amap_ManCreateMux()

Amap_Obj_t * Amap_ManCreateMux ( Amap_Man_t * p,
Amap_Obj_t * pFan0,
Amap_Obj_t * pFan1,
Amap_Obj_t * pFanC )
extern

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

Synopsis [Create the new node assuming it does not exist.]

Description []

SideEffects []

SeeAlso []

Definition at line 192 of file amapGraph.c.

193{
194 Amap_Obj_t * pObj;
195 pObj = Amap_ManSetupObj( p );
196 pObj->Type = AMAP_OBJ_MUX;
197 pObj->Fan[0] = Amap_ObjToLit(pFan0); Amap_Regular(pFan0)->nRefs++;
198 pObj->Fan[1] = Amap_ObjToLit(pFan1); Amap_Regular(pFan1)->nRefs++;
199 pObj->Fan[2] = Amap_ObjToLit(pFanC); Amap_Regular(pFanC)->nRefs++;
200 pObj->fPhase = (Amap_ObjPhaseReal(pFan1) & Amap_ObjPhaseReal(pFanC)) |
201 (Amap_ObjPhaseReal(pFan0) & ~Amap_ObjPhaseReal(pFanC));
202 pObj->Level = Abc_MaxInt( Amap_Regular(pFan0)->Level, Amap_Regular(pFan1)->Level );
203 pObj->Level = 2 + Abc_MaxInt( pObj->Level, Amap_Regular(pFanC)->Level );
204 if ( p->nLevelMax < (int)pObj->Level )
205 p->nLevelMax = (int)pObj->Level;
206 assert( p->nLevelMax < 4094 ); // 2^12-2
207 p->nObjs[AMAP_OBJ_MUX]++;
208 return pObj;
209}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Amap_ManCreatePi()

Amap_Obj_t * Amap_ManCreatePi ( Amap_Man_t * p)
extern

FUNCTION DECLARATIONS ///.

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

Synopsis [Creates primary input.]

Description []

SideEffects []

SeeAlso []

Definition at line 88 of file amapGraph.c.

89{
90 Amap_Obj_t * pObj;
91 pObj = Amap_ManSetupObj( p );
92 pObj->Type = AMAP_OBJ_PI;
93 pObj->IdPio = Vec_PtrSize( p->vPis );
94 Vec_PtrPush( p->vPis, pObj );
95 p->nObjs[AMAP_OBJ_PI]++;
96 return pObj;
97}
unsigned IdPio
Definition amapInt.h:203
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Amap_ManCreatePo()

Amap_Obj_t * Amap_ManCreatePo ( Amap_Man_t * p,
Amap_Obj_t * pFan0 )
extern

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

Synopsis [Creates primary output with the given driver.]

Description []

SideEffects []

SeeAlso []

Definition at line 110 of file amapGraph.c.

111{
112 Amap_Obj_t * pObj;
113 pObj = Amap_ManSetupObj( p );
114 pObj->IdPio = Vec_PtrSize( p->vPos );
115 Vec_PtrPush( p->vPos, pObj );
116 pObj->Type = AMAP_OBJ_PO;
117 pObj->Fan[0] = Amap_ObjToLit(pFan0); Amap_Regular(pFan0)->nRefs++;
118 pObj->Level = Amap_Regular(pFan0)->Level;
119 if ( p->nLevelMax < (int)pObj->Level )
120 p->nLevelMax = (int)pObj->Level;
121 assert( p->nLevelMax < 4094 ); // 2^12-2
122 p->nObjs[AMAP_OBJ_PO]++;
123 return pObj;
124}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Amap_ManCreateXor()

Amap_Obj_t * Amap_ManCreateXor ( Amap_Man_t * p,
Amap_Obj_t * pFan0,
Amap_Obj_t * pFan1 )
extern

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

Synopsis [Create the new node assuming it does not exist.]

Description []

SideEffects []

SeeAlso []

Definition at line 165 of file amapGraph.c.

166{
167 Amap_Obj_t * pObj;
168 pObj = Amap_ManSetupObj( p );
169 pObj->Type = AMAP_OBJ_XOR;
170 pObj->Fan[0] = Amap_ObjToLit(pFan0); Amap_Regular(pFan0)->nRefs++;
171 pObj->Fan[1] = Amap_ObjToLit(pFan1); Amap_Regular(pFan1)->nRefs++;
172 pObj->fPhase = Amap_ObjPhaseReal(pFan0) ^ Amap_ObjPhaseReal(pFan1);
173 pObj->Level = 2 + Abc_MaxInt( Amap_Regular(pFan0)->Level, Amap_Regular(pFan1)->Level );
174 if ( p->nLevelMax < (int)pObj->Level )
175 p->nLevelMax = (int)pObj->Level;
176 assert( p->nLevelMax < 4094 ); // 2^12-2
177 p->nObjs[AMAP_OBJ_XOR]++;
178 return pObj;
179}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Amap_ManMap()

void Amap_ManMap ( Amap_Man_t * p)
extern

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

Synopsis [Performs mapping.]

Description []

SideEffects []

SeeAlso []

Definition at line 657 of file amapMatch.c.

658{
659 int i;
660 Amap_ManMerge( p );
661 for ( i = 0; i < p->pPars->nIterFlow; i++ )
662 Amap_ManMatch( p, 1, i>0 );
663 for ( i = 0; i < p->pPars->nIterArea; i++ )
664 Amap_ManMatch( p, 0, p->pPars->nIterFlow>0||i>0 );
665/*
666 for ( i = 0; i < p->pPars->nIterFlow; i++ )
667 Amap_ManMatch( p, 1, 1 );
668 for ( i = 0; i < p->pPars->nIterArea; i++ )
669 Amap_ManMatch( p, 0, 1 );
670*/
672}
void Amap_ManMerge(Amap_Man_t *p)
Definition amapMerge.c:514
void Amap_ManMatch(Amap_Man_t *p, int fFlow, int fRefs)
Definition amapMatch.c:618
void Amap_ManCleanData(Amap_Man_t *p)
Definition amapMatch.c:123
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Amap_ManMerge()

void Amap_ManMerge ( Amap_Man_t * p)
extern

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

Synopsis [Derives cuts for all nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 514 of file amapMerge.c.

515{
516 Amap_Obj_t * pObj;
517 int i;
518 abctime clk = Abc_Clock();
519 p->pCutsPi = Amap_ManSetupPis( p );
520 Amap_ManForEachNode( p, pObj, i )
521 Amap_ManMergeNodeCuts( p, pObj );
522 if ( p->pPars->fVerbose )
523 {
524 printf( "AIG object is %d bytes. ", (int)sizeof(Amap_Obj_t) );
525 printf( "Internal AIG = %5.2f MB. Cuts = %5.2f MB. CutsMax = %d.\n",
526 1.0*Amap_ManObjNum(p)*sizeof(Amap_Obj_t)/(1<<20), 1.0*p->nBytesUsed/(1<<20), p->pPars->nCutsMax );
527 printf( "Node =%6d. Try =%9d. Try3 =%10d. Used =%7d. R =%6.2f. ",
528 Amap_ManNodeNum(p), p->nCutsTried, p->nCutsTried3, p->nCutsUsed,
529 1.0*p->nCutsUsed/Amap_ManNodeNum(p) );
530ABC_PRT( "Time ", Abc_Clock() - clk );
531 }
532}
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_PRT(a, t)
Definition abc_global.h:255
#define Amap_ManForEachNode(p, pObj, i)
Definition amapInt.h:290
ABC_NAMESPACE_IMPL_START Amap_Cut_t * Amap_ManSetupPis(Amap_Man_t *p)
DECLARATIONS ///.
Definition amapMerge.c:45
void Amap_ManMergeNodeCuts(Amap_Man_t *p, Amap_Obj_t *pNode)
Definition amapMerge.c:443
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Amap_ManProduceMapped()

Vec_Ptr_t * Amap_ManProduceMapped ( Amap_Man_t * p)
extern

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

Synopsis [Returns mapped network as an array of structures.]

Description []

SideEffects []

SeeAlso []

Definition at line 71 of file amapOutput.c.

72{
73 Vec_Ptr_t * vNodes;
74 Aig_MmFlex_t * pMem;
75 Amap_Obj_t * pObj, * pFanin;
76 Amap_Gat_t * pGate;
77 Amap_Out_t * pRes;
78 int i, k, iFanin, fCompl;
79 float TotalArea = 0.0;
80 pMem = Aig_MmFlexStart();
81 // create mapping object for each node used in the mapping
82 vNodes = Vec_PtrAlloc( 10 );
83 Amap_ManForEachObj( p, pObj, i )
84 {
85 if ( Amap_ObjIsPi(pObj) )
86 {
87 assert( pObj->fPolar == 0 );
88 pRes = Amap_OutputStructAlloc( pMem, NULL );
89 pRes->Type = -1;
90 pRes->nFans = 0;
91 // save this structure
92 pObj->iData = Vec_PtrSize( vNodes );
93 Vec_PtrPush( vNodes, pRes );
94 // create invertor if needed
95 if ( pObj->nFouts[1] ) // this PI is used in the neg polarity
96 {
97 pRes = Amap_OutputStructAlloc( pMem, p->pLib->pGateInv );
98 pRes->pFans[0] = pObj->iData;
99 // save this structure
100 Vec_PtrPush( vNodes, pRes );
101 TotalArea += p->pLib->pGateInv->dArea;
102 }
103 continue;
104 }
105 if ( Amap_ObjIsNode(pObj) )
106 {
107 // skip the node that is not used in the mapping
108 if ( Amap_ObjRefsTotal(pObj) == 0 )
109 continue;
110 // get the gate
111 pGate = Amap_LibGate( p->pLib, pObj->Best.pSet->iGate );
112 assert( pGate->nPins == pObj->Best.pCut->nFans );
113 // allocate structure
114 pRes = Amap_OutputStructAlloc( pMem, pGate );
115 Amap_MatchForEachFaninCompl( p, &pObj->Best, pFanin, fCompl, k )
116 {
117 assert( Amap_ObjRefsTotal(pFanin) );
118 if ( (int)pFanin->fPolar == fCompl )
119 pRes->pFans[k] = pFanin->iData;
120 else
121 pRes->pFans[k] = pFanin->iData + 1;
122 }
123 // save this structure
124 pObj->iData = Vec_PtrSize( vNodes );
125 Vec_PtrPush( vNodes, pRes );
126 TotalArea += pGate->dArea;
127 // create invertor if needed
128 if ( pObj->nFouts[!pObj->fPolar] ) // needed in the opposite polarity
129 {
130 pRes = Amap_OutputStructAlloc( pMem, p->pLib->pGateInv );
131 pRes->pFans[0] = pObj->iData;
132 // save this structure
133 Vec_PtrPush( vNodes, pRes );
134 TotalArea += p->pLib->pGateInv->dArea;
135 }
136 continue;
137 }
138 if ( Amap_ObjIsPo(pObj) )
139 {
140 assert( pObj->fPolar == 0 );
141 pFanin = Amap_ObjFanin0(p, pObj);
142 assert( Amap_ObjRefsTotal(pFanin) );
143 if ( Amap_ObjIsConst1(pFanin) )
144 { // create constant node
145 if ( Amap_ObjFaninC0(pObj) )
146 {
147 pRes = Amap_OutputStructAlloc( pMem, p->pLib->pGate0 );
148 TotalArea += p->pLib->pGate0->dArea;
149 }
150 else
151 {
152 pRes = Amap_OutputStructAlloc( pMem, p->pLib->pGate1 );
153 TotalArea += p->pLib->pGate1->dArea;
154 }
155 // save this structure
156 iFanin = Vec_PtrSize( vNodes );
157 Vec_PtrPush( vNodes, pRes );
158 }
159 else
160 {
161 if ( (int)pFanin->fPolar == Amap_ObjFaninC0(pObj) )
162 iFanin = pFanin->iData;
163 else
164 iFanin = pFanin->iData + 1;
165 }
166 // create PO node
167 pRes = Amap_OutputStructAlloc( pMem, NULL );
168 pRes->Type = 1;
169 pRes->pFans[0] = iFanin;
170 // save this structure
171 Vec_PtrPush( vNodes, pRes );
172 }
173 }
174 // return memory manager in the last entry of the array
175 Vec_PtrPush( vNodes, pMem );
176 return vNodes;
177}
struct Aig_MmFlex_t_ Aig_MmFlex_t
Definition aig.h:53
#define Amap_MatchForEachFaninCompl(p, pM, pFanin, fCompl, i)
Definition amapInt.h:310
#define Amap_ManForEachObj(p, pObj, i)
Definition amapInt.h:287
Amap_Out_t * Amap_OutputStructAlloc(Aig_MmFlex_t *pMem, Amap_Gat_t *pGate)
FUNCTION DEFINITIONS ///.
Definition amapOutput.c:48
struct Amap_Out_t_ Amap_Out_t
Definition amap.h:58
unsigned nFans
Definition amapInt.h:188
double dArea
Definition amapInt.h:157
Amap_Set_t * pSet
Definition amapInt.h:194
Amap_Cut_t * pCut
Definition amapInt.h:193
unsigned fPolar
Definition amapInt.h:206
int nFouts[2]
Definition amapInt.h:218
Amap_Mat_t Best
Definition amapInt.h:219
int pFans[0]
Definition amap.h:64
short Type
Definition amap.h:62
short nFans
Definition amap.h:63
unsigned iGate
Definition amapInt.h:168
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Amap_ManStart()

Amap_Man_t * Amap_ManStart ( int nNodes)
extern

DECLARATIONS ///.

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

FileName [amapMan.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Technology mapper for standard cells.]

Synopsis [Mapping manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
amapMan.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

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

Synopsis [Starts the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file amapMan.c.

46{
47 Amap_Man_t * p;
48 // start the manager
49 p = ABC_ALLOC( Amap_Man_t, 1 );
50 memset( p, 0, sizeof(Amap_Man_t) );
51 p->fEpsilonInternal = (float)0.01;
52 // allocate arrays for nodes
53 p->vPis = Vec_PtrAlloc( 100 );
54 p->vPos = Vec_PtrAlloc( 100 );
55 p->vObjs = Vec_PtrAlloc( 100 );
56 p->vTemp = Vec_IntAlloc( 100 );
57 p->vCuts0 = Vec_PtrAlloc( 100 );
58 p->vCuts1 = Vec_PtrAlloc( 100 );
59 p->vCuts2 = Vec_PtrAlloc( 100 );
60 p->vTempP = Vec_PtrAlloc( 100 );
61 // prepare the memory manager
62 p->pMemObj = Aig_MmFixedStart( sizeof(Amap_Obj_t), nNodes );
63 p->pMemCuts = Aig_MmFlexStart();
64 p->pMemCutBest = Aig_MmFlexStart();
65 p->pMemTemp = Aig_MmFlexStart();
66 return p;
67}
Aig_MmFixed_t * Aig_MmFixedStart(int nEntrySize, int nEntriesMax)
FUNCTION DEFINITIONS ///.
Definition aigMem.c:96
struct Amap_Man_t_ Amap_Man_t
Definition amapInt.h:70
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Amap_ManStop()

void Amap_ManStop ( Amap_Man_t * p)
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 80 of file amapMan.c.

81{
82 Vec_PtrFree( p->vPis );
83 Vec_PtrFree( p->vPos );
84 Vec_PtrFree( p->vObjs );
85 Vec_PtrFree( p->vCuts0 );
86 Vec_PtrFree( p->vCuts1 );
87 Vec_PtrFree( p->vCuts2 );
88 Vec_PtrFree( p->vTempP );
89 Vec_IntFree( p->vTemp );
90 Aig_MmFixedStop( p->pMemObj, 0 );
91 Aig_MmFlexStop( p->pMemCuts, 0 );
92 Aig_MmFlexStop( p->pMemCutBest, 0 );
93 Aig_MmFlexStop( p->pMemTemp, 0 );
94 ABC_FREE( p->pMatsTemp );
95 ABC_FREE( p->ppCutsTemp );
96 ABC_FREE( p->pCutsPi );
97 ABC_FREE( p );
98}
void Aig_MmFlexStop(Aig_MmFlex_t *p, int fVerbose)
Definition aigMem.c:337
void Aig_MmFixedStop(Aig_MmFixed_t *p, int fVerbose)
Definition aigMem.c:132
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Kit_DsdPrintFromTruth()

void Kit_DsdPrintFromTruth ( unsigned * pTruth,
int nVars )
extern

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

Synopsis [Print the DSD formula.]

Description []

SideEffects []

SeeAlso []

Definition at line 491 of file kitDsd.c.

492{
493 Kit_DsdNtk_t * pTemp, * pTemp2;
494// pTemp = Kit_DsdDecomposeMux( pTruth, nVars, 5 );
495 pTemp = Kit_DsdDecomposeMux( pTruth, nVars, 8 );
496// Kit_DsdPrintExpanded( pTemp );
497 pTemp2 = Kit_DsdExpand( pTemp );
498 Kit_DsdPrint( stdout, pTemp2 );
499 Kit_DsdVerify( pTemp2, pTruth, nVars );
500 Kit_DsdNtkFree( pTemp2 );
501 Kit_DsdNtkFree( pTemp );
502}
void Kit_DsdVerify(Kit_DsdNtk_t *pNtk, unsigned *pTruth, int nVars)
Definition kitDsd.c:2493
void Kit_DsdPrint(FILE *pFile, Kit_DsdNtk_t *pNtk)
Definition kitDsd.c:375
void Kit_DsdNtkFree(Kit_DsdNtk_t *pNtk)
Definition kitDsd.c:164
Kit_DsdNtk_t * Kit_DsdDecomposeMux(unsigned *pTruth, int nVars, int nDecMux)
Definition kitDsd.c:2351
Kit_DsdNtk_t * Kit_DsdExpand(Kit_DsdNtk_t *p)
Definition kitDsd.c:1452
struct Kit_DsdNtk_t_ Kit_DsdNtk_t
Definition kit.h:124