ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
mapperFanout.c
Go to the documentation of this file.
1
18
19#include "mapperInt.h"
20
22
23
24#ifdef MAP_ALLOCATE_FANOUT
25
29
33
45void Map_NodeAddFaninFanout( Map_Node_t * pFanin, Map_Node_t * pFanout )
46{
47 Map_Node_t * pPivot;
48
49 // pFanins is a fanin of pFanout
50 assert( !Map_IsComplement(pFanin) );
51 assert( !Map_IsComplement(pFanout) );
52 assert( Map_Regular(pFanout->p1) == pFanin || Map_Regular(pFanout->p2) == pFanin );
53
54 pPivot = pFanin->pFanPivot;
55 if ( pPivot == NULL )
56 {
57 pFanin->pFanPivot = pFanout;
58 return;
59 }
60
61 if ( Map_Regular(pPivot->p1) == pFanin )
62 {
63 if ( Map_Regular(pFanout->p1) == pFanin )
64 {
65 pFanout->pFanFanin1 = pPivot->pFanFanin1;
66 pPivot->pFanFanin1 = pFanout;
67 }
68 else // if ( Map_Regular(pFanout->p2) == pFanin )
69 {
70 pFanout->pFanFanin2 = pPivot->pFanFanin1;
71 pPivot->pFanFanin1 = pFanout;
72 }
73 }
74 else // if ( Map_Regular(pPivot->p2) == pFanin )
75 {
76 assert( Map_Regular(pPivot->p2) == pFanin );
77 if ( Map_Regular(pFanout->p1) == pFanin )
78 {
79 pFanout->pFanFanin1 = pPivot->pFanFanin2;
80 pPivot->pFanFanin2 = pFanout;
81 }
82 else // if ( Map_Regular(pFanout->p2) == pFanin )
83 {
84 pFanout->pFanFanin2 = pPivot->pFanFanin2;
85 pPivot->pFanFanin2 = pFanout;
86 }
87 }
88}
89
101void Map_NodeRemoveFaninFanout( Map_Node_t * pFanin, Map_Node_t * pFanoutToRemove )
102{
103 Map_Node_t * pFanout, * pFanout2, ** ppFanList;
104 // start the linked list of fanouts
105 ppFanList = &pFanin->pFanPivot;
106 // go through the fanouts
107 Map_NodeForEachFanoutSafe( pFanin, pFanout, pFanout2 )
108 {
109 // skip the fanout-to-remove
110 if ( pFanout == pFanoutToRemove )
111 continue;
112 // add useful fanouts to the list
113 *ppFanList = pFanout;
114 ppFanList = Map_NodeReadNextFanoutPlace( pFanin, pFanout );
115 }
116 *ppFanList = NULL;
117}
118
130int Map_NodeGetFanoutNum( Map_Node_t * pNode )
131{
132 Map_Node_t * pFanout;
133 int Counter = 0;
134 Map_NodeForEachFanout( pNode, pFanout )
135 Counter++;
136 return Counter;
137}
138
142
143#endif
144
146
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
int Map_NodeGetFanoutNum(Map_Node_t *pNode)
void Map_NodeRemoveFaninFanout(Map_Node_t *pFanin, Map_Node_t *pFanoutToRemove)
#define Map_NodeForEachFanout(pNode, pFanout)
Definition mapperInt.h:340
void Map_NodeAddFaninFanout(Map_Node_t *pFanin, Map_Node_t *pFanout)
#define Map_NodeForEachFanoutSafe(pNode, pFanout, pFanout2)
Definition mapperInt.h:345
#define Map_NodeReadNextFanoutPlace(pNode, pFanout)
Definition mapperInt.h:335
#define Map_Regular(p)
Definition mapper.h:68
#define Map_IsComplement(p)
GLOBAL VARIABLES ///.
Definition mapper.h:67
struct Map_NodeStruct_t_ Map_Node_t
Definition mapper.h:41
Map_Node_t * p2
Definition mapperInt.h:226
Map_Node_t * p1
Definition mapperInt.h:225
#define assert(ex)
Definition util_old.h:213