summaryrefslogtreecommitdiffstats
path: root/src/base/wln/wlnCom.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2022-04-22 15:18:49 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2022-04-22 15:18:49 -0700
commitb79f37ae57c891640240f1b5a39c70d58f75d8ac (patch)
tree7ad7433dd426c5aa2cdeba61baca266e9ce5a51a /src/base/wln/wlnCom.c
parentfdf08d2aad5f1c49d3f0e6778137a9b8a99100b2 (diff)
downloadabc-b79f37ae57c891640240f1b5a39c70d58f75d8ac.tar.gz
abc-b79f37ae57c891640240f1b5a39c70d58f75d8ac.tar.bz2
abc-b79f37ae57c891640240f1b5a39c70d58f75d8ac.zip
Experiments with word-level data structures.
Diffstat (limited to 'src/base/wln/wlnCom.c')
-rw-r--r--src/base/wln/wlnCom.c172
1 files changed, 171 insertions, 1 deletions
diff --git a/src/base/wln/wlnCom.c b/src/base/wln/wlnCom.c
index a010c7c2..dcf12229 100644
--- a/src/base/wln/wlnCom.c
+++ b/src/base/wln/wlnCom.c
@@ -28,6 +28,9 @@ ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
static int Abc_CommandYosys ( Abc_Frame_t * pAbc, int argc, char ** argv );
+static int Abc_CommandGraft ( Abc_Frame_t * pAbc, int argc, char ** argv );
+static int Abc_CommandHierarchy ( Abc_Frame_t * pAbc, int argc, char ** argv );
+static int Abc_CommandCollapse ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandSolve ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandPrint ( Abc_Frame_t * pAbc, int argc, char ** argv );
@@ -53,7 +56,10 @@ static inline void Wln_AbcUpdateRtl( Abc_Frame_t * pAbc, Rtl_Lib_t * pLib
void Wln_Init( Abc_Frame_t * pAbc )
{
Cmd_CommandAdd( pAbc, "Word level", "%yosys", Abc_CommandYosys, 0 );
- Cmd_CommandAdd( pAbc, "Word level", "%solve", Abc_CommandSolve, 0 );
+ Cmd_CommandAdd( pAbc, "Word level", "%graft", Abc_CommandGraft, 0 );
+ Cmd_CommandAdd( pAbc, "Word level", "%hierarchy", Abc_CommandHierarchy, 0 );
+ Cmd_CommandAdd( pAbc, "Word level", "%collapse", Abc_CommandCollapse, 0 );
+ //Cmd_CommandAdd( pAbc, "Word level", "%solve", Abc_CommandSolve, 0 );
Cmd_CommandAdd( pAbc, "Word level", "%print", Abc_CommandPrint, 0 );
}
@@ -213,6 +219,170 @@ usage:
SeeAlso []
******************************************************************************/
+int Abc_CommandGraft( Abc_Frame_t * pAbc, int argc, char ** argv )
+{
+ extern void Wln_LibGraftOne( Rtl_Lib_t * p, char * pModule1, char * pModule2, int fVerbose );
+ Rtl_Lib_t * pLib = Wln_AbcGetRtl(pAbc);
+ char ** pArgvNew; int nArgcNew;
+ int c, fVerbose = 0;
+ Extra_UtilGetoptReset();
+ while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
+ {
+ switch ( c )
+ {
+ case 'v':
+ fVerbose ^= 1;
+ break;
+ case 'h':
+ goto usage;
+ default:
+ goto usage;
+ }
+ }
+ if ( pLib == NULL )
+ {
+ printf( "The design is not entered.\n" );
+ return 1;
+ }
+ pArgvNew = argv + globalUtilOptind;
+ nArgcNew = argc - globalUtilOptind;
+ if ( nArgcNew != 2 )
+ {
+ Abc_Print( -1, "Abc_CommandGraft(): This command expects one AIG file name on the command line.\n" );
+ return 1;
+ }
+ Wln_LibGraftOne( pLib, pArgvNew[0], pArgvNew[1], fVerbose );
+ return 0;
+usage:
+ Abc_Print( -2, "usage: %%graft [-vh] <module1_name> <module2_name>\n" );
+ Abc_Print( -2, "\t replace instances of module1 by those of module2\n" );
+ Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
+ Abc_Print( -2, "\t-h : print the command usage\n");
+ return 1;
+}
+
+/**Function********************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+******************************************************************************/
+int Abc_CommandHierarchy( Abc_Frame_t * pAbc, int argc, char ** argv )
+{
+ extern void Wln_LibMarkHierarchy( Rtl_Lib_t * p, char ** ppModule, int nModules, int fVerbose );
+ Rtl_Lib_t * pLib = Wln_AbcGetRtl(pAbc);
+ char ** pArgvNew; int nArgcNew;
+ int c, fVerbose = 0;
+ Extra_UtilGetoptReset();
+ while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
+ {
+ switch ( c )
+ {
+ case 'v':
+ fVerbose ^= 1;
+ break;
+ case 'h':
+ goto usage;
+ default:
+ goto usage;
+ }
+ }
+ if ( pLib == NULL )
+ {
+ printf( "The design is not entered.\n" );
+ return 1;
+ }
+ pArgvNew = argv + globalUtilOptind;
+ nArgcNew = argc - globalUtilOptind;
+ if ( nArgcNew < 1 )
+ {
+ Abc_Print( -1, "Abc_CommandHierarchy(): This command expects one AIG file name on the command line.\n" );
+ return 1;
+ }
+ Wln_LibMarkHierarchy( pLib, pArgvNew, nArgcNew, fVerbose );
+ return 0;
+usage:
+ Abc_Print( -2, "usage: %%hierarchy [-vh] <module_name>\n" );
+ Abc_Print( -2, "\t marks the module whose instances may later be treated as black boxes\n" );
+ Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
+ Abc_Print( -2, "\t-h : print the command usage\n");
+ return 1;
+}
+
+/**Function********************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+******************************************************************************/
+int Abc_CommandCollapse( Abc_Frame_t * pAbc, int argc, char ** argv )
+{
+ extern Gia_Man_t * Rtl_LibCollapse( Rtl_Lib_t * p, char * pTopModule, int fVerbose );
+ Gia_Man_t * pNew = NULL;
+ Rtl_Lib_t * pLib = Wln_AbcGetRtl(pAbc);
+ char * pTopModule = NULL;
+ int c, fVerbose = 0;
+ Extra_UtilGetoptReset();
+ while ( ( c = Extra_UtilGetopt( argc, argv, "Tvh" ) ) != EOF )
+ {
+ switch ( c )
+ {
+ case 'T':
+ if ( globalUtilOptind >= argc )
+ {
+ Abc_Print( -1, "Command line switch \"-T\" should be followed by a file name.\n" );
+ goto usage;
+ }
+ pTopModule = argv[globalUtilOptind];
+ globalUtilOptind++;
+ break;
+ case 'v':
+ fVerbose ^= 1;
+ break;
+ case 'h':
+ goto usage;
+ default:
+ goto usage;
+ }
+ }
+ if ( pLib == NULL )
+ {
+ printf( "The design is not entered.\n" );
+ return 1;
+ }
+ pNew = Rtl_LibCollapse( pLib, pTopModule, fVerbose );
+ Abc_FrameUpdateGia( pAbc, pNew );
+ return 0;
+usage:
+ Abc_Print( -2, "usage: %%collapse [-T <module>] [-vh] <file_name>\n" );
+ Abc_Print( -2, "\t collapse hierarchical design into an AIG\n" );
+ Abc_Print( -2, "\t-T : specify the top module of the design [default = none]\n" );
+ Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
+ Abc_Print( -2, "\t-h : print the command usage\n");
+ return 1;
+}
+
+/**Function********************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+******************************************************************************/
int Abc_CommandPrint( Abc_Frame_t * pAbc, int argc, char ** argv )
{
extern void Rtl_LibPrintStats( Rtl_Lib_t * p );