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

Go to the source code of this file.

Functions

static ABC_NAMESPACE_IMPL_START int Cba_CommandRead (Abc_Frame_t *pAbc, int argc, char **argv)
 DECLARATIONS ///. More...
 
static int Cba_CommandWrite (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Cba_CommandPs (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Cba_CommandBlast (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Cba_CommandTest (Abc_Frame_t *pAbc, int argc, char **argv)
 
static Cba_Ntk_tCba_AbcGetNtk (Abc_Frame_t *pAbc)
 
static void Cba_AbcFreeNtk (Abc_Frame_t *pAbc)
 
static void Cba_AbcUpdateNtk (Abc_Frame_t *pAbc, Cba_Ntk_t *pNtk)
 
void Cba_Init (Abc_Frame_t *pAbc)
 FUNCTION DEFINITIONS ///. More...
 
void Cba_End (Abc_Frame_t *pAbc)
 

Function Documentation

static void Cba_AbcFreeNtk ( Abc_Frame_t pAbc)
inlinestatic

Definition at line 37 of file cbaCom.c.

37 { if ( pAbc->pAbcCba ) Cba_NtkFree(Cba_AbcGetNtk(pAbc)); }
static Cba_Ntk_t * Cba_AbcGetNtk(Abc_Frame_t *pAbc)
Definition: cbaCom.c:36
static void Cba_NtkFree(Cba_Ntk_t *p)
Definition: cba.h:176
static Cba_Ntk_t* Cba_AbcGetNtk ( Abc_Frame_t pAbc)
inlinestatic

Definition at line 36 of file cbaCom.c.

36 { return (Cba_Ntk_t *)pAbc->pAbcCba; }
Definition: cba.h:99
static void Cba_AbcUpdateNtk ( Abc_Frame_t pAbc,
Cba_Ntk_t pNtk 
)
inlinestatic

Definition at line 38 of file cbaCom.c.

38 { Cba_AbcFreeNtk(pAbc); pAbc->pAbcCba = pNtk; }
static void Cba_AbcFreeNtk(Abc_Frame_t *pAbc)
Definition: cbaCom.c:37
int Cba_CommandBlast ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 251 of file cbaCom.c.

252 {
253  Cba_Ntk_t * pNtk = Cba_AbcGetNtk(pAbc);
254  //Vec_Int_t * vBoxIds = NULL;
255  Gia_Man_t * pNew = NULL;
256  int c, fMulti = 0, fVerbose = 0;
258  while ( ( c = Extra_UtilGetopt( argc, argv, "mvh" ) ) != EOF )
259  {
260  switch ( c )
261  {
262  case 'm':
263  fMulti ^= 1;
264  break;
265  case 'v':
266  fVerbose ^= 1;
267  break;
268  case 'h':
269  goto usage;
270  default:
271  goto usage;
272  }
273  }
274  if ( pNtk == NULL )
275  {
276  Abc_Print( 1, "Cba_CommandBlast(): There is no current design.\n" );
277  return 0;
278  }
279  if ( fMulti )
280  {
281 // vBoxIds = Cba_NtkCollectMultipliers( pNtk );
282 // if ( vBoxIds == NULL )
283 // Abc_Print( 1, "Warning: There is no multipliers in the design.\n" );
284  }
285  // transform
286 // pNew = Cba_NtkBitBlast( pNtk, vBoxIds );
287 // Vec_IntFreeP( &vBoxIds );
288  if ( pNew == NULL )
289  {
290  Abc_Print( 1, "Cba_CommandBlast(): Bit-blasting has failed.\n" );
291  return 0;
292  }
293  Abc_FrameUpdateGia( pAbc, pNew );
294  return 0;
295 usage:
296  Abc_Print( -2, "usage: @blast [-mvh]\n" );
297  Abc_Print( -2, "\t performs bit-blasting of the word-level design\n" );
298  Abc_Print( -2, "\t-m : toggle creating boxes for all multipliers in the design [default = %s]\n", fMulti? "yes": "no" );
299  Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
300  Abc_Print( -2, "\t-h : print the command usage\n");
301  return 1;
302 }
Definition: cba.h:99
static Cba_Ntk_t * Cba_AbcGetNtk(Abc_Frame_t *pAbc)
Definition: cbaCom.c:36
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
Definition: gia.h:95
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
void Abc_FrameUpdateGia(Abc_Frame_t *pAbc, Gia_Man_t *pNew)
Definition: abc.c:616
int Cba_CommandPs ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 207 of file cbaCom.c.

208 {
209  Cba_Ntk_t * pNtk = Cba_AbcGetNtk(pAbc);
210  int c, fVerbose = 0;
212  while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
213  {
214  switch ( c )
215  {
216  case 'v':
217  fVerbose ^= 1;
218  break;
219  case 'h':
220  goto usage;
221  default:
222  goto usage;
223  }
224  }
225  if ( pNtk == NULL )
226  {
227  Abc_Print( 1, "Cba_CommandPs(): There is no current design.\n" );
228  return 0;
229  }
230 // Cba_NtkPrintStats( pNtk, fDistrib, fVerbose );
231  return 0;
232 usage:
233  Abc_Print( -2, "usage: @ps [-vh]\n" );
234  Abc_Print( -2, "\t prints statistics\n" );
235  Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
236  Abc_Print( -2, "\t-h : print the command usage\n");
237  return 1;
238 }
Definition: cba.h:99
static Cba_Ntk_t * Cba_AbcGetNtk(Abc_Frame_t *pAbc)
Definition: cbaCom.c:36
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
int Cba_CommandRead ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

DECLARATIONS ///.

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

FileName [cbaCom.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Verilog parser.]

Synopsis [Parses several flavors of word-level Verilog.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id:
cbaCom.c,v 1.00 2014/11/29 00:00:00 alanmi Exp

]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 92 of file cbaCom.c.

93 {
94  FILE * pFile;
95  Cba_Ntk_t * pNtk = NULL;
96  char * pFileName = NULL;
97  int c, fVerbose = 0;
99  while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
100  {
101  switch ( c )
102  {
103  case 'v':
104  fVerbose ^= 1;
105  break;
106  case 'h':
107  goto usage;
108  default:
109  goto usage;
110  }
111  }
112  if ( argc != globalUtilOptind + 1 )
113  {
114  printf( "Cba_CommandRead(): Input file name should be given on the command line.\n" );
115  return 0;
116  }
117  // get the file name
118  pFileName = argv[globalUtilOptind];
119  if ( (pFile = fopen( pFileName, "r" )) == NULL )
120  {
121  Abc_Print( 1, "Cannot open input file \"%s\". ", pFileName );
122  if ( (pFileName = Extra_FileGetSimilarName( pFileName, ".v", ".blif", NULL, NULL, NULL )) )
123  Abc_Print( 1, "Did you mean \"%s\"?", pFileName );
124  Abc_Print( 1, "\n" );
125  return 0;
126  }
127  fclose( pFile );
128 
129  // perform reading
130  //pNtk = Cba_ReadVer( pFileName );
131  Cba_AbcUpdateNtk( pAbc, pNtk );
132  return 0;
133 usage:
134  Abc_Print( -2, "usage: @read [-vh] <file_name>\n" );
135  Abc_Print( -2, "\t reads word-level design from Verilog file\n" );
136  Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
137  Abc_Print( -2, "\t-h : print the command usage\n");
138  return 1;
139 }
Definition: cba.h:99
char * Extra_FileGetSimilarName(char *pFileNameWrong, char *pS1, char *pS2, char *pS3, char *pS4, char *pS5)
Definition: extraUtilFile.c:71
static void Cba_AbcUpdateNtk(Abc_Frame_t *pAbc, Cba_Ntk_t *pNtk)
Definition: cbaCom.c:38
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
int globalUtilOptind
Definition: extraUtilUtil.c:45
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
int Cba_CommandTest ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 315 of file cbaCom.c.

316 {
317  Cba_Ntk_t * pNtk = Cba_AbcGetNtk(pAbc);
318  int c, fVerbose = 0;
320  while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
321  {
322  switch ( c )
323  {
324  case 'v':
325  fVerbose ^= 1;
326  break;
327  case 'h':
328  goto usage;
329  default:
330  goto usage;
331  }
332  }
333  if ( pNtk == NULL )
334  {
335  Abc_Print( 1, "Cba_CommandTest(): There is no current design.\n" );
336  return 0;
337  }
338  // transform
339 // pNtk = Cba_NtkUifNodePairs( pNtk, NULL );
340  Cba_AbcUpdateNtk( pAbc, pNtk );
341  return 0;
342 usage:
343  Abc_Print( -2, "usage: @test [-vh]\n" );
344  Abc_Print( -2, "\t experiments with word-level networks\n" );
345  Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
346  Abc_Print( -2, "\t-h : print the command usage\n");
347  return 1;
348 }
Definition: cba.h:99
static Cba_Ntk_t * Cba_AbcGetNtk(Abc_Frame_t *pAbc)
Definition: cbaCom.c:36
static void Cba_AbcUpdateNtk(Abc_Frame_t *pAbc, Cba_Ntk_t *pNtk)
Definition: cbaCom.c:38
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
int Cba_CommandWrite ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 152 of file cbaCom.c.

153 {
154  Cba_Ntk_t * pNtk = Cba_AbcGetNtk(pAbc);
155  char * pFileName = NULL;
156  int c, fVerbose = 0;
158  while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
159  {
160  switch ( c )
161  {
162  case 'v':
163  fVerbose ^= 1;
164  break;
165  case 'h':
166  goto usage;
167  default:
168  goto usage;
169  }
170  }
171  if ( pNtk == NULL )
172  {
173  Abc_Print( 1, "Cba_CommandWrite(): There is no current design.\n" );
174  return 0;
175  }
176  if ( argc == globalUtilOptind )
177  pFileName = Extra_FileNameGenericAppend( pNtk->pName, "_out.v" );
178  else if ( argc == globalUtilOptind + 1 )
179  pFileName = argv[globalUtilOptind];
180  else
181  {
182  printf( "Output file name should be given on the command line.\n" );
183  return 0;
184  }
185  //Cba_WriteVer( pNtk, pFileName );
186  return 0;
187 usage:
188  Abc_Print( -2, "usage: @write [-vh]\n" );
189  Abc_Print( -2, "\t writes the design into a file\n" );
190  Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
191  Abc_Print( -2, "\t-h : print the command usage\n");
192  return 1;
193 }
Definition: cba.h:99
static Cba_Ntk_t * Cba_AbcGetNtk(Abc_Frame_t *pAbc)
Definition: cbaCom.c:36
char * pName
Definition: cba.h:101
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
int globalUtilOptind
Definition: extraUtilUtil.c:45
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
void Cba_End ( Abc_Frame_t pAbc)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 75 of file cbaCom.c.

76 {
77  Cba_AbcFreeNtk( pAbc );
78 }
static void Cba_AbcFreeNtk(Abc_Frame_t *pAbc)
Definition: cbaCom.c:37
void Cba_Init ( Abc_Frame_t pAbc)

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 55 of file cbaCom.c.

56 {
57  Cmd_CommandAdd( pAbc, "New word level", "@read", Cba_CommandRead, 0 );
58  Cmd_CommandAdd( pAbc, "New word level", "@write", Cba_CommandWrite, 0 );
59  Cmd_CommandAdd( pAbc, "New word level", "@ps", Cba_CommandPs, 0 );
60  Cmd_CommandAdd( pAbc, "New word level", "@blast", Cba_CommandBlast, 0 );
61  Cmd_CommandAdd( pAbc, "New word level", "@test", Cba_CommandTest, 0 );
62 }
static ABC_NAMESPACE_IMPL_START int Cba_CommandRead(Abc_Frame_t *pAbc, int argc, char **argv)
DECLARATIONS ///.
Definition: cbaCom.c:92
void Cmd_CommandAdd(Abc_Frame_t *pAbc, const char *sGroup, const char *sName, Cmd_CommandFuncType pFunc, int fChanges)
Definition: cmdApi.c:63
static int Cba_CommandBlast(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: cbaCom.c:251
static int Cba_CommandTest(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: cbaCom.c:315
static int Cba_CommandPs(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: cbaCom.c:207
static int Cba_CommandWrite(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: cbaCom.c:152