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

Go to the source code of this file.

Functions

static
ABC_NAMESPACE_IMPL_START
Ivy_Obj_t
Ivy_TableLookupPair_rec (Ivy_Man_t *p, Ivy_Obj_t *pObj0, Ivy_Obj_t *pObj1, int fCompl0, int fCompl1, Ivy_Type_t Type)
 DECLARATIONS ///. More...
 
Ivy_Obj_tIvy_CanonPair_rec (Ivy_Man_t *p, Ivy_Obj_t *pGhost)
 FUNCTION DEFINITIONS ///. More...
 
Ivy_Obj_tIvy_CanonAnd (Ivy_Man_t *p, Ivy_Obj_t *pObj0, Ivy_Obj_t *pObj1)
 
Ivy_Obj_tIvy_CanonExor (Ivy_Man_t *p, Ivy_Obj_t *pObj0, Ivy_Obj_t *pObj1)
 
Ivy_Obj_tIvy_CanonLatch (Ivy_Man_t *p, Ivy_Obj_t *pObj, Ivy_Init_t Init)
 

Function Documentation

Ivy_Obj_t* Ivy_CanonAnd ( Ivy_Man_t p,
Ivy_Obj_t pObj0,
Ivy_Obj_t pObj1 
)

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

Synopsis [Creates the canonical form of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 90 of file ivyCanon.c.

91 {
92  Ivy_Obj_t * pGhost, * pResult;
93  pGhost = Ivy_ObjCreateGhost( p, pObj0, pObj1, IVY_AND, IVY_INIT_NONE );
94  pResult = Ivy_CanonPair_rec( p, pGhost );
95  return pResult;
96 }
Definition: ivy.h:58
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: ivy.h:73
static Ivy_Obj_t * Ivy_ObjCreateGhost(Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1, Ivy_Type_t Type, Ivy_Init_t Init)
Definition: ivy.h:308
Ivy_Obj_t * Ivy_CanonPair_rec(Ivy_Man_t *p, Ivy_Obj_t *pGhost)
FUNCTION DEFINITIONS ///.
Definition: ivyCanon.c:47
Ivy_Obj_t* Ivy_CanonExor ( Ivy_Man_t p,
Ivy_Obj_t pObj0,
Ivy_Obj_t pObj1 
)

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

Synopsis [Creates the canonical form of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 109 of file ivyCanon.c.

110 {
111  Ivy_Obj_t * pGhost, * pResult;
112  int fCompl = Ivy_IsComplement(pObj0) ^ Ivy_IsComplement(pObj1);
113  pObj0 = Ivy_Regular(pObj0);
114  pObj1 = Ivy_Regular(pObj1);
115  pGhost = Ivy_ObjCreateGhost( p, pObj0, pObj1, IVY_EXOR, IVY_INIT_NONE );
116  pResult = Ivy_CanonPair_rec( p, pGhost );
117  return Ivy_NotCond( pResult, fCompl );
118 }
static int Ivy_IsComplement(Ivy_Obj_t *p)
Definition: ivy.h:196
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: ivy.h:73
static Ivy_Obj_t * Ivy_Regular(Ivy_Obj_t *p)
Definition: ivy.h:193
static Ivy_Obj_t * Ivy_ObjCreateGhost(Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1, Ivy_Type_t Type, Ivy_Init_t Init)
Definition: ivy.h:308
Definition: ivy.h:59
static Ivy_Obj_t * Ivy_NotCond(Ivy_Obj_t *p, int c)
Definition: ivy.h:195
Ivy_Obj_t * Ivy_CanonPair_rec(Ivy_Man_t *p, Ivy_Obj_t *pGhost)
FUNCTION DEFINITIONS ///.
Definition: ivyCanon.c:47
Ivy_Obj_t* Ivy_CanonLatch ( Ivy_Man_t p,
Ivy_Obj_t pObj,
Ivy_Init_t  Init 
)

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

Synopsis [Creates the canonical form of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 131 of file ivyCanon.c.

132 {
133  Ivy_Obj_t * pGhost, * pResult;
134  int fCompl = Ivy_IsComplement(pObj);
135  pObj = Ivy_Regular(pObj);
136  pGhost = Ivy_ObjCreateGhost( p, pObj, NULL, IVY_LATCH, Ivy_InitNotCond(Init, fCompl) );
137  pResult = Ivy_TableLookup( p, pGhost );
138  if ( pResult == NULL )
139  pResult = Ivy_ObjCreate( p, pGhost );
140  return Ivy_NotCond( pResult, fCompl );
141 }
static int Ivy_IsComplement(Ivy_Obj_t *p)
Definition: ivy.h:196
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: ivy.h:57
Ivy_Obj_t * Ivy_ObjCreate(Ivy_Man_t *p, Ivy_Obj_t *pGhost)
Definition: ivyObj.c:77
static Ivy_Init_t Ivy_InitNotCond(Ivy_Init_t Init, int fCompl)
Definition: ivy.h:327
Ivy_Obj_t * Ivy_TableLookup(Ivy_Man_t *p, Ivy_Obj_t *pObj)
FUNCTION DEFINITIONS ///.
Definition: ivyTable.c:71
Definition: ivy.h:73
static Ivy_Obj_t * Ivy_Regular(Ivy_Obj_t *p)
Definition: ivy.h:193
static Ivy_Obj_t * Ivy_ObjCreateGhost(Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1, Ivy_Type_t Type, Ivy_Init_t Init)
Definition: ivy.h:308
static Ivy_Obj_t * Ivy_NotCond(Ivy_Obj_t *p, int c)
Definition: ivy.h:195
Ivy_Obj_t* Ivy_CanonPair_rec ( Ivy_Man_t p,
Ivy_Obj_t pGhost 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Creates the canonical form of the node.]

Description []

SideEffects []

SeeAlso []

remember the latches

Definition at line 47 of file ivyCanon.c.

48 {
49  Ivy_Obj_t * pResult, * pLat0, * pLat1;
50  Ivy_Init_t Init, Init0, Init1;
51  int fCompl0, fCompl1;
52  Ivy_Type_t Type;
53  assert( Ivy_ObjIsNode(pGhost) );
54  assert( Ivy_ObjIsAnd(pGhost) || (!Ivy_ObjFaninC0(pGhost) && !Ivy_ObjFaninC1(pGhost)) );
55  assert( Ivy_ObjFaninId0(pGhost) != 0 && Ivy_ObjFaninId1(pGhost) != 0 );
56  // consider the case when the pair is canonical
57  if ( !Ivy_ObjIsLatch(Ivy_ObjFanin0(pGhost)) || !Ivy_ObjIsLatch(Ivy_ObjFanin1(pGhost)) )
58  {
59  if ( (pResult = Ivy_TableLookup( p, pGhost )) )
60  return pResult;
61  return Ivy_ObjCreate( p, pGhost );
62  }
63  /// remember the latches
64  pLat0 = Ivy_ObjFanin0(pGhost);
65  pLat1 = Ivy_ObjFanin1(pGhost);
66  // remember type and compls
67  Type = Ivy_ObjType(pGhost);
68  fCompl0 = Ivy_ObjFaninC0(pGhost);
69  fCompl1 = Ivy_ObjFaninC1(pGhost);
70  // call recursively
71  pResult = Ivy_Oper( p, Ivy_NotCond(Ivy_ObjFanin0(pLat0), fCompl0), Ivy_NotCond(Ivy_ObjFanin0(pLat1), fCompl1), Type );
72  // build latch on top of this
73  Init0 = Ivy_InitNotCond( Ivy_ObjInit(pLat0), fCompl0 );
74  Init1 = Ivy_InitNotCond( Ivy_ObjInit(pLat1), fCompl1 );
75  Init = (Type == IVY_AND)? Ivy_InitAnd(Init0, Init1) : Ivy_InitExor(Init0, Init1);
76  return Ivy_Latch( p, pResult, Init );
77 }
Ivy_Obj_t * Ivy_Latch(Ivy_Man_t *p, Ivy_Obj_t *pObj, Ivy_Init_t Init)
Definition: ivyOper.c:287
Definition: ivy.h:58
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Ivy_ObjFaninId1(Ivy_Obj_t *pObj)
Definition: ivy.h:268
Ivy_Obj_t * Ivy_ObjCreate(Ivy_Man_t *p, Ivy_Obj_t *pGhost)
Definition: ivyObj.c:77
Ivy_Obj_t * Ivy_Oper(Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1, Ivy_Type_t Type)
FUNCTION DEFINITIONS ///.
Definition: ivyOper.c:63
static Ivy_Init_t Ivy_InitNotCond(Ivy_Init_t Init, int fCompl)
Definition: ivy.h:327
static int Ivy_ObjIsLatch(Ivy_Obj_t *pObj)
Definition: ivy.h:241
static Ivy_Obj_t * Ivy_ObjFanin1(Ivy_Obj_t *pObj)
Definition: ivy.h:272
static Ivy_Obj_t * Ivy_ObjFanin0(Ivy_Obj_t *pObj)
Definition: ivy.h:271
static int Ivy_ObjFaninId0(Ivy_Obj_t *pObj)
Definition: ivy.h:267
Ivy_Obj_t * Ivy_TableLookup(Ivy_Man_t *p, Ivy_Obj_t *pObj)
FUNCTION DEFINITIONS ///.
Definition: ivyTable.c:71
static int Ivy_ObjFaninC1(Ivy_Obj_t *pObj)
Definition: ivy.h:270
Ivy_Init_t
Definition: ivy.h:65
Definition: ivy.h:73
static Ivy_Type_t Ivy_ObjType(Ivy_Obj_t *pObj)
Definition: ivy.h:231
static int Ivy_ObjIsNode(Ivy_Obj_t *pObj)
Definition: ivy.h:245
static Ivy_Init_t Ivy_InitAnd(Ivy_Init_t InitA, Ivy_Init_t InitB)
Definition: ivy.h:340
static int Ivy_ObjIsAnd(Ivy_Obj_t *pObj)
Definition: ivy.h:242
static Ivy_Obj_t * Ivy_NotCond(Ivy_Obj_t *p, int c)
Definition: ivy.h:195
static Ivy_Init_t Ivy_InitExor(Ivy_Init_t InitA, Ivy_Init_t InitB)
Definition: ivy.h:351
#define assert(ex)
Definition: util_old.h:213
Ivy_Type_t
Definition: ivy.h:52
static int Ivy_ObjFaninC0(Ivy_Obj_t *pObj)
Definition: ivy.h:269
static Ivy_Init_t Ivy_ObjInit(Ivy_Obj_t *pObj)
Definition: ivy.h:232
static ABC_NAMESPACE_IMPL_START Ivy_Obj_t* Ivy_TableLookupPair_rec ( Ivy_Man_t p,
Ivy_Obj_t pObj0,
Ivy_Obj_t pObj1,
int  fCompl0,
int  fCompl1,
Ivy_Type_t  Type 
)
static

DECLARATIONS ///.

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

FileName [ivyCanon.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [And-Inverter Graph package.]

Synopsis [Finding canonical form of objects.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - May 11, 2006.]

Revision [

Id:
ivyCanon.c,v 1.00 2006/05/11 00:00:00 alanmi Exp

]