abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cbaPrs.h File Reference

Go to the source code of this file.

Data Structures

struct  Cba_Prs_t_
 

Macros

#define Cba_PrsForEachModelVec(vVec, p, pName, i)   for ( i = 0; (i < Vec_IntSize(vVec)) && ((pName) = Abc_NamStr(p->pDesign->pNames, Vec_IntEntry(vVec,i))); i++ )
 

Typedefs

typedef struct Cba_Prs_t_ Cba_Prs_t
 BASIC TYPES ///. More...
 

Enumerations

enum  Cba_PrsType_t {
  CBA_PRS_NONE = 0, CBA_PRS_NODE, CBA_PRS_BOX, CBA_PRS_LATCH,
  CBA_PRS_CONCAT, CBA_PRS_UNKNOWN
}
 INCLUDES ///. More...
 

Functions

static int Cba_PrsErrorSet (Cba_Prs_t *p, char *pError, int Value)
 MACRO DEFINITIONS ///. More...
 
static void Cba_PrsErrorClear (Cba_Prs_t *p)
 
static int Cba_PrsErrorPrint (Cba_Prs_t *p)
 
static void Cba_PrsSetupVecInt (Cba_Prs_t *p, Vec_Int_t *vTo, Vec_Int_t *vFrom)
 
static Cba_Ntk_tCba_PrsAddCurrentModel (Cba_Prs_t *p, int iNameId)
 
static char * Cba_PrsLoadFile (char *pFileName, char **ppLimit)
 
static Cba_Prs_tCba_PrsAlloc (char *pFileName)
 
static void Cba_PrsFree (Cba_Prs_t *p)
 

Macro Definition Documentation

#define Cba_PrsForEachModelVec (   vVec,
  p,
  pName,
 
)    for ( i = 0; (i < Vec_IntSize(vVec)) && ((pName) = Abc_NamStr(p->pDesign->pNames, Vec_IntEntry(vVec,i))); i++ )

Definition at line 84 of file cbaPrs.h.

Typedef Documentation

typedef struct Cba_Prs_t_ Cba_Prs_t

BASIC TYPES ///.

Definition at line 50 of file cbaPrs.h.

Enumeration Type Documentation

INCLUDES ///.

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

FileName [cbaPrs.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Verilog parser.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - November 29, 2014.]

Revision [

Id:
cbaPrs.h,v 1.00 2014/11/29 00:00:00 alanmi Exp

]PARAMETERS ///

Enumerator
CBA_PRS_NONE 
CBA_PRS_NODE 
CBA_PRS_BOX 
CBA_PRS_LATCH 
CBA_PRS_CONCAT 
CBA_PRS_UNKNOWN 

Definition at line 36 of file cbaPrs.h.

36  {
37  CBA_PRS_NONE = 0, // 0: unused
38  CBA_PRS_NODE, // 1: .names/assign/box2 (box without formal/actual binding)
39  CBA_PRS_BOX, // 2: .subckt/.gate/box (box with formal/actual binding)
40  CBA_PRS_LATCH, // 3: .latch
41  CBA_PRS_CONCAT, // 4: concatenation
42  CBA_PRS_UNKNOWN // 5: unknown
43 } Cba_PrsType_t;
Cba_PrsType_t
INCLUDES ///.
Definition: cbaPrs.h:36

Function Documentation

static Cba_Ntk_t* Cba_PrsAddCurrentModel ( Cba_Prs_t p,
int  iNameId 
)
inlinestatic

Definition at line 125 of file cbaPrs.h.

126 {
127  Cba_Ntk_t * pNtk = Cba_NtkAlloc( p->pDesign, Abc_NamStr(p->pDesign->pNames, iNameId) );
128  assert( Vec_IntSize(&p->vInputsCur) != 0 || Vec_IntSize(&p->vOutputsCur) != 0 );
129  Cba_PrsSetupVecInt( p, &pNtk->vInouts, &p->vInoutsCur );
130  Cba_PrsSetupVecInt( p, &pNtk->vInputs, &p->vInputsCur );
131  Cba_PrsSetupVecInt( p, &pNtk->vOutputs, &p->vOutputsCur );
132  Cba_PrsSetupVecInt( p, &pNtk->vWires, &p->vWiresCur );
133  Cba_PrsSetupVecInt( p, &pNtk->vTypes, &p->vTypesCur );
134  Cba_PrsSetupVecInt( p, &pNtk->vFuncs, &p->vFuncsCur );
135  Cba_PrsSetupVecInt( p, &pNtk->vInstIds, &p->vInstIdsCur );
136  pNtk->vFanins = p->vFaninsCur;
137  Vec_WecZero( &p->vFaninsCur );
138  return pNtk;
139 }
Definition: cba.h:99
static Cba_Ntk_t * Cba_NtkAlloc(Cba_Man_t *p, char *pName)
FUNCTION DECLARATIONS ///.
Definition: cba.h:168
Vec_Int_t vTypesCur
Definition: cbaPrs.h:68
Vec_Int_t vWires
Definition: cba.h:107
Vec_Int_t vInputs
Definition: cba.h:105
Abc_Nam_t * pNames
Definition: cba.h:87
Vec_Int_t vInoutsCur
Definition: cbaPrs.h:63
Vec_Int_t vInputsCur
Definition: cbaPrs.h:64
static void Vec_WecZero(Vec_Wec_t *p)
Definition: vecWec.h:330
Vec_Int_t vOutputs
Definition: cba.h:106
Vec_Int_t vFuncs
Definition: cba.h:110
Vec_Int_t vFuncsCur
Definition: cbaPrs.h:69
static void Cba_PrsSetupVecInt(Cba_Prs_t *p, Vec_Int_t *vTo, Vec_Int_t *vFrom)
Definition: cbaPrs.h:116
Cba_Man_t * pDesign
Definition: cbaPrs.h:60
Vec_Int_t vWiresCur
Definition: cbaPrs.h:66
Vec_Wec_t vFaninsCur
Definition: cbaPrs.h:71
Vec_Int_t vOutputsCur
Definition: cbaPrs.h:65
Vec_Wec_t vFanins
Definition: cba.h:112
char * Abc_NamStr(Abc_Nam_t *p, int NameId)
Definition: utilNam.c:479
Vec_Int_t vInstIds
Definition: cba.h:111
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Vec_Int_t vInstIdsCur
Definition: cbaPrs.h:70
#define assert(ex)
Definition: util_old.h:213
Vec_Int_t vInouts
Definition: cba.h:104
Vec_Int_t vTypes
Definition: cba.h:109
static Cba_Prs_t* Cba_PrsAlloc ( char *  pFileName)
inlinestatic

Definition at line 168 of file cbaPrs.h.

169 {
170  Cba_Prs_t * p;
171  char * pBuffer, * pLimit;
172  pBuffer = Cba_PrsLoadFile( pFileName, &pLimit );
173  if ( pBuffer == NULL )
174  return NULL;
175  p = ABC_CALLOC( Cba_Prs_t, 1 );
176  p->pName = pFileName;
177  p->pBuffer = pBuffer;
178  p->pLimit = pLimit;
179  p->pCur = pBuffer;
180  p->pDesign = Cba_ManAlloc( pFileName );
181  return p;
182 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Cba_Man_t * Cba_ManAlloc(char *pFileName)
Definition: cba.h:199
Cba_Man_t * pDesign
Definition: cbaPrs.h:60
char * pCur
Definition: cbaPrs.h:57
char * pBuffer
Definition: cbaPrs.h:55
char * pName
Definition: cbaPrs.h:54
char * pLimit
Definition: cbaPrs.h:56
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static char * Cba_PrsLoadFile(char *pFileName, char **ppLimit)
Definition: cbaPrs.h:143
static void Cba_PrsErrorClear ( Cba_Prs_t p)
inlinestatic

Definition at line 99 of file cbaPrs.h.

100 {
101  p->ErrorStr[0] = '\0';
102 }
char ErrorStr[1000]
Definition: cbaPrs.h:81
static int Cba_PrsErrorPrint ( Cba_Prs_t p)
inlinestatic

Definition at line 104 of file cbaPrs.h.

105 {
106  char * pThis; int iLine = 0;
107  if ( !p->ErrorStr[0] ) return 1;
108  for ( pThis = p->pBuffer; pThis < p->pCur; pThis++ )
109  iLine += (int)(*pThis == '\n');
110  printf( "Line %d: %s\n", iLine, p->ErrorStr );
111  return 0;
112 }
char ErrorStr[1000]
Definition: cbaPrs.h:81
char * pBuffer
Definition: cbaPrs.h:55
static int Cba_PrsErrorSet ( Cba_Prs_t p,
char *  pError,
int  Value 
)
inlinestatic

MACRO DEFINITIONS ///.

Definition at line 92 of file cbaPrs.h.

93 {
94  assert( !p->ErrorStr[0] );
95  sprintf( p->ErrorStr, "%s", pError );
96  return Value;
97 }
char * sprintf()
char ErrorStr[1000]
Definition: cbaPrs.h:81
#define assert(ex)
Definition: util_old.h:213
static void Cba_PrsFree ( Cba_Prs_t p)
inlinestatic

Definition at line 183 of file cbaPrs.h.

184 {
185  if ( p->pDesign )
186  Cba_ManFree( p->pDesign );
187  Vec_IntErase( &p->vInoutsCur );
188  Vec_IntErase( &p->vInputsCur );
189  Vec_IntErase( &p->vOutputsCur );
190  Vec_IntErase( &p->vWiresCur );
191 
192  Vec_IntErase( &p->vTypesCur );
193  Vec_IntErase( &p->vFuncsCur );
194  Vec_IntErase( &p->vInstIdsCur );
195  ABC_FREE( p->vFaninsCur.pArray );
196  // temporary
197  Vec_StrErase( &p->vCover );
198  Vec_IntErase( &p->vTemp );
199  Vec_IntErase( &p->vTemp2 );
200 
201  Vec_IntErase( &p->vKnown );
202  Vec_IntErase( &p->vFailed );
203  Vec_IntErase( &p->vSucceeded );
204  ABC_FREE( p->pBuffer );
205  ABC_FREE( p );
206 }
Vec_Int_t vTypesCur
Definition: cbaPrs.h:68
Vec_Int_t vKnown
Definition: cbaPrs.h:77
Vec_Int_t vSucceeded
Definition: cbaPrs.h:79
Vec_Int_t vTemp2
Definition: cbaPrs.h:75
static void Vec_IntErase(Vec_Int_t *p)
Definition: vecInt.h:266
Vec_Int_t vFailed
Definition: cbaPrs.h:78
Vec_Int_t vInoutsCur
Definition: cbaPrs.h:63
Vec_Int_t vInputsCur
Definition: cbaPrs.h:64
Vec_Str_t vCover
Definition: cbaPrs.h:73
Vec_Int_t vFuncsCur
Definition: cbaPrs.h:69
static void Cba_ManFree(Cba_Man_t *p)
Definition: cba.h:214
Cba_Man_t * pDesign
Definition: cbaPrs.h:60
Vec_Int_t vWiresCur
Definition: cbaPrs.h:66
Vec_Wec_t vFaninsCur
Definition: cbaPrs.h:71
Vec_Int_t vOutputsCur
Definition: cbaPrs.h:65
char * pBuffer
Definition: cbaPrs.h:55
Vec_Int_t vInstIdsCur
Definition: cbaPrs.h:70
#define ABC_FREE(obj)
Definition: abc_global.h:232
Vec_Int_t vTemp
Definition: cbaPrs.h:74
static void Vec_StrErase(Vec_Str_t *p)
Definition: vecStr.h:210
static char* Cba_PrsLoadFile ( char *  pFileName,
char **  ppLimit 
)
inlinestatic

Definition at line 143 of file cbaPrs.h.

144 {
145  char * pBuffer;
146  int nFileSize, RetValue;
147  FILE * pFile = fopen( pFileName, "rb" );
148  if ( pFile == NULL )
149  {
150  printf( "Cannot open input file.\n" );
151  return NULL;
152  }
153  // get the file size, in bytes
154  fseek( pFile, 0, SEEK_END );
155  nFileSize = ftell( pFile );
156  // move the file current reading position to the beginning
157  rewind( pFile );
158  // load the contents of the file into memory
159  pBuffer = ABC_ALLOC( char, nFileSize + 3 );
160  pBuffer[0] = '\n';
161  RetValue = fread( pBuffer+1, nFileSize, 1, pFile );
162  // terminate the string with '\0'
163  pBuffer[nFileSize + 0] = '\n';
164  pBuffer[nFileSize + 1] = '\0';
165  *ppLimit = pBuffer + nFileSize + 2;
166  return pBuffer;
167 }
#define SEEK_END
Definition: zconf.h:392
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
VOID_HACK rewind()
static void Cba_PrsSetupVecInt ( Cba_Prs_t p,
Vec_Int_t vTo,
Vec_Int_t vFrom 
)
inlinestatic

Definition at line 116 of file cbaPrs.h.

117 {
118  if ( Vec_IntSize(vFrom) == 0 )
119  return;
120  vTo->nSize = vTo->nCap = Vec_IntSize(vFrom);
121  vTo->pArray = (int *)Mem_FlexEntryFetch( p->pDesign->pMem, sizeof(int) * Vec_IntSize(vFrom) );
122  memcpy( Vec_IntArray(vTo), Vec_IntArray(vFrom), sizeof(int) * Vec_IntSize(vFrom) );
123  Vec_IntClear( vFrom );
124 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
Mem_Flex_t * pMem
Definition: cba.h:92
char * memcpy()
char * Mem_FlexEntryFetch(Mem_Flex_t *p, int nBytes)
Definition: mem.c:372
Cba_Man_t * pDesign
Definition: cbaPrs.h:60
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452