abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
saigScl.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [saigScl.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Sequential AIG package.]
8 
9  Synopsis [Sequential cleanup.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: saigScl.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "saig.h"
22 
24 
25 
26 ////////////////////////////////////////////////////////////////////////
27 /// DECLARATIONS ///
28 ////////////////////////////////////////////////////////////////////////
29 
30 ////////////////////////////////////////////////////////////////////////
31 /// FUNCTION DEFINITIONS ///
32 ////////////////////////////////////////////////////////////////////////
33 
34 /**Function*************************************************************
35 
36  Synopsis [Report registers useless for SEC.]
37 
38  Description []
39 
40  SideEffects []
41 
42  SeeAlso []
43 
44 ***********************************************************************/
46 {
47  Aig_Obj_t * pObj, * pDriver;
48  int i, Counter1, Counter2;
49  // set PIO numbers
50  Aig_ManSetCioIds( pAig );
51  // check how many POs are driven by a register whose ref count is 1
52  Counter1 = 0;
53  Saig_ManForEachPo( pAig, pObj, i )
54  {
55  pDriver = Aig_ObjFanin0(pObj);
56  if ( Saig_ObjIsLo(pAig, pDriver) && Aig_ObjRefs(pDriver) == 1 )
57  Counter1++;
58  }
59  // check how many PIs have ref count 1 and drive a register
60  Counter2 = 0;
61  Saig_ManForEachLi( pAig, pObj, i )
62  {
63  pDriver = Aig_ObjFanin0(pObj);
64  if ( Saig_ObjIsPi(pAig, pDriver) && Aig_ObjRefs(pDriver) == 1 )
65  Counter2++;
66  }
67  if ( Counter1 )
68  printf( "Network has %d (out of %d) registers driving POs.\n", Counter1, Saig_ManRegNum(pAig) );
69  if ( Counter2 )
70  printf( "Network has %d (out of %d) registers driven by PIs.\n", Counter2, Saig_ManRegNum(pAig) );
71 }
72 
73 
74 /**Function*************************************************************
75 
76  Synopsis [Report the number of pairs of complemented registers.]
77 
78  Description []
79 
80  SideEffects []
81 
82  SeeAlso []
83 
84 ***********************************************************************/
86 {
87  Aig_Obj_t * pObj, * pFanin;
88  int i, Counter = 0;
89  assert( Aig_ManRegNum(p) > 0 );
90  Aig_ManForEachObj( p, pObj, i )
91  assert( !pObj->fMarkA );
92  Aig_ManForEachLiSeq( p, pObj, i )
93  {
94  pFanin = Aig_ObjFanin0(pObj);
95  if ( pFanin->fMarkA )
96  Counter++;
97  else
98  pFanin->fMarkA = 1;
99  }
100  // count fanins that have both attributes
101  Aig_ManForEachLiSeq( p, pObj, i )
102  {
103  pFanin = Aig_ObjFanin0(pObj);
104  pFanin->fMarkA = 0;
105  }
106  return Counter;
107 }
108 
109 ////////////////////////////////////////////////////////////////////////
110 /// END OF FILE ///
111 ////////////////////////////////////////////////////////////////////////
112 
113 
115 
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
ABC_NAMESPACE_IMPL_START void Saig_ManReportUselessRegisters(Aig_Man_t *pAig)
DECLARATIONS ///.
Definition: saigScl.c:45
unsigned int fMarkA
Definition: aig.h:79
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
int Saig_ManReportComplements(Aig_Man_t *p)
Definition: saigScl.c:85
Definition: aig.h:69
static int Counter
void Aig_ManSetCioIds(Aig_Man_t *p)
Definition: aigUtil.c:965
static int Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
#define Aig_ManForEachLiSeq(p, pObj, i)
Definition: aig.h:447
static int Aig_ObjRefs(Aig_Obj_t *pObj)
Definition: aig.h:300
static int Saig_ObjIsPi(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:82