ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
darInt.h
Go to the documentation of this file.
1
20
21#ifndef ABC__aig__dar__darInt_h
22#define ABC__aig__dar__darInt_h
23
24
28
29#include <stdio.h>
30#include <stdlib.h>
31#include <string.h>
32#include <assert.h>
33
34#include "misc/vec/vec.h"
35#include "aig/aig/aig.h"
36#include "dar.h"
37
41
42
43
45
46
50
51typedef struct Dar_Man_t_ Dar_Man_t;
52typedef struct Dar_Cut_t_ Dar_Cut_t;
53
54// the AIG 4-cut
55struct Dar_Cut_t_ // 6 words
56{
57 unsigned uSign; // cut signature
58 unsigned uTruth : 16; // the truth table of the cut function
59 unsigned Value : 11; // the value of the cut
60 unsigned fBest : 1; // marks the best cut
61 unsigned fUsed : 1; // marks the cut currently in use
62 unsigned nLeaves : 3; // the number of leaves
63 int pLeaves[4]; // the array of leaves
64};
65
66// the AIG manager
68{
69 // input data
70 Dar_RwrPar_t * pPars; // rewriting parameters
71 Aig_Man_t * pAig; // AIG manager
72 // various data members
73 Aig_MmFixed_t * pMemCuts; // memory manager for cuts
74 void * pManCnf; // CNF managers
75 Vec_Ptr_t * vCutNodes; // the nodes with cuts allocated
76 // current rewriting step
77 Vec_Ptr_t * vLeavesBest; // the best set of leaves
78 int OutBest; // the best output (in the library)
79 int OutNumBest; // the best number of the output
80 int GainBest; // the best gain
81 int LevelBest; // the level of node with the best gain
82 int ClassBest; // the equivalence class of the best replacement
83 // function statistics
84 int nTotalSubgs; // the total number of subgraphs tried
85 int ClassTimes[222];// the runtimes for each class
86 int ClassGains[222];// the gains for each class
87 int ClassSubgs[222];// the graphs for each class
88 int nCutMemUsed; // memory used for cuts
89 // rewriting statistics
90 int nNodesInit; // the original number of nodes
91 int nNodesTried; // the number of nodes attempted
92 int nCutsAll; // all cut pairs
93 int nCutsTried; // computed cuts
94 int nCutsUsed; // used cuts
95 int nCutsBad; // bad cuts due to absent fanin
96 int nCutsGood; // good cuts
97 int nCutsSkipped; // skipped bad cuts
98 // timing statistics
105};
106
107static inline Dar_Cut_t * Dar_ObjCuts( Aig_Obj_t * pObj ) { return (Dar_Cut_t *)pObj->pData; }
108static inline void Dar_ObjSetCuts( Aig_Obj_t * pObj, Dar_Cut_t * pCuts ) { assert( !Aig_ObjIsNone(pObj) ); pObj->pData = pCuts; }
109
113
117
118// iterator over all cuts of the node
119#define Dar_ObjForEachCutAll( pObj, pCut, i ) \
120 for ( (pCut) = Dar_ObjCuts(pObj), i = 0; i < (int)(pObj)->nCuts; i++, pCut++ )
121#define Dar_ObjForEachCut( pObj, pCut, i ) \
122 for ( (pCut) = Dar_ObjCuts(pObj), i = 0; i < (int)(pObj)->nCuts; i++, pCut++ ) if ( (pCut)->fUsed==0 ) {} else
123// iterator over leaves of the cut
124#define Dar_CutForEachLeaf( p, pCut, pLeaf, i ) \
125 for ( i = 0; (i < (int)(pCut)->nLeaves) && (((pLeaf) = Aig_ManObj(p, (pCut)->pLeaves[i])), 1); i++ )
126
130
131/*=== darBalance.c ========================================================*/
132/*=== darCore.c ===========================================================*/
133/*=== darCut.c ============================================================*/
134extern void Dar_ManCutsRestart( Dar_Man_t * p, Aig_Obj_t * pRoot );
135extern void Dar_ManCutsFree( Dar_Man_t * p );
136extern Dar_Cut_t * Dar_ObjPrepareCuts( Dar_Man_t * p, Aig_Obj_t * pObj );
138extern Dar_Cut_t * Dar_ObjComputeCuts( Dar_Man_t * p, Aig_Obj_t * pObj, int fSkipTtMin );
139extern void Dar_ObjCutPrint( Aig_Man_t * p, Aig_Obj_t * pObj );
140/*=== darData.c ===========================================================*/
141extern Vec_Int_t * Dar_LibReadNodes();
142extern Vec_Int_t * Dar_LibReadOuts();
143extern Vec_Int_t * Dar_LibReadPrios();
144/*=== darLib.c ============================================================*/
145extern void Dar_LibStart();
146extern void Dar_LibStop();
147extern void Dar_LibReturnCanonicals( unsigned * pCanons );
148extern void Dar_LibEval( Dar_Man_t * p, Aig_Obj_t * pRoot, Dar_Cut_t * pCut, int Required, int * pnMffcSize );
150/*=== darMan.c ============================================================*/
151extern Dar_Man_t * Dar_ManStart( Aig_Man_t * pAig, Dar_RwrPar_t * pPars );
152extern void Dar_ManStop( Dar_Man_t * p );
153extern void Dar_ManPrintStats( Dar_Man_t * p );
154/*=== darPrec.c ============================================================*/
155extern char ** Dar_Permutations( int n );
156extern void Dar_Truth4VarNPN( unsigned short ** puCanons, char ** puPhases, char ** puPerms, unsigned char ** puMap );
157
158
159
161
162
163
164#endif
165
169
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_NAMESPACE_HEADER_END
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
struct Aig_MmFixed_t_ Aig_MmFixed_t
Definition aig.h:52
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
typedefABC_NAMESPACE_HEADER_START struct Dar_Man_t_ Dar_Man_t
INCLUDES ///.
Definition darInt.h:51
void Dar_ManStop(Dar_Man_t *p)
Definition darMan.c:69
Dar_Man_t * Dar_ManStart(Aig_Man_t *pAig, Dar_RwrPar_t *pPars)
DECLARATIONS ///.
Definition darMan.c:44
void Dar_LibEval(Dar_Man_t *p, Aig_Obj_t *pRoot, Dar_Cut_t *pCut, int Required, int *pnMffcSize)
Definition darLib.c:920
void Dar_Truth4VarNPN(unsigned short **puCanons, char **puPhases, char **puPerms, unsigned char **puMap)
Definition darPrec.c:293
Dar_Cut_t * Dar_ObjComputeCuts(Dar_Man_t *p, Aig_Obj_t *pObj, int fSkipTtMin)
Definition darCut.c:738
Dar_Cut_t * Dar_ObjPrepareCuts(Dar_Man_t *p, Aig_Obj_t *pObj)
Definition darCut.c:668
Vec_Int_t * Dar_LibReadPrios()
Definition darData.c:11136
void Dar_LibStart()
MACRO DEFINITIONS ///.
Definition darLib.c:593
void Dar_LibStop()
Definition darLib.c:615
void Dar_ManCutsRestart(Dar_Man_t *p, Aig_Obj_t *pRoot)
FUNCTION DECLARATIONS ///.
Definition darCut.c:714
struct Dar_Cut_t_ Dar_Cut_t
Definition darInt.h:52
void Dar_LibReturnCanonicals(unsigned *pCanons)
Definition darLib.c:211
void Dar_ManPrintStats(Dar_Man_t *p)
Definition darMan.c:93
Dar_Cut_t * Dar_ObjComputeCuts_rec(Dar_Man_t *p, Aig_Obj_t *pObj)
Definition darCut.c:818
Vec_Int_t * Dar_LibReadNodes()
Definition darData.c:11094
Aig_Obj_t * Dar_LibBuildBest(Dar_Man_t *p)
Definition darLib.c:1031
void Dar_ObjCutPrint(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition darCut.c:65
char ** Dar_Permutations(int n)
Definition darPrec.c:144
void Dar_ManCutsFree(Dar_Man_t *p)
Definition darCut.c:648
Vec_Int_t * Dar_LibReadOuts()
Definition darData.c:11115
typedefABC_NAMESPACE_HEADER_START struct Dar_RwrPar_t_ Dar_RwrPar_t
INCLUDES ///.
Definition dar.h:42
Cube * p
Definition exorList.c:222
void * pData
Definition aig.h:87
unsigned fBest
Definition darInt.h:60
unsigned fUsed
Definition darInt.h:61
unsigned Value
Definition darInt.h:59
unsigned uSign
Definition darInt.h:57
unsigned nLeaves
Definition darInt.h:62
int pLeaves[4]
Definition darInt.h:63
unsigned uTruth
Definition darInt.h:58
Vec_Ptr_t * vLeavesBest
Definition darInt.h:77
int OutBest
Definition darInt.h:78
abctime timeOther
Definition darInt.h:101
int LevelBest
Definition darInt.h:81
int nTotalSubgs
Definition darInt.h:84
Vec_Ptr_t * vCutNodes
Definition darInt.h:75
abctime timeEval
Definition darInt.h:100
int nCutsSkipped
Definition darInt.h:97
int OutNumBest
Definition darInt.h:79
int ClassGains[222]
Definition darInt.h:86
int nCutsUsed
Definition darInt.h:94
void * pManCnf
Definition darInt.h:74
abctime timeTotal
Definition darInt.h:102
int nCutsTried
Definition darInt.h:93
int nCutsAll
Definition darInt.h:92
Dar_RwrPar_t * pPars
Definition darInt.h:70
int ClassTimes[222]
Definition darInt.h:85
int nCutMemUsed
Definition darInt.h:88
int ClassBest
Definition darInt.h:82
abctime time2
Definition darInt.h:104
int nNodesInit
Definition darInt.h:90
int nCutsGood
Definition darInt.h:96
int GainBest
Definition darInt.h:80
abctime time1
Definition darInt.h:103
int nNodesTried
Definition darInt.h:91
int ClassSubgs[222]
Definition darInt.h:87
abctime timeCuts
Definition darInt.h:99
int nCutsBad
Definition darInt.h:95
Aig_Man_t * pAig
Definition darInt.h:71
Aig_MmFixed_t * pMemCuts
Definition darInt.h:73
#define assert(ex)
Definition util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42