ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
cbaPrs.h
Go to the documentation of this file.
1
20
21#ifndef ABC__base__prs__prs_h
22#define ABC__base__prs__prs_h
23
24
28
29#include "aig/gia/gia.h"
30#include "misc/util/utilNam.h"
31
35
37
38// Verilog keywords
39typedef enum {
40 PRS_VER_NONE = 0, // 0: unused
41 PRS_VER_INPUT, // 1: input
42 PRS_VER_OUTPUT, // 2: output
43 PRS_VER_INOUT, // 3: inout
44 PRS_VER_WIRE, // 4: wire
45 PRS_VER_REG, // 5: reg
46 PRS_VER_MODULE, // 6: module
47 PRS_VER_ASSIGN, // 7: assign
48 PRS_VER_ALWAYS, // 8: always
49 PRS_VER_FUNCTION, // 9: function
50 PRS_VER_DEFPARAM, // 10: defparam
51 PRS_VER_BEGIN, // 11: begin
52 PRS_VER_END, // 12: end
53 PRS_VER_CASE, // 13: case
54 PRS_VER_ENDCASE, // 14: endcase
55 PRS_VER_SIGNED, // 15: signed
56 PRS_VER_ENDMODULE, // 16: endmodule
57 PRS_VER_UNKNOWN // 17: unknown
59
60// parser name types
61typedef enum {
62 CBA_PRS_NAME = 0, // 0: name/variable
63 CBA_PRS_SLICE, // 1: slice
64 CBA_PRS_CONST, // 2: constant
65 CBA_PRS_CONCAT, // 3: concatentation
67
71
72// network
73typedef struct Prs_Ntk_t_ Prs_Ntk_t;
75{
76 // general info
78 unsigned fMapped : 1;
79 unsigned fSlices : 1;
80 unsigned fHasC0s : 1;
81 unsigned fHasC1s : 1;
82 unsigned fHasCXs : 1;
83 unsigned fHasCZs : 1;
87 // interface
88 Vec_Int_t vOrder; // order of signals
89 // signal names
90 Vec_Int_t vInouts; // inouts
91 Vec_Int_t vInputs; // inputs
92 Vec_Int_t vOutputs; // outputs
93 Vec_Int_t vWires; // wires
94 // signal ranges
95 Vec_Int_t vInoutsR; // inouts
96 Vec_Int_t vInputsR; // inputs
97 Vec_Int_t vOutputsR; // outputs
98 Vec_Int_t vWiresR; // wires
99 // slices/concatenations/objects
100 Vec_Int_t vSlices; // NameId + RangeId
101 Vec_Int_t vConcats; // array of NameId/SliceId/ConstId
102 Vec_Int_t vBoxes; // ModuleId + InstId + array of pairs {FormNameId, ActSignalId(NameId/SliceId/ConstId/ConcatId)}
103 Vec_Int_t vObjs; // box handles
104};
105
106// parser
107typedef struct Prs_Man_t_ Prs_Man_t;
109{
110 // input data
111 char * pName; // file name
112 char * pBuffer; // file contents
113 char * pLimit; // end of file
114 char * pCur; // current position
115 Abc_Nam_t * pStrs; // string manager
116 Abc_Nam_t * pFuns; // cover manager
117 Hash_IntMan_t * vHash; // variable ranges
118 Prs_Ntk_t * pNtk; // current network
119 Vec_Ptr_t * vNtks; // input networks
120 // temporary data
121 Vec_Str_t vCover; // one SOP cover
122 Vec_Int_t vTemp; // array of tokens
123 Vec_Int_t vTemp2; // array of tokens
124 Vec_Int_t vTemp3; // array of tokens
125 Vec_Int_t vTemp4; // array of tokens
126 // statistics
130 // error handling
131 int nOpens; // open port counter
132 int fUsingTemp2; // vTemp2 is in use
133 int FuncNameId; // temp value
134 int FuncRangeId; // temp value
135 char ErrorStr[1000]; // error
136};
137
138static inline Prs_Ntk_t * Prs_ManNtk( Vec_Ptr_t * vPrs, int i ) { return i >= 0 && i < Vec_PtrSize(vPrs) ? (Prs_Ntk_t *)Vec_PtrEntry(vPrs, i) : NULL; }
139static inline Prs_Ntk_t * Prs_ManRoot( Vec_Ptr_t * vPrs ) { return Prs_ManNtk(vPrs, 0); }
140static inline Abc_Nam_t * Prs_ManNameMan( Vec_Ptr_t * vPrs ) { return Prs_ManRoot(vPrs)->pStrs; }
141static inline Abc_Nam_t * Prs_ManFuncMan( Vec_Ptr_t * vPrs ) { return Prs_ManRoot(vPrs)->pFuns; }
142
143static inline int Prs_NtkId( Prs_Ntk_t * p ) { return p->iModuleName; }
144static inline int Prs_NtkPioNum( Prs_Ntk_t * p ) { return Vec_IntSize(&p->vInouts); }
145static inline int Prs_NtkPiNum( Prs_Ntk_t * p ) { return Vec_IntSize(&p->vInputs); }
146static inline int Prs_NtkPoNum( Prs_Ntk_t * p ) { return Vec_IntSize(&p->vOutputs); }
147static inline int Prs_NtkBoxNum( Prs_Ntk_t * p ) { return Vec_IntSize(&p->vObjs); }
148static inline int Prs_NtkObjNum( Prs_Ntk_t * p ) { return Prs_NtkPioNum(p) + Prs_NtkPiNum(p) + Prs_NtkPoNum(p) + Prs_NtkBoxNum(p); }
149static inline char * Prs_NtkStr( Prs_Ntk_t * p, int h ) { return Abc_NamStr(p->pStrs, h); }
150static inline char * Prs_NtkSop( Prs_Ntk_t * p, int h ) { return Abc_NamStr(p->pFuns, h); }
151static inline char * Prs_NtkConst( Prs_Ntk_t * p, int h ) { return Abc_NamStr(p->pFuns, h); }
152static inline char * Prs_NtkName( Prs_Ntk_t * p ) { return Prs_NtkStr(p, Prs_NtkId(p)); }
153static inline int Prs_NtkSigName( Prs_Ntk_t * p, int i ) { if (!p->fSlices) return i; assert(Abc_Lit2Att2(i) == CBA_PRS_NAME); return Abc_Lit2Var2(i); }
154static inline int Ptr_NtkRangeSize( Prs_Ntk_t * p, int h ) { int l = Hash_IntObjData0(p->vHash, h), r = Hash_IntObjData1(p->vHash, h); return 1 + (l > r ? l-r : r-l); }
155
156static inline int Prs_SliceName( Prs_Ntk_t * p, int h ) { return Vec_IntEntry(&p->vSlices, h); }
157static inline int Prs_SliceRange( Prs_Ntk_t * p, int h ) { return Vec_IntEntry(&p->vSlices, h+1); }
158
159static inline int Prs_CatSize( Prs_Ntk_t * p, int h ) { return Vec_IntEntry(&p->vConcats, h); }
160static inline int * Prs_CatArray( Prs_Ntk_t * p, int h ) { return Vec_IntEntryP(&p->vConcats, h+1); }
161static inline Vec_Int_t * Prs_CatSignals( Prs_Ntk_t * p, int h ) { static Vec_Int_t V; V.nSize = V.nCap = Prs_CatSize(p, h); V.pArray = Prs_CatArray(p, h); return &V; }
162
163static inline int Prs_BoxHand( Prs_Ntk_t * p, int i ) { return Vec_IntEntry(&p->vObjs, i); }
164static inline int Prs_BoxSize( Prs_Ntk_t * p, int i ) { return Vec_IntEntry(&p->vBoxes, Prs_BoxHand(p, i))-2; }
165static inline int Prs_BoxIONum( Prs_Ntk_t * p, int i ) { return Prs_BoxSize(p, i) / 2; }
166static inline int Prs_BoxNtk( Prs_Ntk_t * p, int i ) { return Vec_IntEntry(&p->vBoxes, Prs_BoxHand(p, i)+1); }
167static inline void Prs_BoxSetNtk( Prs_Ntk_t * p, int i, int m ) { Vec_IntWriteEntry(&p->vBoxes, Prs_BoxHand(p, i)+1, m); }
168static inline int Prs_BoxName( Prs_Ntk_t * p, int i ) { return Vec_IntEntry(&p->vBoxes, Prs_BoxHand(p, i)+2); }
169static inline int Prs_BoxIsNode( Prs_Ntk_t * p, int i ) { return!Vec_IntEntry(&p->vBoxes, Prs_BoxHand(p, i)+3); } // no formal names
170static inline int * Prs_BoxArray( Prs_Ntk_t * p, int i ) { return Vec_IntEntryP(&p->vBoxes, Prs_BoxHand(p, i)+3); }
171static inline Vec_Int_t * Prs_BoxSignals( Prs_Ntk_t * p, int i ) { static Vec_Int_t V; V.nSize = V.nCap = Prs_BoxSize(p, i); V.pArray = Prs_BoxArray(p, i); return &V; }
172
173#define Prs_ManForEachNameVec( vVec, p, pName, i ) \
174 for ( i = 0; (i < Vec_IntSize(vVec)) && ((pName) = Abc_NamStr(p->pStrs, Vec_IntEntry(vVec,i))); i++ )
175
176#define Prs_NtkForEachPio( p, NameId, i ) \
177 for ( i = 0; i < Prs_NtkPioNum(p) && ((NameId) = Vec_IntEntry(&p->vInouts, i)); i++ )
178#define Prs_NtkForEachPi( p, NameId, i ) \
179 for ( i = 0; i < Prs_NtkPiNum(p) && ((NameId) = Vec_IntEntry(&p->vInputs, i)); i++ )
180#define Prs_NtkForEachPo( p, NameId, i ) \
181 for ( i = 0; i < Prs_NtkPoNum(p) && ((NameId) = Vec_IntEntry(&p->vOutputs, i)); i++ )
182#define Prs_NtkForEachBox( p, vVec, i ) \
183 for ( i = 0; i < Prs_NtkBoxNum(p) && ((vVec) = Prs_BoxSignals(p, i)); i++ )
184
188
189// create error message
190static inline int Prs_ManErrorSet( Prs_Man_t * p, char * pError, int Value )
191{
192 assert( !p->ErrorStr[0] );
193 sprintf( p->ErrorStr, "%s", pError );
194 return Value;
195}
196// clear error message
197static inline void Prs_ManErrorClear( Prs_Man_t * p )
198{
199 p->ErrorStr[0] = '\0';
200}
201// print error message
202static inline int Prs_ManErrorPrint( Prs_Man_t * p )
203{
204 char * pThis; int iLine = 0;
205 if ( !p->ErrorStr[0] ) return 1;
206 for ( pThis = p->pBuffer; pThis < p->pCur; pThis++ )
207 iLine += (int)(*pThis == '\n');
208 printf( "Line %d: %s\n", iLine, p->ErrorStr );
209 return 0;
210}
211
212// parsing network
213static inline void Prs_ManInitializeNtk( Prs_Man_t * p, int iName, int fSlices )
214{
215 assert( p->pNtk == NULL );
216 p->pNtk = ABC_CALLOC( Prs_Ntk_t, 1 );
217 p->pNtk->iModuleName = iName;
218 p->pNtk->fSlices = fSlices;
219 p->pNtk->pStrs = Abc_NamRef( p->pStrs );
220 p->pNtk->pFuns = Abc_NamRef( p->pFuns );
221 p->pNtk->vHash = Hash_IntManRef( p->vHash );
222 Vec_PtrPush( p->vNtks, p->pNtk );
223}
224static inline void Prs_ManFinalizeNtk( Prs_Man_t * p )
225{
226 assert( p->pNtk != NULL );
227 p->pNtk = NULL;
228}
229
230static inline int Prs_ManNewStrId( Prs_Man_t * p, const char * format, ... )
231{
232 Abc_Nam_t * pStrs = p->pStrs;
233 Vec_Str_t * vBuf = Abc_NamBuffer( pStrs );
234 int nAdded, nSize = 1000;
235 va_list args; va_start( args, format );
236 Vec_StrGrow( vBuf, Vec_StrSize(vBuf) + nSize );
237 nAdded = vsnprintf( Vec_StrLimit(vBuf), nSize, format, args );
238 if ( nAdded > nSize )
239 {
240 Vec_StrGrow( vBuf, Vec_StrSize(vBuf) + nAdded + nSize );
241 nSize = vsnprintf( Vec_StrLimit(vBuf), nAdded, format, args );
242 assert( nSize == nAdded );
243 }
244 va_end( args );
245 return Abc_NamStrFindOrAddLim( pStrs, Vec_StrLimit(vBuf), Vec_StrLimit(vBuf) + nAdded, NULL );
246}
247
248// parsing slice/concatentation/box
249static inline int Prs_NtkAddSlice( Prs_Ntk_t * p, int Name, int Range )
250{
251 int Value = Vec_IntSize(&p->vSlices);
252 Vec_IntPushTwo( &p->vSlices, Name, Range );
253 return Value;
254}
255static inline int Prs_NtkAddConcat( Prs_Ntk_t * p, Vec_Int_t * vTemp )
256{
257 int Value;
258 if ( !(Vec_IntSize(&p->vConcats) & 1) )
259 Vec_IntPush(&p->vConcats, -1);
260 Value = Vec_IntSize(&p->vConcats);
261 assert( Value & 1 );
262 Vec_IntPush( &p->vConcats, Vec_IntSize(vTemp) );
263 Vec_IntAppend( &p->vConcats, vTemp );
264 return Value;
265}
266static inline void Prs_NtkAddBox( Prs_Ntk_t * p, int ModName, int InstName, Vec_Int_t * vTemp )
267{
268 int Value;
269 assert( Vec_IntSize(vTemp) % 2 == 0 );
270 if ( !(Vec_IntSize(&p->vBoxes) & 1) )
271 Vec_IntPush(&p->vBoxes, -1);
272 Value = Vec_IntSize(&p->vBoxes);
273 assert( Value & 1 );
274 Vec_IntPush( &p->vObjs, Value );
275 // create entry
276 Vec_IntPush( &p->vBoxes, Vec_IntSize(vTemp)+2 );
277 Vec_IntPush( &p->vBoxes, ModName );
278 Vec_IntPush( &p->vBoxes, InstName );
279 Vec_IntAppend( &p->vBoxes, vTemp );
280}
281static inline char * Prs_ManLoadFile( char * pFileName, char ** ppLimit )
282{
283 char * pBuffer;
284 int nFileSize, RetValue;
285 FILE * pFile = fopen( pFileName, "rb" );
286 if ( pFile == NULL )
287 {
288 printf( "Cannot open input file.\n" );
289 return NULL;
290 }
291 // get the file size, in bytes
292 fseek( pFile, 0, SEEK_END );
293 nFileSize = ftell( pFile );
294 // move the file current reading position to the beginning
295 rewind( pFile );
296 // load the contents of the file into memory
297 pBuffer = ABC_ALLOC( char, nFileSize + 16 );
298 pBuffer[0] = '\n';
299 RetValue = fread( pBuffer+1, nFileSize, 1, pFile );
300 fclose( pFile );
301 // terminate the string with '\0'
302 pBuffer[nFileSize + 1] = '\n';
303 pBuffer[nFileSize + 2] = '\0';
304 *ppLimit = pBuffer + nFileSize + 3;
305 return pBuffer;
306}
307static inline Prs_Man_t * Prs_ManAlloc( char * pFileName )
308{
309 Prs_Man_t * p;
310 p = ABC_CALLOC( Prs_Man_t, 1 );
311 if ( pFileName )
312 {
313 char * pBuffer, * pLimit;
314 pBuffer = Prs_ManLoadFile( pFileName, &pLimit );
315 if ( pBuffer == NULL )
316 return NULL;
317 p->pName = pFileName;
318 p->pBuffer = pBuffer;
319 p->pLimit = pLimit;
320 p->pCur = pBuffer;
321 }
322 p->pStrs = Abc_NamStart( 1000, 24 );
323 p->pFuns = Abc_NamStart( 100, 24 );
324 p->vHash = Hash_IntManStart( 1000 );
325 p->vNtks = Vec_PtrAlloc( 100 );
326 return p;
327}
328
329static inline void Prs_NtkFree( Prs_Ntk_t * p )
330{
331 if ( p->pStrs ) Abc_NamDeref( p->pStrs );
332 if ( p->pFuns ) Abc_NamDeref( p->pFuns );
333 if ( p->vHash ) Hash_IntManDeref( p->vHash );
334 Vec_IntErase( &p->vOrder );
335 Vec_IntErase( &p->vInouts );
336 Vec_IntErase( &p->vInputs );
337 Vec_IntErase( &p->vOutputs );
338 Vec_IntErase( &p->vWires );
339 Vec_IntErase( &p->vInoutsR );
340 Vec_IntErase( &p->vInputsR );
341 Vec_IntErase( &p->vOutputsR );
342 Vec_IntErase( &p->vWiresR );
343 Vec_IntErase( &p->vSlices );
344 Vec_IntErase( &p->vConcats );
345 Vec_IntErase( &p->vBoxes );
346 Vec_IntErase( &p->vObjs );
347 ABC_FREE( p );
348}
349
350static inline void Prs_ManVecFree( Vec_Ptr_t * vPrs )
351{
352 Prs_Ntk_t * pNtk; int i;
353 Vec_PtrForEachEntry( Prs_Ntk_t *, vPrs, pNtk, i )
354 Prs_NtkFree( pNtk );
355 Vec_PtrFree( vPrs );
356}
357
358static inline void Prs_ManFree( Prs_Man_t * p )
359{
360 if ( p->pStrs ) Abc_NamDeref( p->pStrs );
361 if ( p->pFuns ) Abc_NamDeref( p->pFuns );
362 if ( p->vHash ) Hash_IntManDeref( p->vHash );
363 if ( p->vNtks ) Prs_ManVecFree( p->vNtks );
364 // temporary
365 Vec_StrErase( &p->vCover );
366 Vec_IntErase( &p->vTemp );
367 Vec_IntErase( &p->vTemp2 );
368 Vec_IntErase( &p->vTemp3 );
369 Vec_IntErase( &p->vTemp4 );
370 Vec_IntErase( &p->vKnown );
371 Vec_IntErase( &p->vFailed );
372 Vec_IntErase( &p->vSucceeded );
373 ABC_FREE( p->pBuffer );
374 ABC_FREE( p );
375}
376
377static inline int Prs_NtkMemory( Prs_Ntk_t * p )
378{
379 int nMem = sizeof(Prs_Ntk_t);
380 nMem += Vec_IntMemory( &p->vOrder );
381 nMem += Vec_IntMemory( &p->vInouts );
382 nMem += Vec_IntMemory( &p->vInputs );
383 nMem += Vec_IntMemory( &p->vOutputs );
384 nMem += Vec_IntMemory( &p->vWires );
385 nMem += Vec_IntMemory( &p->vInoutsR );
386 nMem += Vec_IntMemory( &p->vInputsR );
387 nMem += Vec_IntMemory( &p->vOutputsR );
388 nMem += Vec_IntMemory( &p->vWiresR );
389 nMem += Vec_IntMemory( &p->vSlices );
390 nMem += Vec_IntMemory( &p->vBoxes );
391 nMem += Vec_IntMemory( &p->vConcats );
392 return nMem;
393}
394static inline int Prs_ManMemory( Vec_Ptr_t * vPrs )
395{
396 Prs_Ntk_t * pNtk; int i;
397 int nMem = Vec_PtrMemory(vPrs);
398 Vec_PtrForEachEntry( Prs_Ntk_t *, vPrs, pNtk, i )
399 nMem += Prs_NtkMemory( pNtk );
400 nMem += Abc_NamMemUsed(Prs_ManNameMan(vPrs));
401 return nMem;
402}
403
404
416static inline Cba_ObjType_t Ptr_SopToType( char * pSop )
417{
418 if ( !strcmp(pSop, " 0\n") ) return CBA_BOX_CF;
419 if ( !strcmp(pSop, " 1\n") ) return CBA_BOX_CT;
420 if ( !strcmp(pSop, "1 1\n") ) return CBA_BOX_BUF;
421 if ( !strcmp(pSop, "0 1\n") ) return CBA_BOX_INV;
422 if ( !strcmp(pSop, "11 1\n") ) return CBA_BOX_AND;
423 if ( !strcmp(pSop, "00 1\n") ) return CBA_BOX_NOR;
424 if ( !strcmp(pSop, "00 0\n") ) return CBA_BOX_OR;
425 if ( !strcmp(pSop, "-1 1\n1- 1\n") ) return CBA_BOX_OR;
426 if ( !strcmp(pSop, "1- 1\n-1 1\n") ) return CBA_BOX_OR;
427 if ( !strcmp(pSop, "01 1\n10 1\n") ) return CBA_BOX_XOR;
428 if ( !strcmp(pSop, "10 1\n01 1\n") ) return CBA_BOX_XOR;
429 if ( !strcmp(pSop, "11 1\n00 1\n") ) return CBA_BOX_XNOR;
430 if ( !strcmp(pSop, "00 1\n11 1\n") ) return CBA_BOX_XNOR;
431 if ( !strcmp(pSop, "10 1\n") ) return CBA_BOX_SHARP;
432 if ( !strcmp(pSop, "01 1\n") ) return CBA_BOX_SHARPL;
433 assert( 0 );
434 return CBA_OBJ_NONE;
435}
436static inline char * Ptr_SopToTypeName( char * pSop )
437{
438 if ( !strcmp(pSop, " 0\n") ) return "CBA_BOX_C0";
439 if ( !strcmp(pSop, " 1\n") ) return "CBA_BOX_C1";
440 if ( !strcmp(pSop, "1 1\n") ) return "CBA_BOX_BUF";
441 if ( !strcmp(pSop, "0 1\n") ) return "CBA_BOX_INV";
442 if ( !strcmp(pSop, "11 1\n") ) return "CBA_BOX_AND";
443 if ( !strcmp(pSop, "00 1\n") ) return "CBA_BOX_NOR";
444 if ( !strcmp(pSop, "00 0\n") ) return "CBA_BOX_OR";
445 if ( !strcmp(pSop, "-1 1\n1- 1\n") ) return "CBA_BOX_OR";
446 if ( !strcmp(pSop, "1- 1\n-1 1\n") ) return "CBA_BOX_OR";
447 if ( !strcmp(pSop, "01 1\n10 1\n") ) return "CBA_BOX_XOR";
448 if ( !strcmp(pSop, "10 1\n01 1\n") ) return "CBA_BOX_XOR";
449 if ( !strcmp(pSop, "11 1\n00 1\n") ) return "CBA_BOX_XNOR";
450 if ( !strcmp(pSop, "00 1\n11 1\n") ) return "CBA_BOX_XNOR";
451 if ( !strcmp(pSop, "10 1\n") ) return "CBA_BOX_SHARP";
452 if ( !strcmp(pSop, "01 1\n") ) return "CBA_BOX_SHARPL";
453 assert( 0 );
454 return NULL;
455}
456static inline char * Ptr_TypeToName( Cba_ObjType_t Type )
457{
458 if ( Type == CBA_BOX_CF ) return "const0";
459 if ( Type == CBA_BOX_CT ) return "const1";
460 if ( Type == CBA_BOX_CX ) return "constX";
461 if ( Type == CBA_BOX_CZ ) return "constZ";
462 if ( Type == CBA_BOX_BUF ) return "buf";
463 if ( Type == CBA_BOX_INV ) return "not";
464 if ( Type == CBA_BOX_AND ) return "and";
465 if ( Type == CBA_BOX_NAND ) return "nand";
466 if ( Type == CBA_BOX_OR ) return "or";
467 if ( Type == CBA_BOX_NOR ) return "nor";
468 if ( Type == CBA_BOX_XOR ) return "xor";
469 if ( Type == CBA_BOX_XNOR ) return "xnor";
470 if ( Type == CBA_BOX_MUX ) return "mux";
471 if ( Type == CBA_BOX_MAJ ) return "maj";
472 if ( Type == CBA_BOX_SHARP ) return "sharp";
473 if ( Type == CBA_BOX_SHARPL) return "sharpl";
474 if ( Type == CBA_BOX_TRI) return "bufifl";
475 assert( 0 );
476 return "???";
477}
478static inline char * Ptr_TypeToSop( Cba_ObjType_t Type )
479{
480 if ( Type == CBA_BOX_CF ) return " 0\n";
481 if ( Type == CBA_BOX_CT ) return " 1\n";
482 if ( Type == CBA_BOX_CX ) return " 0\n";
483 if ( Type == CBA_BOX_CZ ) return " 0\n";
484 if ( Type == CBA_BOX_BUF ) return "1 1\n";
485 if ( Type == CBA_BOX_INV ) return "0 1\n";
486 if ( Type == CBA_BOX_AND ) return "11 1\n";
487 if ( Type == CBA_BOX_NAND ) return "11 0\n";
488 if ( Type == CBA_BOX_OR ) return "00 0\n";
489 if ( Type == CBA_BOX_NOR ) return "00 1\n";
490 if ( Type == CBA_BOX_XOR ) return "01 1\n10 1\n";
491 if ( Type == CBA_BOX_XNOR ) return "00 1\n11 1\n";
492 if ( Type == CBA_BOX_SHARP ) return "10 1\n";
493 if ( Type == CBA_BOX_SHARPL) return "01 1\n";
494 if ( Type == CBA_BOX_MUX ) return "11- 1\n0-1 1\n";
495 if ( Type == CBA_BOX_MAJ ) return "11- 1\n1-1 1\n-11 1\n";
496 assert( 0 );
497 return "???";
498}
499
500
504
508
509/*=== cbaReadVer.c ========================================================*/
511
512
514
515#endif
516
520
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define ABC_FREE(obj)
Definition abc_global.h:267
#define ABC_NAMESPACE_HEADER_END
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
@ PRS_VER_INPUT
Definition bacReadVer.c:33
@ PRS_VER_ENDMODULE
Definition bacReadVer.c:44
@ PRS_VER_UNKNOWN
Definition bacReadVer.c:45
@ PRS_VER_END
Definition bacReadVer.c:43
@ PRS_VER_ASSIGN
Definition bacReadVer.c:38
@ PRS_VER_OUTPUT
Definition bacReadVer.c:34
@ PRS_VER_DEFPARAM
Definition bacReadVer.c:41
@ PRS_VER_INOUT
Definition bacReadVer.c:35
@ PRS_VER_REG
Definition bacReadVer.c:39
@ PRS_VER_BEGIN
Definition bacReadVer.c:42
@ PRS_VER_WIRE
Definition bacReadVer.c:36
@ PRS_VER_MODULE
Definition bacReadVer.c:37
@ PRS_VER_ALWAYS
Definition bacReadVer.c:40
@ PRS_VER_NONE
Definition bacReadVer.c:32
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46
Cba_VerType_t
INCLUDES ///.
Definition cbaPrs.h:39
@ PRS_VER_ENDCASE
Definition cbaPrs.h:54
@ PRS_VER_CASE
Definition cbaPrs.h:53
@ PRS_VER_FUNCTION
Definition cbaPrs.h:49
@ PRS_VER_SIGNED
Definition cbaPrs.h:55
struct Prs_Man_t_ Prs_Man_t
Definition cbaPrs.h:107
Prs_ManType_t
Definition cbaPrs.h:61
@ CBA_PRS_SLICE
Definition cbaPrs.h:63
@ CBA_PRS_CONST
Definition cbaPrs.h:64
@ CBA_PRS_CONCAT
Definition cbaPrs.h:65
@ CBA_PRS_NAME
Definition cbaPrs.h:62
struct Prs_Ntk_t_ Prs_Ntk_t
BASIC TYPES ///.
Definition cbaPrs.h:73
void Prs_NtkAddVerilogDirectives(Prs_Man_t *p)
ITERATORS ///.
Definition cbaReadVer.c:51
Cba_ObjType_t
INCLUDES ///.
Definition cbaTypes.h:39
@ CBA_BOX_INV
Definition cbaTypes.h:51
@ CBA_BOX_NOR
Definition cbaTypes.h:55
@ CBA_BOX_XNOR
Definition cbaTypes.h:57
@ CBA_BOX_SHARP
Definition cbaTypes.h:58
@ CBA_BOX_BUF
Definition cbaTypes.h:50
@ CBA_BOX_CX
Definition cbaTypes.h:47
@ CBA_BOX_CZ
Definition cbaTypes.h:48
@ CBA_BOX_NAND
Definition cbaTypes.h:53
@ CBA_BOX_MUX
Definition cbaTypes.h:60
@ CBA_BOX_SHARPL
Definition cbaTypes.h:59
@ CBA_BOX_TRI
Definition cbaTypes.h:126
@ CBA_BOX_AND
Definition cbaTypes.h:52
@ CBA_BOX_CF
Definition cbaTypes.h:45
@ CBA_OBJ_NONE
Definition cbaTypes.h:40
@ CBA_BOX_OR
Definition cbaTypes.h:54
@ CBA_BOX_CT
Definition cbaTypes.h:46
@ CBA_BOX_MAJ
Definition cbaTypes.h:61
@ CBA_BOX_XOR
Definition cbaTypes.h:56
Cube * p
Definition exorList.c:222
Vec_Str_t vCover
Definition cbaPrs.h:121
int FuncRangeId
Definition cbaPrs.h:134
Abc_Nam_t * pFuns
Definition cbaPrs.h:116
Vec_Int_t vKnown
Definition cbaPrs.h:127
int nOpens
Definition cbaPrs.h:131
Vec_Int_t vTemp2
Definition cbaPrs.h:123
Hash_IntMan_t * vHash
Definition cbaPrs.h:117
Vec_Int_t vTemp
Definition cbaPrs.h:122
char * pCur
Definition cbaPrs.h:114
char * pName
Definition cbaPrs.h:111
Vec_Int_t vSucceeded
Definition cbaPrs.h:129
char * pBuffer
Definition cbaPrs.h:112
int fUsingTemp2
Definition cbaPrs.h:132
Vec_Int_t vTemp3
Definition cbaPrs.h:124
char * pLimit
Definition cbaPrs.h:113
Vec_Int_t vTemp4
Definition cbaPrs.h:125
Prs_Ntk_t * pNtk
Definition cbaPrs.h:118
Vec_Int_t vFailed
Definition cbaPrs.h:128
char ErrorStr[1000]
Definition cbaPrs.h:135
Vec_Ptr_t * vNtks
Definition cbaPrs.h:119
Abc_Nam_t * pStrs
Definition cbaPrs.h:115
int FuncNameId
Definition cbaPrs.h:133
Vec_Int_t vInputsR
Definition cbaPrs.h:96
Vec_Int_t vWires
Definition cbaPrs.h:93
int iModuleName
Definition cbaPrs.h:77
Vec_Int_t vOutputs
Definition cbaPrs.h:92
Vec_Int_t vInoutsR
Definition cbaPrs.h:95
Abc_Nam_t * pStrs
Definition cbaPrs.h:84
Abc_Nam_t * pFuns
Definition cbaPrs.h:85
Vec_Int_t vWiresR
Definition cbaPrs.h:98
unsigned fMapped
Definition cbaPrs.h:78
unsigned fHasCXs
Definition cbaPrs.h:82
Vec_Int_t vConcats
Definition cbaPrs.h:101
Vec_Int_t vOrder
Definition cbaPrs.h:88
Vec_Int_t vOutputsR
Definition cbaPrs.h:97
unsigned fSlices
Definition cbaPrs.h:79
unsigned fHasC1s
Definition cbaPrs.h:81
Vec_Int_t vInouts
Definition cbaPrs.h:90
Vec_Int_t vSlices
Definition cbaPrs.h:100
unsigned fHasC0s
Definition cbaPrs.h:80
Vec_Int_t vBoxes
Definition cbaPrs.h:102
Hash_IntMan_t * vHash
Definition cbaPrs.h:86
Vec_Int_t vObjs
Definition cbaPrs.h:103
Vec_Int_t vInputs
Definition cbaPrs.h:91
unsigned fHasCZs
Definition cbaPrs.h:83
int Abc_NamStrFindOrAddLim(Abc_Nam_t *p, char *pStr, char *pLim, int *pfFound)
Definition utilNam.c:492
int Abc_NamMemUsed(Abc_Nam_t *p)
Definition utilNam.c:247
Abc_Nam_t * Abc_NamStart(int nObjs, int nAveSize)
FUNCTION DEFINITIONS ///.
Definition utilNam.c:80
Vec_Str_t * Abc_NamBuffer(Abc_Nam_t *p)
Definition utilNam.c:571
void Abc_NamDeref(Abc_Nam_t *p)
Definition utilNam.c:212
Abc_Nam_t * Abc_NamRef(Abc_Nam_t *p)
Definition utilNam.c:195
char * Abc_NamStr(Abc_Nam_t *p, int NameId)
Definition utilNam.c:555
typedefABC_NAMESPACE_HEADER_START struct Abc_Nam_t_ Abc_Nam_t
INCLUDES ///.
Definition utilNam.h:39
#define assert(ex)
Definition util_old.h:213
int strcmp()
char * sprintf()
VOID_HACK rewind()
struct Hash_IntMan_t_ Hash_IntMan_t
Definition vecHash.h:51
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
#define SEEK_END
Definition zconf.h:392