abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
giaMini.c File Reference
#include "gia.h"
#include "base/main/main.h"
#include "aig/miniaig/miniaig.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START int Gia_ObjFromMiniFanin0Copy (Gia_Man_t *pGia, Vec_Int_t *vCopies, Mini_Aig_t *p, int Id)
 DECLARATIONS ///. More...
 
int Gia_ObjFromMiniFanin1Copy (Gia_Man_t *pGia, Vec_Int_t *vCopies, Mini_Aig_t *p, int Id)
 
Gia_Man_tGia_ManFromMiniAig (Mini_Aig_t *p)
 
Mini_Aig_tGia_ManToMiniAig (Gia_Man_t *pGia)
 
void Abc_FrameGiaInputMiniAig (Abc_Frame_t *pAbc, void *p)
 
void * Abc_FrameGiaOutputMiniAig (Abc_Frame_t *pAbc)
 
Gia_Man_tGia_ManReadMiniAig (char *pFileName)
 
void Gia_ManWriteMiniAig (Gia_Man_t *pGia, char *pFileName)
 

Function Documentation

void Abc_FrameGiaInputMiniAig ( Abc_Frame_t pAbc,
void *  p 
)

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

Synopsis [Procedures to input/output MiniAIG into/from internal GIA.]

Description []

SideEffects []

SeeAlso []

Definition at line 136 of file giaMini.c.

137 {
138  Gia_Man_t * pGia;
139  if ( pAbc == NULL )
140  printf( "ABC framework is not initialized by calling Abc_Start()\n" );
141  pGia = Gia_ManFromMiniAig( (Mini_Aig_t *)p );
142  Abc_FrameUpdateGia( pAbc, pGia );
143 // Gia_ManDelete( pGia );
144 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Gia_Man_t * Gia_ManFromMiniAig(Mini_Aig_t *p)
Definition: giaMini.c:57
Definition: gia.h:95
void Abc_FrameUpdateGia(Abc_Frame_t *pAbc, Gia_Man_t *pNew)
Definition: abc.c:616
void* Abc_FrameGiaOutputMiniAig ( Abc_Frame_t pAbc)

Definition at line 145 of file giaMini.c.

146 {
147  Gia_Man_t * pGia;
148  if ( pAbc == NULL )
149  printf( "ABC framework is not initialized by calling Abc_Start()\n" );
150  pGia = Abc_FrameReadGia( pAbc );
151  if ( pGia == NULL )
152  printf( "Current network in ABC framework is not defined.\n" );
153  return Gia_ManToMiniAig( pGia );
154 }
ABC_DLL Gia_Man_t * Abc_FrameReadGia(Abc_Frame_t *p)
Definition: mainFrame.c:298
Mini_Aig_t * Gia_ManToMiniAig(Gia_Man_t *pGia)
Definition: giaMini.c:103
Definition: gia.h:95
Gia_Man_t* Gia_ManFromMiniAig ( Mini_Aig_t p)

Definition at line 57 of file giaMini.c.

58 {
59  Gia_Man_t * pGia, * pTemp;
60  Vec_Int_t * vCopies;
61  int i, iGiaLit, nNodes;
62  // get the number of nodes
63  nNodes = Mini_AigNodeNum(p);
64  // create ABC network
65  pGia = Gia_ManStart( nNodes );
66  pGia->pName = Abc_UtilStrsav( "MiniAig" );
67  // create mapping from MiniAIG objects into ABC objects
68  vCopies = Vec_IntAlloc( nNodes );
69  Vec_IntPush( vCopies, 0 );
70  // iterate through the objects
71  Gia_ManHashAlloc( pGia );
72  for ( i = 1; i < nNodes; i++ )
73  {
74  if ( Mini_AigNodeIsPi( p, i ) )
75  iGiaLit = Gia_ManAppendCi(pGia);
76  else if ( Mini_AigNodeIsPo( p, i ) )
77  iGiaLit = Gia_ManAppendCo(pGia, Gia_ObjFromMiniFanin0Copy(pGia, vCopies, p, i));
78  else if ( Mini_AigNodeIsAnd( p, i ) )
79  iGiaLit = Gia_ManHashAnd(pGia, Gia_ObjFromMiniFanin0Copy(pGia, vCopies, p, i), Gia_ObjFromMiniFanin1Copy(pGia, vCopies, p, i));
80  else assert( 0 );
81  Vec_IntPush( vCopies, iGiaLit );
82  }
83  Gia_ManHashStop( pGia );
84  assert( Vec_IntSize(vCopies) == nNodes );
85  Vec_IntFree( vCopies );
86  Gia_ManSetRegNum( pGia, Mini_AigRegNum(p) );
87  pGia = Gia_ManCleanup( pTemp = pGia );
88  Gia_ManStop( pTemp );
89  return pGia;
90 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static int Mini_AigNodeIsPi(Mini_Aig_t *p, int Id)
Definition: miniaig.h:116
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
int Gia_ObjFromMiniFanin1Copy(Gia_Man_t *pGia, Vec_Int_t *vCopies, Mini_Aig_t *p, int Id)
Definition: giaMini.c:52
static int Mini_AigRegNum(Mini_Aig_t *p)
Definition: miniaig.h:121
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
static int Mini_AigNodeIsPo(Mini_Aig_t *p, int Id)
Definition: miniaig.h:117
char * pName
Definition: gia.h:97
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Mini_AigNodeIsAnd(Mini_Aig_t *p, int Id)
Definition: miniaig.h:118
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Definition: gia.h:95
static int Mini_AigNodeNum(Mini_Aig_t *p)
Definition: miniaig.h:114
#define assert(ex)
Definition: util_old.h:213
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
ABC_NAMESPACE_IMPL_START int Gia_ObjFromMiniFanin0Copy(Gia_Man_t *pGia, Vec_Int_t *vCopies, Mini_Aig_t *p, int Id)
DECLARATIONS ///.
Definition: giaMini.c:47
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
Gia_Man_t* Gia_ManReadMiniAig ( char *  pFileName)

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

Synopsis [Procedures to read/write GIA to/from MiniAIG file.]

Description []

SideEffects []

SeeAlso []

Definition at line 167 of file giaMini.c.

168 {
169  Mini_Aig_t * p = Mini_AigLoad( pFileName );
170  Gia_Man_t * pGia = Gia_ManFromMiniAig( p );
171  ABC_FREE( pGia->pName );
172  pGia->pName = Extra_FileNameGeneric( pFileName );
173  Mini_AigStop( p );
174  return pGia;
175 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Gia_Man_t * Gia_ManFromMiniAig(Mini_Aig_t *p)
Definition: giaMini.c:57
static Mini_Aig_t * Mini_AigLoad(char *pFileName)
Definition: miniaig.h:176
static void Mini_AigStop(Mini_Aig_t *p)
Definition: miniaig.h:140
char * pName
Definition: gia.h:97
char * Extra_FileNameGeneric(char *FileName)
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: gia.h:95
Mini_Aig_t* Gia_ManToMiniAig ( Gia_Man_t pGia)

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

Synopsis [Converts GIA into MiniAIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 103 of file giaMini.c.

104 {
105  Mini_Aig_t * p;
106  Gia_Obj_t * pObj;
107  int i;
108  // create the manager
109  p = Mini_AigStart();
111  // create primary inputs
112  Gia_ManForEachCi( pGia, pObj, i )
113  pObj->Value = Mini_AigCreatePi(p);
114  // create internal nodes
115  Gia_ManForEachAnd( pGia, pObj, i )
116  pObj->Value = Mini_AigAnd( p, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
117  // create primary outputs
118  Gia_ManForEachCo( pGia, pObj, i )
119  pObj->Value = Mini_AigCreatePo( p, Gia_ObjFanin0Copy(pObj) );
120  // set registers
121  Mini_AigSetRegNum( p, Gia_ManRegNum(pGia) );
122  return p;
123 }
static void Mini_AigSetRegNum(Mini_Aig_t *p, int n)
Definition: miniaig.h:122
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static Mini_Aig_t * Mini_AigStart()
Definition: miniaig.h:131
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Mini_AigLitConst0()
Definition: miniaig.h:108
static int Mini_AigCreatePo(Mini_Aig_t *p, int Lit0)
Definition: miniaig.h:206
static int Mini_AigCreatePi(Mini_Aig_t *p)
Definition: miniaig.h:200
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static int Mini_AigAnd(Mini_Aig_t *p, int Lit0, int Lit1)
Definition: miniaig.h:215
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
unsigned Value
Definition: gia.h:87
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Gia_ManWriteMiniAig ( Gia_Man_t pGia,
char *  pFileName 
)

Definition at line 176 of file giaMini.c.

177 {
178  Mini_Aig_t * p = Gia_ManToMiniAig( pGia );
179  Mini_AigDump( p, pFileName );
180  Mini_AigStop( p );
181 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Mini_Aig_t * Gia_ManToMiniAig(Gia_Man_t *pGia)
Definition: giaMini.c:103
static void Mini_AigStop(Mini_Aig_t *p)
Definition: miniaig.h:140
static void Mini_AigDump(Mini_Aig_t *p, char *pFileName)
Definition: miniaig.h:161
ABC_NAMESPACE_IMPL_START int Gia_ObjFromMiniFanin0Copy ( Gia_Man_t pGia,
Vec_Int_t vCopies,
Mini_Aig_t p,
int  Id 
)

DECLARATIONS ///.

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

FileName [giaMini.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Reader/writer for MiniAIG.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Converts MiniAIG into GIA.]

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file giaMini.c.

48 {
49  int Lit = Mini_AigNodeFanin0( p, Id );
50  return Abc_LitNotCond( Vec_IntEntry(vCopies, Abc_Lit2Var(Lit)), Abc_LitIsCompl(Lit) );
51 }
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static int Mini_AigNodeFanin0(Mini_Aig_t *p, int Id)
Definition: miniaig.h:89
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
int Gia_ObjFromMiniFanin1Copy ( Gia_Man_t pGia,
Vec_Int_t vCopies,
Mini_Aig_t p,
int  Id 
)

Definition at line 52 of file giaMini.c.

53 {
54  int Lit = Mini_AigNodeFanin1( p, Id );
55  return Abc_LitNotCond( Vec_IntEntry(vCopies, Abc_Lit2Var(Lit)), Abc_LitIsCompl(Lit) );
56 }
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static int Mini_AigNodeFanin1(Mini_Aig_t *p, int Id)
Definition: miniaig.h:94
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264