abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cutSeq.c File Reference
#include "cutInt.h"

Go to the source code of this file.

Functions

static
ABC_NAMESPACE_IMPL_START void 
Cut_NodeShiftCutLeaves (Cut_Cut_t *pList, int nLat)
 DECLARATIONS ///. More...
 
void Cut_NodeComputeCutsSeq (Cut_Man_t *p, int Node, int Node0, int Node1, int fCompl0, int fCompl1, int nLat0, int nLat1, int fTriv, int CutSetNum)
 
void Cut_NodeNewMergeWithOld (Cut_Man_t *p, int Node)
 
int Cut_NodeTempTransferToNew (Cut_Man_t *p, int Node, int CutSetNum)
 
void Cut_NodeOldTransferToNew (Cut_Man_t *p, int Node)
 

Function Documentation

void Cut_NodeComputeCutsSeq ( Cut_Man_t p,
int  Node,
int  Node0,
int  Node1,
int  fCompl0,
int  fCompl1,
int  nLat0,
int  nLat1,
int  fTriv,
int  CutSetNum 
)

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

Synopsis [Computes sequential cuts for the node from its fanins.]

Description []

SideEffects []

SeeAlso []

Definition at line 72 of file cutSeq.c.

73 {
74  Cut_List_t Super, * pSuper = &Super;
75  Cut_Cut_t * pListNew;
76  abctime clk;
77 
78  // get the number of cuts at the node
80  if ( p->nNodeCuts >= p->pParams->nKeepMax )
81  return;
82 
83  // count only the first visit
84  if ( p->nNodeCuts == 0 )
85  p->nNodes++;
86 
87  // store the fanin lists
88  p->pStore0[0] = Cut_NodeReadCutsOld( p, Node0 );
89  p->pStore0[1] = Cut_NodeReadCutsNew( p, Node0 );
90  p->pStore1[0] = Cut_NodeReadCutsOld( p, Node1 );
91  p->pStore1[1] = Cut_NodeReadCutsNew( p, Node1 );
92 
93  // duplicate the cut lists if fanin nodes are non-standard
94  if ( Node == Node0 || Node == Node1 || Node0 == Node1 )
95  {
96  p->pStore0[0] = Cut_CutDupList( p, p->pStore0[0] );
97  p->pStore0[1] = Cut_CutDupList( p, p->pStore0[1] );
98  p->pStore1[0] = Cut_CutDupList( p, p->pStore1[0] );
99  p->pStore1[1] = Cut_CutDupList( p, p->pStore1[1] );
100  }
101 
102  // shift the cuts by as many latches and recompute signatures
103  if ( nLat0 ) Cut_NodeShiftCutLeaves( p->pStore0[0], nLat0 );
104  if ( nLat0 ) Cut_NodeShiftCutLeaves( p->pStore0[1], nLat0 );
105  if ( nLat1 ) Cut_NodeShiftCutLeaves( p->pStore1[0], nLat1 );
106  if ( nLat1 ) Cut_NodeShiftCutLeaves( p->pStore1[1], nLat1 );
107 
108  // store the original lists for comparison
109  p->pCompareOld = Cut_NodeReadCutsOld( p, Node );
110  p->pCompareNew = Cut_NodeReadCutsNew( p, Node );
111 
112  // merge the old and the new
113 clk = Abc_Clock();
114  Cut_ListStart( pSuper );
115  Cut_NodeDoComputeCuts( p, pSuper, Node, fCompl0, fCompl1, p->pStore0[0], p->pStore1[1], 0, 0 );
116  Cut_NodeDoComputeCuts( p, pSuper, Node, fCompl0, fCompl1, p->pStore0[1], p->pStore1[0], 0, 0 );
117  Cut_NodeDoComputeCuts( p, pSuper, Node, fCompl0, fCompl1, p->pStore0[1], p->pStore1[1], fTriv, 0 );
118  pListNew = Cut_ListFinish( pSuper );
119 p->timeMerge += Abc_Clock() - clk;
120 
121  // shift the cuts by as many latches and recompute signatures
122  if ( Node == Node0 || Node == Node1 || Node0 == Node1 )
123  {
124  Cut_CutRecycleList( p, p->pStore0[0] );
125  Cut_CutRecycleList( p, p->pStore0[1] );
126  Cut_CutRecycleList( p, p->pStore1[0] );
127  Cut_CutRecycleList( p, p->pStore1[1] );
128  }
129  else
130  {
131  if ( nLat0 ) Cut_NodeShiftCutLeaves( p->pStore0[0], -nLat0 );
132  if ( nLat0 ) Cut_NodeShiftCutLeaves( p->pStore0[1], -nLat0 );
133  if ( nLat1 ) Cut_NodeShiftCutLeaves( p->pStore1[0], -nLat1 );
134  if ( nLat1 ) Cut_NodeShiftCutLeaves( p->pStore1[1], -nLat1 );
135  }
136 
137  // set the lists at the node
138  if ( CutSetNum >= 0 )
139  {
140  assert( Cut_NodeReadCutsTemp(p, CutSetNum) == NULL );
141  Cut_NodeWriteCutsTemp( p, CutSetNum, pListNew );
142  }
143  else
144  {
145  assert( Cut_NodeReadCutsNew(p, Node) == NULL );
146  Cut_NodeWriteCutsNew( p, Node, pListNew );
147  }
148 
149  // mark the node if we exceeded the number of cuts
150  if ( p->nNodeCuts >= p->pParams->nKeepMax )
151  p->nCutsLimit++;
152 }
void Cut_CutRecycleList(Cut_Man_t *p, Cut_Cut_t *pList)
Definition: cutCut.c:148
static Cut_Cut_t * Cut_ListFinish(Cut_List_t *p)
Definition: cutList.h:191
Cut_Cut_t * Cut_NodeReadCutsTemp(Cut_Man_t *p, int Node)
Definition: cutApi.c:80
Cut_Cut_t * Cut_NodeReadCutsOld(Cut_Man_t *p, int Node)
Definition: cutApi.c:63
typedefABC_NAMESPACE_HEADER_START struct Cut_ListStruct_t_ Cut_List_t
INCLUDES ///.
Definition: cutList.h:40
Cut_Cut_t * Cut_CutDupList(Cut_Man_t *p, Cut_Cut_t *pList)
Definition: cutCut.c:120
int Cut_CutCountList(Cut_Cut_t *pList)
Definition: cutCut.c:166
static abctime Abc_Clock()
Definition: abc_global.h:279
void Cut_NodeWriteCutsTemp(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:129
abctime timeMerge
Definition: cutInt.h:95
Cut_Cut_t * pStore1[2]
Definition: cutInt.h:70
Cut_Cut_t * pCompareNew
Definition: cutInt.h:72
Cut_Cut_t * pStore0[2]
Definition: cutInt.h:69
Cut_Cut_t * pCompareOld
Definition: cutInt.h:71
static void Cut_ListStart(Cut_List_t *p)
MACRO DEFINITIONS ///.
Definition: cutList.h:66
static ABC_NAMESPACE_IMPL_START void Cut_NodeShiftCutLeaves(Cut_Cut_t *pList, int nLat)
DECLARATIONS ///.
Definition: cutSeq.c:45
Cut_Params_t * pParams
Definition: cutInt.h:51
#define assert(ex)
Definition: util_old.h:213
void Cut_NodeDoComputeCuts(Cut_Man_t *p, Cut_List_t *pSuper, int Node, int fCompl0, int fCompl1, Cut_Cut_t *pList0, Cut_Cut_t *pList1, int fTriv, int TreeCode)
Definition: cutNode.c:572
ABC_INT64_T abctime
Definition: abc_global.h:278
void Cut_NodeWriteCutsNew(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:97
Cut_Cut_t * Cut_NodeReadCutsNew(Cut_Man_t *p, int Node)
MACRO DEFINITIONS ///.
Definition: cutApi.c:45
int nCutsLimit
Definition: cutInt.h:90
void Cut_NodeNewMergeWithOld ( Cut_Man_t p,
int  Node 
)

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

Synopsis [Merges the new cuts with the old cuts.]

Description []

SideEffects []

SeeAlso []

Definition at line 165 of file cutSeq.c.

166 {
167  Cut_Cut_t * pListOld, * pListNew, * pList;
168  // get the new cuts
169  pListNew = Cut_NodeReadCutsNew( p, Node );
170  if ( pListNew == NULL )
171  return;
172  Cut_NodeWriteCutsNew( p, Node, NULL );
173  // get the old cuts
174  pListOld = Cut_NodeReadCutsOld( p, Node );
175  if ( pListOld == NULL )
176  {
177  Cut_NodeWriteCutsOld( p, Node, pListNew );
178  return;
179  }
180  // merge the lists
181  pList = Cut_CutMergeLists( pListOld, pListNew );
182  Cut_NodeWriteCutsOld( p, Node, pList );
183 }
Cut_Cut_t * Cut_NodeReadCutsOld(Cut_Man_t *p, int Node)
Definition: cutApi.c:63
void Cut_NodeWriteCutsOld(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:113
Cut_Cut_t * Cut_CutMergeLists(Cut_Cut_t *pList1, Cut_Cut_t *pList2)
Definition: cutCut.c:185
void Cut_NodeWriteCutsNew(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:97
Cut_Cut_t * Cut_NodeReadCutsNew(Cut_Man_t *p, int Node)
MACRO DEFINITIONS ///.
Definition: cutApi.c:45
void Cut_NodeOldTransferToNew ( Cut_Man_t p,
int  Node 
)

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

Synopsis [Transfers the old cuts to be the new cuts.]

Description []

SideEffects []

SeeAlso []

Definition at line 217 of file cutSeq.c.

218 {
219  Cut_Cut_t * pList;
220  pList = Cut_NodeReadCutsOld( p, Node );
221  Cut_NodeWriteCutsOld( p, Node, NULL );
222  Cut_NodeWriteCutsNew( p, Node, pList );
223 // Cut_CutListVerify( pList );
224 }
Cut_Cut_t * Cut_NodeReadCutsOld(Cut_Man_t *p, int Node)
Definition: cutApi.c:63
void Cut_NodeWriteCutsOld(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:113
void Cut_NodeWriteCutsNew(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:97
static ABC_NAMESPACE_IMPL_START void Cut_NodeShiftCutLeaves ( Cut_Cut_t pList,
int  nLat 
)
inlinestatic

DECLARATIONS ///.

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

FileName [cutSeq.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [K-feasible cut computation package.]

Synopsis [Sequential cut computation.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Shifts all cut leaves of the node by the given number of latches.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file cutSeq.c.

46 {
47  Cut_Cut_t * pTemp;
48  int i;
49  // shift the cuts by as many latches
50  Cut_ListForEachCut( pList, pTemp )
51  {
52  pTemp->uSign = 0;
53  for ( i = 0; i < (int)pTemp->nLeaves; i++ )
54  {
55  pTemp->pLeaves[i] += nLat;
56  pTemp->uSign |= Cut_NodeSign( pTemp->pLeaves[i] );
57  }
58  }
59 }
static unsigned Cut_NodeSign(int Node)
MACRO DEFINITIONS ///.
Definition: cutInt.h:124
int pLeaves[0]
Definition: cut.h:89
unsigned nLeaves
Definition: cut.h:84
unsigned uSign
Definition: cut.h:85
#define Cut_ListForEachCut(pList, pCut)
Definition: cutInt.h:104
int Cut_NodeTempTransferToNew ( Cut_Man_t p,
int  Node,
int  CutSetNum 
)

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

Synopsis [Transfers the temporary cuts to be the new cuts.]

Description [Returns 1 if something was transferred.]

SideEffects []

SeeAlso []

Definition at line 197 of file cutSeq.c.

198 {
199  Cut_Cut_t * pList;
200  pList = Cut_NodeReadCutsTemp( p, CutSetNum );
201  Cut_NodeWriteCutsTemp( p, CutSetNum, NULL );
202  Cut_NodeWriteCutsNew( p, Node, pList );
203  return pList != NULL;
204 }
Cut_Cut_t * Cut_NodeReadCutsTemp(Cut_Man_t *p, int Node)
Definition: cutApi.c:80
void Cut_NodeWriteCutsTemp(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:129
void Cut_NodeWriteCutsNew(Cut_Man_t *p, int Node, Cut_Cut_t *pList)
Definition: cutApi.c:97