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

Go to the source code of this file.

Functions

static ABC_NAMESPACE_IMPL_START int Abc_CommandReadVer (Abc_Frame_t *pAbc, int argc, char **argv)
 DECLARATIONS ///. More...
 
static int Abc_CommandWriteVer (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Abc_CommandPs (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Abc_CommandBlast (Abc_Frame_t *pAbc, int argc, char **argv)
 
static int Abc_CommandTest (Abc_Frame_t *pAbc, int argc, char **argv)
 
static Wlc_Ntk_tWlc_AbcGetNtk (Abc_Frame_t *pAbc)
 
static void Wlc_AbcFreeNtk (Abc_Frame_t *pAbc)
 
static void Wlc_AbcUpdateNtk (Abc_Frame_t *pAbc, Wlc_Ntk_t *pNtk)
 
void Wlc_Init (Abc_Frame_t *pAbc)
 FUNCTION DEFINITIONS ///. More...
 
void Wlc_End (Abc_Frame_t *pAbc)
 

Function Documentation

int Abc_CommandBlast ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 271 of file wlcCom.c.

272 {
273  Wlc_Ntk_t * pNtk = Wlc_AbcGetNtk(pAbc);
274  Vec_Int_t * vBoxIds = NULL;
275  Gia_Man_t * pNew = NULL;
276  int c, fMulti = 0, fVerbose = 0;
278  while ( ( c = Extra_UtilGetopt( argc, argv, "mvh" ) ) != EOF )
279  {
280  switch ( c )
281  {
282  case 'm':
283  fMulti ^= 1;
284  break;
285  case 'v':
286  fVerbose ^= 1;
287  break;
288  case 'h':
289  goto usage;
290  default:
291  goto usage;
292  }
293  }
294  if ( pNtk == NULL )
295  {
296  Abc_Print( 1, "Abc_CommandBlast(): There is no current design.\n" );
297  return 0;
298  }
299  if ( fMulti )
300  {
301  vBoxIds = Wlc_NtkCollectMultipliers( pNtk );
302  if ( vBoxIds == NULL )
303  Abc_Print( 1, "Warning: There is no multipliers in the design.\n" );
304  }
305  // transform
306  pNew = Wlc_NtkBitBlast( pNtk, vBoxIds );
307  Vec_IntFreeP( &vBoxIds );
308  if ( pNew == NULL )
309  {
310  Abc_Print( 1, "Abc_CommandBlast(): Bit-blasting has failed.\n" );
311  return 0;
312  }
313  Abc_FrameUpdateGia( pAbc, pNew );
314  return 0;
315 usage:
316  Abc_Print( -2, "usage: %%blast [-mvh]\n" );
317  Abc_Print( -2, "\t performs bit-blasting of the word-level design\n" );
318  Abc_Print( -2, "\t-m : toggle creating boxes for all multipliers in the design [default = %s]\n", fMulti? "yes": "no" );
319  Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
320  Abc_Print( -2, "\t-h : print the command usage\n");
321  return 1;
322 }
Vec_Int_t * Wlc_NtkCollectMultipliers(Wlc_Ntk_t *p)
Definition: wlcAbs.c:76
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
Gia_Man_t * Wlc_NtkBitBlast(Wlc_Ntk_t *p, Vec_Int_t *vBoxIds)
Definition: wlcBlast.c:405
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
static Wlc_Ntk_t * Wlc_AbcGetNtk(Abc_Frame_t *pAbc)
Definition: wlcCom.c:37
int Abc_CommandPs ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 208 of file wlcCom.c.

209 {
210  Wlc_Ntk_t * pNtk = Wlc_AbcGetNtk(pAbc);
211  int fShowMulti = 0;
212  int fShowAdder = 0;
213  int fDistrib = 0;
214  int c, fVerbose = 0;
216  while ( ( c = Extra_UtilGetopt( argc, argv, "madvh" ) ) != EOF )
217  {
218  switch ( c )
219  {
220  case 'm':
221  fShowMulti ^= 1;
222  break;
223  case 'a':
224  fShowAdder ^= 1;
225  break;
226  case 'd':
227  fDistrib ^= 1;
228  break;
229  case 'v':
230  fVerbose ^= 1;
231  break;
232  case 'h':
233  goto usage;
234  default:
235  goto usage;
236  }
237  }
238  if ( pNtk == NULL )
239  {
240  Abc_Print( 1, "Abc_CommandPs(): There is no current design.\n" );
241  return 0;
242  }
243  Wlc_NtkPrintStats( pNtk, fDistrib, fVerbose );
244  if ( fShowMulti )
246  if ( fShowAdder )
248  return 0;
249 usage:
250  Abc_Print( -2, "usage: %%ps [-madvh]\n" );
251  Abc_Print( -2, "\t prints statistics\n" );
252  Abc_Print( -2, "\t-m : toggle printing multipliers [default = %s]\n", fShowMulti? "yes": "no" );
253  Abc_Print( -2, "\t-a : toggle printing adders [default = %s]\n", fShowAdder? "yes": "no" );
254  Abc_Print( -2, "\t-d : toggle printing distrubition [default = %s]\n", fDistrib? "yes": "no" );
255  Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
256  Abc_Print( -2, "\t-h : print the command usage\n");
257  return 1;
258 }
void Wlc_NtkPrintStats(Wlc_Ntk_t *p, int fDistrib, int fVerbose)
Definition: wlcNtk.c:375
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
void Wlc_NtkPrintNodes(Wlc_Ntk_t *p, int Type)
Definition: wlcNtk.c:354
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
static Wlc_Ntk_t * Wlc_AbcGetNtk(Abc_Frame_t *pAbc)
Definition: wlcCom.c:37
int Abc_CommandReadVer ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

DECLARATIONS ///.

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

FileName [wlcCom.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Verilog parser.]

Synopsis [Command handlers.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - August 22, 2014.]

Revision [

Id:
wlcCom.c,v 1.00 2014/09/12 00:00:00 alanmi Exp

]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 93 of file wlcCom.c.

94 {
95  FILE * pFile;
96  Wlc_Ntk_t * pNtk = NULL;
97  char * pFileName = NULL;
98  int c, fVerbose = 0;
100  while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
101  {
102  switch ( c )
103  {
104  case 'v':
105  fVerbose ^= 1;
106  break;
107  case 'h':
108  goto usage;
109  default:
110  goto usage;
111  }
112  }
113  if ( argc != globalUtilOptind + 1 )
114  {
115  printf( "Abc_CommandReadVer(): Input file name should be given on the command line.\n" );
116  return 0;
117  }
118  // get the file name
119  pFileName = argv[globalUtilOptind];
120  if ( (pFile = fopen( pFileName, "r" )) == NULL )
121  {
122  Abc_Print( 1, "Cannot open input file \"%s\". ", pFileName );
123  if ( (pFileName = Extra_FileGetSimilarName( pFileName, ".v", ".smt", NULL, NULL, NULL )) )
124  Abc_Print( 1, "Did you mean \"%s\"?", pFileName );
125  Abc_Print( 1, "\n" );
126  return 0;
127  }
128  fclose( pFile );
129 
130  // perform reading
131  pNtk = Wlc_ReadVer( pFileName );
132  Wlc_AbcUpdateNtk( pAbc, pNtk );
133  return 0;
134 usage:
135  Abc_Print( -2, "usage: %%read_ver [-vh] <file_name>\n" );
136  Abc_Print( -2, "\t reads word-level design from Verilog file\n" );
137  Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
138  Abc_Print( -2, "\t-h : print the command usage\n");
139  return 1;
140 }
char * Extra_FileGetSimilarName(char *pFileNameWrong, char *pS1, char *pS2, char *pS3, char *pS4, char *pS5)
Definition: extraUtilFile.c:71
static void Wlc_AbcUpdateNtk(Abc_Frame_t *pAbc, Wlc_Ntk_t *pNtk)
Definition: wlcCom.c:39
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
Wlc_Ntk_t * Wlc_ReadVer(char *pFileName)
Definition: wlcReadVer.c:1080
int Abc_CommandTest ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 335 of file wlcCom.c.

336 {
337  Wlc_Ntk_t * pNtk = Wlc_AbcGetNtk(pAbc);
338  int c, fVerbose = 0;
340  while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
341  {
342  switch ( c )
343  {
344  case 'v':
345  fVerbose ^= 1;
346  break;
347  case 'h':
348  goto usage;
349  default:
350  goto usage;
351  }
352  }
353  if ( pNtk == NULL )
354  {
355  Abc_Print( 1, "Abc_CommandBlast(): There is no current design.\n" );
356  return 0;
357  }
358  // transform
359  pNtk = Wlc_NtkUifNodePairs( pNtk, NULL );
360  pNtk = Wlc_NtkAbstractNodes( pNtk, NULL );
361  Wlc_AbcUpdateNtk( pAbc, pNtk );
362  return 0;
363 usage:
364  Abc_Print( -2, "usage: %%test [-vh]\n" );
365  Abc_Print( -2, "\t experiments with word-level networks\n" );
366  Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
367  Abc_Print( -2, "\t-h : print the command usage\n");
368  return 1;
369 }
Wlc_Ntk_t * Wlc_NtkAbstractNodes(Wlc_Ntk_t *pNtk, Vec_Int_t *vNodes)
Definition: wlcAbs.c:137
static void Wlc_AbcUpdateNtk(Abc_Frame_t *pAbc, Wlc_Ntk_t *pNtk)
Definition: wlcCom.c:39
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
Wlc_Ntk_t * Wlc_NtkUifNodePairs(Wlc_Ntk_t *pNtk, Vec_Int_t *vPairs)
Definition: wlcAbs.c:192
static Wlc_Ntk_t * Wlc_AbcGetNtk(Abc_Frame_t *pAbc)
Definition: wlcCom.c:37
int Abc_CommandWriteVer ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
)
static

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 153 of file wlcCom.c.

154 {
155  Wlc_Ntk_t * pNtk = Wlc_AbcGetNtk(pAbc);
156  char * pFileName = NULL;
157  int c, fVerbose = 0;
159  while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
160  {
161  switch ( c )
162  {
163  case 'v':
164  fVerbose ^= 1;
165  break;
166  case 'h':
167  goto usage;
168  default:
169  goto usage;
170  }
171  }
172  if ( pNtk == NULL )
173  {
174  Abc_Print( 1, "Abc_CommandWriteVer(): There is no current design.\n" );
175  return 0;
176  }
177  if ( argc == globalUtilOptind )
178  pFileName = Extra_FileNameGenericAppend( pNtk->pName, "_out.v" );
179  else if ( argc == globalUtilOptind + 1 )
180  pFileName = argv[globalUtilOptind];
181  else
182  {
183  printf( "Output file name should be given on the command line.\n" );
184  return 0;
185  }
186  Wlc_WriteVer( pNtk, pFileName );
187  return 0;
188 usage:
189  Abc_Print( -2, "usage: %%write_ver [-vh]\n" );
190  Abc_Print( -2, "\t writes the design into a file\n" );
191  Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
192  Abc_Print( -2, "\t-h : print the command usage\n");
193  return 1;
194 }
void Wlc_WriteVer(Wlc_Ntk_t *p, char *pFileName)
Definition: wlcWriteVer.c:354
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
char * pName
Definition: wlc.h:117
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)
static Wlc_Ntk_t * Wlc_AbcGetNtk(Abc_Frame_t *pAbc)
Definition: wlcCom.c:37
static void Wlc_AbcFreeNtk ( Abc_Frame_t pAbc)
inlinestatic

Definition at line 38 of file wlcCom.c.

38 { if ( pAbc->pAbcWlc ) Wlc_NtkFree(Wlc_AbcGetNtk(pAbc)); }
void Wlc_NtkFree(Wlc_Ntk_t *p)
Definition: wlcNtk.c:195
static Wlc_Ntk_t * Wlc_AbcGetNtk(Abc_Frame_t *pAbc)
Definition: wlcCom.c:37
static Wlc_Ntk_t* Wlc_AbcGetNtk ( Abc_Frame_t pAbc)
inlinestatic

Definition at line 37 of file wlcCom.c.

37 { return (Wlc_Ntk_t *)pAbc->pAbcWlc; }
static void Wlc_AbcUpdateNtk ( Abc_Frame_t pAbc,
Wlc_Ntk_t pNtk 
)
inlinestatic

Definition at line 39 of file wlcCom.c.

39 { Wlc_AbcFreeNtk(pAbc); pAbc->pAbcWlc = pNtk; }
static void Wlc_AbcFreeNtk(Abc_Frame_t *pAbc)
Definition: wlcCom.c:38
void Wlc_End ( Abc_Frame_t pAbc)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 76 of file wlcCom.c.

77 {
78  Wlc_AbcFreeNtk( pAbc );
79 }
static void Wlc_AbcFreeNtk(Abc_Frame_t *pAbc)
Definition: wlcCom.c:38
void Wlc_Init ( Abc_Frame_t pAbc)

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 56 of file wlcCom.c.

57 {
58  Cmd_CommandAdd( pAbc, "Word level", "%read_ver", Abc_CommandReadVer, 0 );
59  Cmd_CommandAdd( pAbc, "Word level", "%write_ver", Abc_CommandWriteVer, 0 );
60  Cmd_CommandAdd( pAbc, "Word level", "%ps", Abc_CommandPs, 0 );
61  Cmd_CommandAdd( pAbc, "Word level", "%blast", Abc_CommandBlast, 0 );
62  Cmd_CommandAdd( pAbc, "Word level", "%test", Abc_CommandTest, 0 );
63 }
void Cmd_CommandAdd(Abc_Frame_t *pAbc, const char *sGroup, const char *sName, Cmd_CommandFuncType pFunc, int fChanges)
Definition: cmdApi.c:63
static int Abc_CommandWriteVer(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: wlcCom.c:153
static int Abc_CommandTest(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: wlcCom.c:335
static int Abc_CommandBlast(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: wlcCom.c:271
static int Abc_CommandPs(Abc_Frame_t *pAbc, int argc, char **argv)
Definition: wlcCom.c:208
static ABC_NAMESPACE_IMPL_START int Abc_CommandReadVer(Abc_Frame_t *pAbc, int argc, char **argv)
DECLARATIONS ///.
Definition: wlcCom.c:93