ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
rwt.h
Go to the documentation of this file.
1
20
21#ifndef ABC__aig__rwt__rwt_h
22#define ABC__aig__rwt__rwt_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 "misc/extra/extra.h"
36#include "misc/mem/mem.h"
37
41
42
43
45
46
50
51#define RWT_LIMIT 1048576/4 // ((1 << 20)
52#define RWT_MIN(a,b) (((a) < (b))? (a) : (b))
53#define RWT_MAX(a,b) (((a) > (b))? (a) : (b))
54
55typedef struct Rwt_Man_t_ Rwt_Man_t;
56typedef struct Rwt_Node_t_ Rwt_Node_t;
57
59{
60 // internal lookups
61 int nFuncs; // number of four var functions
62 unsigned short * puCanons; // canonical forms
63 char * pPhases; // canonical phases
64 char * pPerms; // canonical permutations
65 unsigned char * pMap; // mapping of functions into class numbers
66 unsigned short * pMapInv; // mapping of classes into functions
67 char * pPractical; // practical NPN classes
68 char ** pPerms4; // four-var permutations
69 // node space
70 Vec_Ptr_t * vForest; // all the nodes
71 Rwt_Node_t ** pTable; // the hash table of nodes by their canonical form
72 Vec_Vec_t * vClasses; // the nodes of the equivalence classes
73 Mem_Fixed_t * pMmNode; // memory for nodes and cuts
74 // statistical variables
75 int nTravIds; // the counter of traversal IDs
76 int nConsidered; // the number of nodes considered
77 int nAdded; // the number of nodes added to lists
78 int nClasses; // the number of NN classes
79 // the result of resynthesis
80 int fCompl; // indicates if the output of FF should be complemented
81 void * pCut; // the decomposition tree (temporary)
82 void * pGraph; // the decomposition tree (temporary)
83 char * pPerm; // permutation used for the best cut
84 Vec_Ptr_t * vFanins; // the fanins array (temporary)
85 Vec_Ptr_t * vFaninsCur; // the fanins array (temporary)
86 Vec_Int_t * vLevNums; // the array of levels (temporary)
87 Vec_Ptr_t * vNodesTemp; // the nodes in MFFC (temporary)
88 // node statistics
92 int nScores[222];
96 // runtime statistics
105};
106
107struct Rwt_Node_t_ // 24 bytes
108{
109 int Id; // ID
110 int TravId; // traversal ID
111 unsigned uTruth : 16; // truth table
112 unsigned Volume : 8; // volume
113 unsigned Level : 6; // level
114 unsigned fUsed : 1; // mark
115 unsigned fExor : 1; // mark
116 Rwt_Node_t * p0; // first child
117 Rwt_Node_t * p1; // second child
118 Rwt_Node_t * pNext; // next in the table
119};
120
121// manipulation of complemented attributes
122static inline int Rwt_IsComplement( Rwt_Node_t * p ) { return (int)(((ABC_PTRUINT_T)p) & 01); }
123static inline Rwt_Node_t * Rwt_Regular( Rwt_Node_t * p ) { return (Rwt_Node_t *)((ABC_PTRUINT_T)(p) & ~01); }
124static inline Rwt_Node_t * Rwt_Not( Rwt_Node_t * p ) { return (Rwt_Node_t *)((ABC_PTRUINT_T)(p) ^ 01); }
125static inline Rwt_Node_t * Rwt_NotCond( Rwt_Node_t * p, int c ) { return (Rwt_Node_t *)((ABC_PTRUINT_T)(p) ^ (c)); }
126
130
134
135/*=== rwrDec.c ========================================================*/
136extern void Rwt_ManPreprocess( Rwt_Man_t * p );
137/*=== rwrMan.c ========================================================*/
138extern Rwt_Man_t * Rwt_ManStart( int fPrecompute );
139extern void Rwt_ManStop( Rwt_Man_t * p );
140extern void Rwt_ManPrintStats( Rwt_Man_t * p );
141extern void Rwt_ManPrintStatsFile( Rwt_Man_t * p );
142extern void * Rwt_ManReadDecs( Rwt_Man_t * p );
144extern int Rwt_ManReadCompl( Rwt_Man_t * p );
145extern void Rwt_ManAddTimeCuts( Rwt_Man_t * p, abctime Time );
146extern void Rwt_ManAddTimeUpdate( Rwt_Man_t * p, abctime Time );
147extern void Rwt_ManAddTimeTotal( Rwt_Man_t * p, abctime Time );
148/*=== rwrUtil.c ========================================================*/
149extern void Rwt_ManLoadFromArray( Rwt_Man_t * p, int fVerbose );
150extern char * Rwt_ManGetPractical( Rwt_Man_t * p );
151extern Rwt_Node_t * Rwt_ManAddVar( Rwt_Man_t * p, unsigned uTruth, int fPrecompute );
152extern void Rwt_ManIncTravId( Rwt_Man_t * p );
153
154
155
157
158
159
160#endif
161
165
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_NAMESPACE_HEADER_END
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Cube * p
Definition exorList.c:222
typedefABC_NAMESPACE_HEADER_START struct Mem_Fixed_t_ Mem_Fixed_t
DECLARATIONS ///.
Definition mem.h:33
void Rwt_ManLoadFromArray(Rwt_Man_t *p, int fVerbose)
Definition rwtUtil.c:589
struct Rwt_Man_t_ Rwt_Man_t
Definition rwt.h:55
void Rwt_ManPrintStatsFile(Rwt_Man_t *p)
Definition rwtMan.c:230
void Rwt_ManPrintStats(Rwt_Man_t *p)
Definition rwtMan.c:183
Rwt_Node_t * Rwt_ManAddVar(Rwt_Man_t *p, unsigned uTruth, int fPrecompute)
Definition rwtUtil.c:446
struct Rwt_Node_t_ Rwt_Node_t
Definition rwt.h:56
int Rwt_ManReadCompl(Rwt_Man_t *p)
Definition rwtMan.c:285
Vec_Ptr_t * Rwt_ManReadLeaves(Rwt_Man_t *p)
Definition rwtMan.c:269
char * Rwt_ManGetPractical(Rwt_Man_t *p)
Definition rwtUtil.c:640
void Rwt_ManPreprocess(Rwt_Man_t *p)
MACRO DEFINITIONS ///.
Definition rwtDec.c:49
void Rwt_ManAddTimeUpdate(Rwt_Man_t *p, abctime Time)
Definition rwtMan.c:317
void * Rwt_ManReadDecs(Rwt_Man_t *p)
Definition rwtMan.c:253
void Rwt_ManAddTimeCuts(Rwt_Man_t *p, abctime Time)
Definition rwtMan.c:301
void Rwt_ManAddTimeTotal(Rwt_Man_t *p, abctime Time)
Definition rwtMan.c:333
void Rwt_ManStop(Rwt_Man_t *p)
Definition rwtMan.c:149
void Rwt_ManIncTravId(Rwt_Man_t *p)
Definition rwtUtil.c:547
Rwt_Man_t * Rwt_ManStart(int fPrecompute)
Definition rwtMan.c:87
Vec_Ptr_t * vNodesTemp
Definition rwt.h:87
int nNodesConsidered
Definition rwt.h:89
Mem_Fixed_t * pMmNode
Definition rwt.h:73
abctime timeTotal
Definition rwt.h:104
unsigned short * pMapInv
Definition rwt.h:66
abctime timeStart
Definition rwt.h:97
Vec_Vec_t * vClasses
Definition rwt.h:72
int nCutsBad
Definition rwt.h:94
char * pPerms
Definition rwt.h:64
unsigned char * pMap
Definition rwt.h:65
char * pPractical
Definition rwt.h:67
Vec_Ptr_t * vFanins
Definition rwt.h:84
abctime timeEval
Definition rwt.h:101
char ** pPerms4
Definition rwt.h:68
char * pPerm
Definition rwt.h:83
unsigned short * puCanons
Definition rwt.h:62
Vec_Ptr_t * vForest
Definition rwt.h:70
abctime timeRes
Definition rwt.h:100
int nNodesGained
Definition rwt.h:91
abctime timeUpdate
Definition rwt.h:103
Vec_Ptr_t * vFaninsCur
Definition rwt.h:85
int nNodesRewritten
Definition rwt.h:90
abctime timeCut
Definition rwt.h:99
char * pPhases
Definition rwt.h:63
int nConsidered
Definition rwt.h:76
int nAdded
Definition rwt.h:77
int nTravIds
Definition rwt.h:75
int nClasses
Definition rwt.h:78
int nScores[222]
Definition rwt.h:92
int nSubgraphs
Definition rwt.h:95
Vec_Int_t * vLevNums
Definition rwt.h:86
abctime timeTruth
Definition rwt.h:98
void * pCut
Definition rwt.h:81
void * pGraph
Definition rwt.h:82
int nFuncs
Definition rwt.h:61
int nCutsGood
Definition rwt.h:93
int fCompl
Definition rwt.h:80
Rwt_Node_t ** pTable
Definition rwt.h:71
abctime timeMffc
Definition rwt.h:102
unsigned Level
Definition rwt.h:113
unsigned uTruth
Definition rwt.h:111
int TravId
Definition rwt.h:110
unsigned fUsed
Definition rwt.h:114
unsigned Volume
Definition rwt.h:112
unsigned fExor
Definition rwt.h:115
Rwt_Node_t * pNext
Definition rwt.h:118
Rwt_Node_t * p1
Definition rwt.h:117
Rwt_Node_t * p0
Definition rwt.h:116
int Id
Definition rwt.h:109
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition vecVec.h:42