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

Go to the source code of this file.

Functions

static
ABC_NAMESPACE_IMPL_START void 
Abc_NtkChangeCiOrder (Abc_Ntk_t *pNtk, Vec_Ptr_t *vSupp, int fReverse)
 DECLARATIONS ///. More...
 
void Abc_NtkFindCiOrder (Abc_Ntk_t *pNtk, int fReverse, int fVerbose)
 FUNCTION DEFINITIONS ///. More...
 
void Abc_NtkImplementCiOrder (Abc_Ntk_t *pNtk, char *pFileName, int fReverse, int fVerbose)
 

Function Documentation

void Abc_NtkChangeCiOrder ( Abc_Ntk_t pNtk,
Vec_Ptr_t vSupp,
int  fReverse 
)
static

DECLARATIONS ///.

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

FileName [abcOrder.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Exploring static BDD variable orders.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

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

Synopsis [Changes the order of primary inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 108 of file abcOrder.c.

109 {
110  Abc_Obj_t * pObj;
111  int i;
112  assert( Vec_PtrSize(vSupp) == Abc_NtkCiNum(pNtk) );
113  // order CIs using the array
114  if ( fReverse )
115  Vec_PtrForEachEntry( Abc_Obj_t *, vSupp, pObj, i )
116  Vec_PtrWriteEntry( pNtk->vCis, Vec_PtrSize(vSupp)-1-i, pObj );
117  else
118  Vec_PtrForEachEntry( Abc_Obj_t *, vSupp, pObj, i )
119  Vec_PtrWriteEntry( pNtk->vCis, i, pObj );
120  // order PIs accordingly
121  Vec_PtrClear( pNtk->vPis );
122  Abc_NtkForEachCi( pNtk, pObj, i )
123  if ( Abc_ObjIsPi(pObj) )
124  Vec_PtrPush( pNtk->vPis, pObj );
125 // Abc_NtkForEachCi( pNtk, pObj, i )
126 // printf( "%s ", Abc_ObjName(pObj) );
127 // printf( "\n" );
128 }
static int Abc_ObjIsPi(Abc_Obj_t *pObj)
Definition: abc.h:347
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Abc_NtkFindCiOrder ( Abc_Ntk_t pNtk,
int  fReverse,
int  fVerbose 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Changes the order of primary inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file abcOrder.c.

48 {
49  Vec_Ptr_t * vSupp;
50  vSupp = Abc_NtkSupport( pNtk );
51  Abc_NtkChangeCiOrder( pNtk, vSupp, fReverse );
52  Vec_PtrFree( vSupp );
53 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static ABC_NAMESPACE_IMPL_START void Abc_NtkChangeCiOrder(Abc_Ntk_t *pNtk, Vec_Ptr_t *vSupp, int fReverse)
DECLARATIONS ///.
Definition: abcOrder.c:108
ABC_DLL Vec_Ptr_t * Abc_NtkSupport(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:828
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Abc_NtkImplementCiOrder ( Abc_Ntk_t pNtk,
char *  pFileName,
int  fReverse,
int  fVerbose 
)

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

Synopsis [Implements the given variable order.]

Description []

SideEffects []

SeeAlso []

Definition at line 66 of file abcOrder.c.

67 {
68  char Buffer[1000];
69  FILE * pFile;
70  Vec_Ptr_t * vSupp;
71  Abc_Obj_t * pObj;
72  pFile = fopen( pFileName, "r" );
73  vSupp = Vec_PtrAlloc( Abc_NtkCiNum(pNtk) );
74  while ( fscanf( pFile, "%s", Buffer ) == 1 )
75  {
76  pObj = Abc_NtkFindCi( pNtk, Buffer );
77  if ( pObj == NULL || !Abc_ObjIsCi(pObj) )
78  {
79  printf( "Name \"%s\" is not a PI name. Cannot use this order.\n", Buffer );
80  Vec_PtrFree( vSupp );
81  fclose( pFile );
82  return;
83  }
84  Vec_PtrPush( vSupp, pObj );
85  }
86  fclose( pFile );
87  if ( Vec_PtrSize(vSupp) != Abc_NtkCiNum(pNtk) )
88  {
89  printf( "The number of names in the order (%d) is not the same as the number of PIs (%d).\n", Vec_PtrSize(vSupp), Abc_NtkCiNum(pNtk) );
90  Vec_PtrFree( vSupp );
91  return;
92  }
93  Abc_NtkChangeCiOrder( pNtk, vSupp, fReverse );
94  Vec_PtrFree( vSupp );
95 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
ABC_DLL Abc_Obj_t * Abc_NtkFindCi(Abc_Ntk_t *pNtk, char *pName)
Definition: abcObj.c:530
static ABC_NAMESPACE_IMPL_START void Abc_NtkChangeCiOrder(Abc_Ntk_t *pNtk, Vec_Ptr_t *vSupp, int fReverse)
DECLARATIONS ///.
Definition: abcOrder.c:108
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223