abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cutApi.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [cutNode.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [K-feasible cut computation package.]
8 
9  Synopsis [Procedures to compute cuts for a node.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: cutNode.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "cutInt.h"
22 
24 
25 
26 ////////////////////////////////////////////////////////////////////////
27 /// DECLARATIONS ///
28 ////////////////////////////////////////////////////////////////////////
29 
30 ////////////////////////////////////////////////////////////////////////
31 /// FUNCTION DEFINITIONS ///
32 ////////////////////////////////////////////////////////////////////////
33 
34 /**Function*************************************************************
35 
36  Synopsis [Returns the pointer to the linked list of cuts.]
37 
38  Description []
39 
40  SideEffects []
41 
42  SeeAlso []
43 
44 ***********************************************************************/
46 {
47  if ( Node >= p->vCutsNew->nSize )
48  return NULL;
49  return (Cut_Cut_t *)Vec_PtrEntry( p->vCutsNew, Node );
50 }
51 
52 /**Function*************************************************************
53 
54  Synopsis [Returns the pointer to the linked list of cuts.]
55 
56  Description []
57 
58  SideEffects []
59 
60  SeeAlso []
61 
62 ***********************************************************************/
64 {
65  assert( Node < p->vCutsOld->nSize );
66  return (Cut_Cut_t *)Vec_PtrEntry( p->vCutsOld, Node );
67 }
68 
69 /**Function*************************************************************
70 
71  Synopsis [Returns the pointer to the linked list of cuts.]
72 
73  Description []
74 
75  SideEffects []
76 
77  SeeAlso []
78 
79 ***********************************************************************/
81 {
82  assert( Node < p->vCutsTemp->nSize );
83  return (Cut_Cut_t *)Vec_PtrEntry( p->vCutsTemp, Node );
84 }
85 
86 /**Function*************************************************************
87 
88  Synopsis [Returns the pointer to the linked list of cuts.]
89 
90  Description []
91 
92  SideEffects []
93 
94  SeeAlso []
95 
96 ***********************************************************************/
97 void Cut_NodeWriteCutsNew( Cut_Man_t * p, int Node, Cut_Cut_t * pList )
98 {
99  Vec_PtrWriteEntry( p->vCutsNew, Node, pList );
100 }
101 
102 /**Function*************************************************************
103 
104  Synopsis [Returns the pointer to the linked list of cuts.]
105 
106  Description []
107 
108  SideEffects []
109 
110  SeeAlso []
111 
112 ***********************************************************************/
113 void Cut_NodeWriteCutsOld( Cut_Man_t * p, int Node, Cut_Cut_t * pList )
114 {
115  Vec_PtrWriteEntry( p->vCutsOld, Node, pList );
116 }
117 
118 /**Function*************************************************************
119 
120  Synopsis [Returns the pointer to the linked list of cuts.]
121 
122  Description []
123 
124  SideEffects []
125 
126  SeeAlso []
127 
128 ***********************************************************************/
129 void Cut_NodeWriteCutsTemp( Cut_Man_t * p, int Node, Cut_Cut_t * pList )
130 {
131  Vec_PtrWriteEntry( p->vCutsTemp, Node, pList );
132 }
133 
134 /**Function*************************************************************
135 
136  Synopsis [Sets the trivial cut for the node.]
137 
138  Description []
139 
140  SideEffects []
141 
142  SeeAlso []
143 
144 ***********************************************************************/
145 void Cut_NodeSetTriv( Cut_Man_t * p, int Node )
146 {
147  assert( Cut_NodeReadCutsNew(p, Node) == NULL );
148  Cut_NodeWriteCutsNew( p, Node, Cut_CutCreateTriv(p, Node) );
149 }
150 
151 /**Function*************************************************************
152 
153  Synopsis [Consider dropping cuts if they are useless by now.]
154 
155  Description []
156 
157  SideEffects []
158 
159  SeeAlso []
160 
161 ***********************************************************************/
163 {
164  int nFanouts;
165  assert( p->vFanCounts );
166  nFanouts = Vec_IntEntry( p->vFanCounts, Node );
167  assert( nFanouts > 0 );
168  if ( --nFanouts == 0 )
169  Cut_NodeFreeCuts( p, Node );
170  Vec_IntWriteEntry( p->vFanCounts, Node, nFanouts );
171 }
172 
173 /**Function*************************************************************
174 
175  Synopsis [Deallocates the cuts at the node.]
176 
177  Description []
178 
179  SideEffects []
180 
181  SeeAlso []
182 
183 ***********************************************************************/
184 void Cut_NodeFreeCuts( Cut_Man_t * p, int Node )
185 {
186  Cut_Cut_t * pList, * pCut, * pCut2;
187  pList = Cut_NodeReadCutsNew( p, Node );
188  if ( pList == NULL )
189  return;
190  Cut_ListForEachCutSafe( pList, pCut, pCut2 )
191  Cut_CutRecycle( p, pCut );
192  Cut_NodeWriteCutsNew( p, Node, NULL );
193 }
194 
195 
196 ////////////////////////////////////////////////////////////////////////
197 /// END OF FILE ///
198 ////////////////////////////////////////////////////////////////////////
199 
200 
202 
Vec_Int_t * vFanCounts
Definition: cutInt.h:52
void Cut_NodeWriteCutsOld(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:113
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Cut_ListForEachCutSafe(pList, pCut, pCut2)
Definition: cutInt.h:112
Cut_Cut_t * Cut_NodeReadCutsTemp(Cut_Man_t *p, int Node)
Definition: cutApi.c:80
void Cut_NodeWriteCutsNew(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:97
void Cut_NodeFreeCuts(Cut_Man_t *p, int Node)
Definition: cutApi.c:184
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
Vec_Ptr_t * vCutsTemp
Definition: cutInt.h:57
Vec_Ptr_t * vCutsOld
Definition: cutInt.h:56
Cut_Cut_t * Cut_CutCreateTriv(Cut_Man_t *p, int Node)
Definition: cutCut.c:238
Cut_Cut_t * Cut_NodeReadCutsOld(Cut_Man_t *p, int Node)
Definition: cutApi.c:63
void Cut_CutRecycle(Cut_Man_t *p, Cut_Cut_t *pCut)
Definition: cutCut.c:72
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
void Cut_NodeTryDroppingCuts(Cut_Man_t *p, int Node)
Definition: cutApi.c:162
#define assert(ex)
Definition: util_old.h:213
void Cut_NodeSetTriv(Cut_Man_t *p, int Node)
Definition: cutApi.c:145
ABC_NAMESPACE_IMPL_START Cut_Cut_t * Cut_NodeReadCutsNew(Cut_Man_t *p, int Node)
DECLARATIONS ///.
Definition: cutApi.c:45
Vec_Ptr_t * vCutsNew
Definition: cutInt.h:55
void Cut_NodeWriteCutsTemp(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:129