31static int Abc_CommandReadPla (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
32static int Abc_CommandWritePla (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
33static int Abc_CommandPs (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
34static int Abc_CommandGen (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
35static int Abc_CommandMerge (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
36static int Abc_CommandTest (
Abc_Frame_t * pAbc,
int argc,
char ** argv );
39static inline void Pla_AbcFreeMan(
Abc_Frame_t * pAbc ) {
if ( pAbc->pAbcPla ) Pla_ManFree(Pla_AbcGetMan(pAbc)); }
40static inline void Pla_AbcUpdateMan(
Abc_Frame_t * pAbc,
Pla_Man_t *
p ) { Pla_AbcFreeMan(pAbc); pAbc->pAbcPla =
p; }
59 Cmd_CommandAdd( pAbc,
"Two-level",
"|read", Abc_CommandReadPla, 0 );
60 Cmd_CommandAdd( pAbc,
"Two-level",
"|write", Abc_CommandWritePla, 0 );
63 Cmd_CommandAdd( pAbc,
"Two-level",
"|merge", Abc_CommandMerge, 0 );
80 Pla_AbcFreeMan( pAbc );
96 Pla_AbcUpdateMan( pAbc,
p );
111int Abc_CommandReadPla(
Abc_Frame_t * pAbc,
int argc,
char ** argv )
115 char * pFileName = NULL;
133 printf(
"Abc_CommandReadPla(): Input file name should be given on the command line.\n" );
138 if ( (pFile = fopen( pFileName,
"r" )) == NULL )
140 Abc_Print( 1,
"Cannot open input file \"%s\". ", pFileName );
142 Abc_Print( 1,
"Did you mean \"%s\"?", pFileName );
143 Abc_Print( 1,
"\n" );
153 printf(
"Abc_CommandReadPla(): Unknown file extension.\n" );
156 Pla_AbcUpdateMan( pAbc,
p );
159 Abc_Print( -2,
"usage: |read [-vh] <file_name>\n" );
160 Abc_Print( -2,
"\t reads the SOP from a PLA file\n" );
161 Abc_Print( -2,
"\t-v : toggle printing verbose information [default = %s]\n", fVerbose?
"yes":
"no" );
162 Abc_Print( -2,
"\t-h : print the command usage\n");
177int Abc_CommandWritePla(
Abc_Frame_t * pAbc,
int argc,
char ** argv )
180 char * pFileName = NULL;
198 Abc_Print( 1,
"Abc_CommandWritePla(): There is no current design.\n" );
207 printf(
"Output file name should be given on the command line.\n" );
213 Abc_Print( -2,
"usage: |write [-vh]\n" );
214 Abc_Print( -2,
"\t writes the SOP into a PLA file\n" );
215 Abc_Print( -2,
"\t-v : toggle printing verbose information [default = %s]\n", fVerbose?
"yes":
"no" );
216 Abc_Print( -2,
"\t-h : print the command usage\n");
232int Abc_CommandPs(
Abc_Frame_t * pAbc,
int argc,
char ** argv )
264 Abc_Print( 1,
"Abc_CommandPs(): There is no current design.\n" );
267 Pla_ManPrintStats(
p, fVerbose );
270 Abc_Print( -2,
"usage: |ps [-madvh]\n" );
271 Abc_Print( -2,
"\t prints statistics\n" );
272 Abc_Print( -2,
"\t-m : toggle printing multipliers [default = %s]\n", fShowMulti?
"yes":
"no" );
273 Abc_Print( -2,
"\t-a : toggle printing adders [default = %s]\n", fShowAdder?
"yes":
"no" );
274 Abc_Print( -2,
"\t-d : toggle printing distrubition [default = %s]\n", fDistrib?
"yes":
"no" );
275 Abc_Print( -2,
"\t-v : toggle printing verbose information [default = %s]\n", fVerbose?
"yes":
"no" );
276 Abc_Print( -2,
"\t-h : print the command usage\n");
291int Abc_CommandGen(
Abc_Frame_t * pAbc,
int argc,
char ** argv )
310 Abc_Print( -1,
"Command line switch \"-I\" should be followed by an integer.\n" );
321 Abc_Print( -1,
"Command line switch \"-O\" should be followed by an integer.\n" );
332 Abc_Print( -1,
"Command line switch \"-P\" should be followed by an integer.\n" );
343 Abc_Print( -1,
"Command line switch \"-S\" should be followed by an integer.\n" );
373 for ( c = 0; c < Seed; c++ )
377 Pla_AbcUpdateMan( pAbc,
p );
380 Abc_Print( -2,
"usage: |gen [-IOPS num] [-spvh]\n" );
381 Abc_Print( -2,
"\t generate random or specialized SOP\n" );
382 Abc_Print( -2,
"\t-I num : the number of inputs [default = %d]\n", nInputs );
383 Abc_Print( -2,
"\t-O num : the number of outputs [default = %d]\n", nOutputs );
384 Abc_Print( -2,
"\t-P num : the number of products [default = %d]\n", nCubes );
385 Abc_Print( -2,
"\t-S num : ramdom seed (0 <= num <= 1000) [default = %d]\n", Seed );
386 Abc_Print( -2,
"\t-s : toggle generating sorter as a PLA file [default = %s]\n", fSorter?
"yes":
"no" );
387 Abc_Print( -2,
"\t-p : toggle generating prime detector [default = %s]\n", fPrimes?
"yes":
"no" );
388 Abc_Print( -2,
"\t-v : toggle printing verbose information [default = %s]\n", fVerbose?
"yes":
"no" );
389 Abc_Print( -2,
"\t-h : print the command usage\n");
404int Abc_CommandMerge(
Abc_Frame_t * pAbc,
int argc,
char ** argv )
407 int c, fMulti = 0, fVerbose = 0;
427 Abc_Print( 1,
"Abc_CommandMerge(): There is no current design.\n" );
434 Abc_Print( -2,
"usage: |merge [-mvh]\n" );
435 Abc_Print( -2,
"\t performs distance-1 merge using cube hashing\n" );
436 Abc_Print( -2,
"\t-v : toggle printing verbose information [default = %s]\n", fVerbose?
"yes":
"no" );
437 Abc_Print( -2,
"\t-h : print the command usage\n");
452int Abc_CommandTest(
Abc_Frame_t * pAbc,
int argc,
char ** argv )
455 int c, nVars = 4, fVerbose = 0;
464 Abc_Print( -1,
"Command line switch \"-N\" should be followed by an integer.\n" );
494 Abc_Print( -2,
"usage: |test [-N num] [-vh]\n" );
495 Abc_Print( -2,
"\t experiments with SOPs\n" );
496 Abc_Print( -2,
"\t-N num : the number of variables [default = %d]\n", nVars );
497 Abc_Print( -2,
"\t-v : toggle printing verbose information [default = %s]\n", fVerbose?
"yes":
"no" );
498 Abc_Print( -2,
"\t-h : print the command usage\n");
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
void Cmd_CommandAdd(Abc_Frame_t *pAbc, const char *sGroup, const char *sName, Cmd_CommandFuncType pFunc, int fChanges)
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
void Pla_End(Abc_Frame_t *pAbc)
void Pla_Init(Abc_Frame_t *pAbc)
FUNCTION DEFINITIONS ///.
void Pla_SetMan(Abc_Frame_t *pAbc, Pla_Man_t *p)
ABC_NAMESPACE_IMPL_START void Pla_GenSorter(int nVars)
DECLARATIONS ///.
int Pla_ManDist1Merge(Pla_Man_t *p)
DECLARATIONS ///.
Pla_Man_t * Pla_ReadPla(char *pFileName)
struct Pla_Man_t_ Pla_Man_t
void Pla_WritePla(Pla_Man_t *p, char *pFileName)
Pla_Man_t * Pla_ManGenerate(int nIns, int nOuts, int nCubes, int fVerbose)
Pla_Man_t * Pla_ManPrimesDetector(int nVars)