summaryrefslogtreecommitdiffstats
path: root/src/base/abci
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2015-09-30 20:21:40 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2015-09-30 20:21:40 -0700
commit0e0f2e64af4a101f8a60d236f29b95dd7cfd1fbf (patch)
tree2ddc566f4d593cc058dde05238de870cd568434b /src/base/abci
parent10c31c6576cfee6d070e255b8878e23574529737 (diff)
downloadabc-0e0f2e64af4a101f8a60d236f29b95dd7cfd1fbf.tar.gz
abc-0e0f2e64af4a101f8a60d236f29b95dd7cfd1fbf.tar.bz2
abc-0e0f2e64af4a101f8a60d236f29b95dd7cfd1fbf.zip
Naive LUT packing algorithm (command &pack).
Diffstat (limited to 'src/base/abci')
-rw-r--r--src/base/abci/abc.c99
1 files changed, 99 insertions, 0 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index 2fa26c71..d1c86e62 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -414,6 +414,7 @@ static int Abc_CommandAbc9Lf ( Abc_Frame_t * pAbc, int argc, cha
static int Abc_CommandAbc9Mf ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Nf ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Of ( Abc_Frame_t * pAbc, int argc, char ** argv );
+static int Abc_CommandAbc9Pack ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Unmap ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Struct ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Trace ( Abc_Frame_t * pAbc, int argc, char ** argv );
@@ -1034,6 +1035,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "ABC9", "&mf", Abc_CommandAbc9Mf, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&nf", Abc_CommandAbc9Nf, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&of", Abc_CommandAbc9Of, 0 );
+ Cmd_CommandAdd( pAbc, "ABC9", "&pack", Abc_CommandAbc9Pack, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&unmap", Abc_CommandAbc9Unmap, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&struct", Abc_CommandAbc9Struct, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&trace", Abc_CommandAbc9Trace, 0 );
@@ -34257,6 +34259,103 @@ usage:
SeeAlso []
***********************************************************************/
+int Abc_CommandAbc9Pack( Abc_Frame_t * pAbc, int argc, char ** argv )
+{
+ extern void Gia_ManLutPacking( Gia_Man_t * p, int nBlock, int DelayRoute, int DelayDir, int fVerbose );
+ int c, nBlock = 2, DelayRoute = 10, DelayDir = 2, fVerbose = 0;
+ Extra_UtilGetoptReset();
+ while ( ( c = Extra_UtilGetopt( argc, argv, "NRDvh" ) ) != EOF )
+ {
+ switch ( c )
+ {
+ case 'N':
+ if ( globalUtilOptind >= argc )
+ {
+ Abc_Print( -1, "Command line switch \"-N\" should be followed by a positive integer.\n" );
+ goto usage;
+ }
+ nBlock = atoi(argv[globalUtilOptind]);
+ globalUtilOptind++;
+ if ( nBlock < 2 )
+ {
+ Abc_Print( -1, "LUT block size (%d) should be more than 1.\n", nBlock );
+ goto usage;
+ }
+ break;
+ case 'R':
+ if ( globalUtilOptind >= argc )
+ {
+ Abc_Print( -1, "Command line switch \"-N\" should be followed by a positive integer.\n" );
+ goto usage;
+ }
+ DelayRoute = atoi(argv[globalUtilOptind]);
+ globalUtilOptind++;
+ if ( DelayRoute <= 0 )
+ {
+ Abc_Print( -1, "Rounting delay (%d) should be more than 0.\n", DelayRoute);
+ goto usage;
+ }
+ break;
+ case 'D':
+ if ( globalUtilOptind >= argc )
+ {
+ Abc_Print( -1, "Command line switch \"-D\" should be followed by a positive integer.\n" );
+ goto usage;
+ }
+ DelayDir = atoi(argv[globalUtilOptind]);
+ globalUtilOptind++;
+ if ( DelayDir <= 0 )
+ {
+ Abc_Print( -1, "Direct delay (%d) should be more than 0.\n", DelayRoute);
+ goto usage;
+ }
+ break;
+ case 'v':
+ fVerbose ^= 1;
+ break;
+ case 'h':
+ default:
+ goto usage;
+ }
+ }
+
+ if ( pAbc->pGia == NULL )
+ {
+ Abc_Print( -1, "Empty GIA network.\n" );
+ return 1;
+ }
+ if ( !Gia_ManHasMapping(pAbc->pGia) )
+ {
+ Abc_Print( -1, "Current AIG has no mapping. Run \"&if\".\n" );
+ return 1;
+ }
+ if ( Gia_ManLutSizeMax(pAbc->pGia) > 6 )
+ Abc_Print( 0, "Current AIG has mapping into %d-LUTs.\n", Gia_ManLutSizeMax(pAbc->pGia) );
+ Gia_ManLutPacking( pAbc->pGia, nBlock, DelayRoute, DelayDir, fVerbose );
+ return 0;
+
+usage:
+ Abc_Print( -2, "usage: &pack [-NRD num] [-vh]\n" );
+ Abc_Print( -2, "\t performs packing for the LUT mapped network\n" );
+ Abc_Print( -2, "\t-N num : the number of LUTs in the block [default = %d]\n", nBlock );
+ Abc_Print( -2, "\t-R num : the routable delay of a LUT [default = %d]\n", DelayRoute );
+ Abc_Print( -2, "\t-D num : the direct (non-routable) delay of a LUT [default = %d]\n", DelayDir );
+ Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" );
+ Abc_Print( -2, "\t-h : prints the command usage\n");
+ return 1;
+}
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
int Abc_CommandAbc9Unmap( Abc_Frame_t * pAbc, int argc, char ** argv )
{
extern void Gia_ManTestStruct( Gia_Man_t * p );