Commit 9e787c71 by Alan Mishchenko

Experiments with word-level retiming.

parent a8faa2b5
...@@ -16,7 +16,7 @@ OS := $(shell uname -s) ...@@ -16,7 +16,7 @@ OS := $(shell uname -s)
MODULES := \ MODULES := \
$(wildcard src/ext*) \ $(wildcard src/ext*) \
src/base/abc src/base/abci src/base/cmd src/base/io src/base/main src/base/exor \ src/base/abc src/base/abci src/base/cmd src/base/io src/base/main src/base/exor \
src/base/ver src/base/wlc src/base/acb src/base/bac src/base/cba src/base/pla src/base/test \ src/base/ver src/base/wlc src/base/wln src/base/acb src/base/bac src/base/cba src/base/pla src/base/test \
src/map/mapper src/map/mio src/map/super src/map/if \ src/map/mapper src/map/mio src/map/super src/map/if \
src/map/amap src/map/cov src/map/scl src/map/mpm \ src/map/amap src/map/cov src/map/scl src/map/mpm \
src/misc/extra src/misc/mvc src/misc/st src/misc/util src/misc/nm \ src/misc/extra src/misc/mvc src/misc/st src/misc/util src/misc/nm \
......
...@@ -1106,6 +1106,38 @@ SOURCE=.\src\base\acb\acbSets.h ...@@ -1106,6 +1106,38 @@ SOURCE=.\src\base\acb\acbSets.h
SOURCE=.\src\base\acb\acbUtil.c SOURCE=.\src\base\acb\acbUtil.c
# End Source File # End Source File
# End Group # End Group
# Begin Group "wln"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\src\base\wln\wln.c
# End Source File
# Begin Source File
SOURCE=.\src\base\wln\wln.h
# End Source File
# Begin Source File
SOURCE=.\src\base\wln\wlnNdr.c
# End Source File
# Begin Source File
SOURCE=.\src\base\wln\wlnNtk.c
# End Source File
# Begin Source File
SOURCE=.\src\base\wln\wlnObj.c
# End Source File
# Begin Source File
SOURCE=.\src\base\wln\wlnRetime.c
# End Source File
# Begin Source File
SOURCE=.\src\base\wln\wlnWriteVer.c
# End Source File
# End Group
# End Group # End Group
# Begin Group "bdd" # Begin Group "bdd"
......
...@@ -60,7 +60,7 @@ typedef enum { ...@@ -60,7 +60,7 @@ typedef enum {
ABC_OPER_BIT_NXOR, // 18 ABC_OPER_BIT_NXOR, // 18
ABC_OPER_BIT_SHARP, // 19 ABC_OPER_BIT_SHARP, // 19
ABC_OPER_BIT_SHARPL, // 20 ABC_OPER_BIT_SHARPL, // 20
ABC_OPER_BIT_MUX, // 21 ABC_OPER_BIT_MUX, // 21 fanins are: {Ctrl, Data1, Data0}
ABC_OPER_BIT_MAJ, // 22 ABC_OPER_BIT_MAJ, // 22
ABC_OPER_ABC, // 23 ABC_OPER_ABC, // 23
...@@ -86,7 +86,7 @@ typedef enum { ...@@ -86,7 +86,7 @@ typedef enum {
ABC_OPER_LOGIC_XOR, // 41 ABC_OPER_LOGIC_XOR, // 41
ABC_OPER_LOGIC_XNOR, // 42 ABC_OPER_LOGIC_XNOR, // 42
ABC_OPER_SEL_NMUX, // 43 ABC_OPER_SEL_NMUX, // 43 fanins are: {Ctrl, Data0, Data1, Data2, ...}
ABC_OPER_SEL_SEL, // 44 ABC_OPER_SEL_SEL, // 44
ABC_OPER_SEL_PSEL, // 45 ABC_OPER_SEL_PSEL, // 45
ABC_OPER_SEL_ENC, // 46 ABC_OPER_SEL_ENC, // 46
...@@ -217,11 +217,14 @@ static inline char * Abc_OperName( int Type ) ...@@ -217,11 +217,14 @@ static inline char * Abc_OperName( int Type )
if ( Type == ABC_OPER_SHIFT_ROTL ) return "rotL"; if ( Type == ABC_OPER_SHIFT_ROTL ) return "rotL";
if ( Type == ABC_OPER_SHIFT_ROTR ) return "rotR"; if ( Type == ABC_OPER_SHIFT_ROTR ) return "rotR";
if ( Type == ABC_OPER_DFFRSE ) return "DFFRSE";
if ( Type == ABC_OPER_SLICE ) return "[:]"; if ( Type == ABC_OPER_SLICE ) return "[:]";
if ( Type == ABC_OPER_CONCAT ) return "{}"; if ( Type == ABC_OPER_CONCAT ) return "{}";
if ( Type == ABC_OPER_ZEROPAD ) return "zPad"; if ( Type == ABC_OPER_ZEROPAD ) return "zPad";
if ( Type == ABC_OPER_SIGNEXT ) return "sExt"; if ( Type == ABC_OPER_SIGNEXT ) return "sExt";
if ( Type == ABC_OPER_CONST ) return "const";
if ( Type == ABC_OPER_TABLE ) return "table"; if ( Type == ABC_OPER_TABLE ) return "table";
if ( Type == ABC_OPER_LAST ) return NULL; if ( Type == ABC_OPER_LAST ) return NULL;
assert( 0 ); assert( 0 );
......
...@@ -40,6 +40,7 @@ static int Abc_CommandMemAbs ( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -40,6 +40,7 @@ static int Abc_CommandMemAbs ( Abc_Frame_t * pAbc, int argc, char ** argv )
static int Abc_CommandBlast ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandBlast ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandBlastMem ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandBlastMem ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandGraft ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandGraft ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandRetime ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandProfile ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandProfile ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandShortNames ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandShortNames ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandShow ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandShow ( Abc_Frame_t * pAbc, int argc, char ** argv );
...@@ -85,6 +86,7 @@ void Wlc_Init( Abc_Frame_t * pAbc ) ...@@ -85,6 +86,7 @@ void Wlc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "Word level", "%blast", Abc_CommandBlast, 0 ); Cmd_CommandAdd( pAbc, "Word level", "%blast", Abc_CommandBlast, 0 );
Cmd_CommandAdd( pAbc, "Word level", "%blastmem", Abc_CommandBlastMem, 0 ); Cmd_CommandAdd( pAbc, "Word level", "%blastmem", Abc_CommandBlastMem, 0 );
Cmd_CommandAdd( pAbc, "Word level", "%graft", Abc_CommandGraft, 0 ); Cmd_CommandAdd( pAbc, "Word level", "%graft", Abc_CommandGraft, 0 );
Cmd_CommandAdd( pAbc, "Word level", "%retime", Abc_CommandRetime, 0 );
Cmd_CommandAdd( pAbc, "Word level", "%profile", Abc_CommandProfile, 0 ); Cmd_CommandAdd( pAbc, "Word level", "%profile", Abc_CommandProfile, 0 );
Cmd_CommandAdd( pAbc, "Word level", "%short_names", Abc_CommandShortNames, 0 ); Cmd_CommandAdd( pAbc, "Word level", "%short_names", Abc_CommandShortNames, 0 );
Cmd_CommandAdd( pAbc, "Word level", "%show", Abc_CommandShow, 0 ); Cmd_CommandAdd( pAbc, "Word level", "%show", Abc_CommandShow, 0 );
...@@ -1168,7 +1170,7 @@ int Abc_CommandBlastMem( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -1168,7 +1170,7 @@ int Abc_CommandBlastMem( Abc_Frame_t * pAbc, int argc, char ** argv )
} }
if ( pNtk == NULL ) if ( pNtk == NULL )
{ {
Abc_Print( 1, "Abc_CommandGraft(): There is no current design.\n" ); Abc_Print( 1, "Abc_CommandBlastMem(): There is no current design.\n" );
return 0; return 0;
} }
pNtk = Wlc_NtkMemBlast( pNtk ); pNtk = Wlc_NtkMemBlast( pNtk );
...@@ -1239,6 +1241,63 @@ usage: ...@@ -1239,6 +1241,63 @@ usage:
SeeAlso [] SeeAlso []
******************************************************************************/ ******************************************************************************/
int Abc_CommandRetime( Abc_Frame_t * pAbc, int argc, char ** argv )
{
extern void Wln_NtkRetimeTest( char * pFileName );
FILE * pFile;
char * pFileName = NULL;
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 ( argc != globalUtilOptind + 1 )
{
printf( "Abc_CommandRetime(): Input file name should be given on the command line.\n" );
return 0;
}
// get the file name
pFileName = argv[globalUtilOptind];
if ( (pFile = fopen( pFileName, "r" )) == NULL )
{
Abc_Print( 1, "Cannot open input file \"%s\". ", pFileName );
if ( (pFileName = Extra_FileGetSimilarName( pFileName, ".ndr", NULL, NULL, NULL, NULL )) )
Abc_Print( 1, "Did you mean \"%s\"?", pFileName );
Abc_Print( 1, "\n" );
return 0;
}
fclose( pFile );
Wln_NtkRetimeTest( pFileName );
return 0;
usage:
Abc_Print( -2, "usage: %%retime [-vh]\n" );
Abc_Print( -2, "\t performs retiming for the NDR design\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_CommandProfile( Abc_Frame_t * pAbc, int argc, char ** argv ) int Abc_CommandProfile( Abc_Frame_t * pAbc, int argc, char ** argv )
{ {
Wlc_Ntk_t * pNtk = Wlc_AbcGetNtk(pAbc); Wlc_Ntk_t * pNtk = Wlc_AbcGetNtk(pAbc);
...@@ -1754,7 +1813,7 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -1754,7 +1813,7 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
//Wlc_NtkSimulateTest( (Wlc_Ntk_t *)pAbc->pAbcWlc ); //Wlc_NtkSimulateTest( (Wlc_Ntk_t *)pAbc->pAbcWlc );
//pNtk = Wlc_NtkDupSingleNodes( pNtk ); //pNtk = Wlc_NtkDupSingleNodes( pNtk );
//Wlc_AbcUpdateNtk( pAbc, pNtk ); //Wlc_AbcUpdateNtk( pAbc, pNtk );
Ndr_ModuleTestDec(); //Wln_ReadNdrTest();
//pNtk = Wlc_NtkMemAbstractTest( pNtk ); //pNtk = Wlc_NtkMemAbstractTest( pNtk );
//Wlc_AbcUpdateNtk( pAbc, pNtk ); //Wlc_AbcUpdateNtk( pAbc, pNtk );
return 0; return 0;
......
SRC += src/base/wln/wln.c \
src/base/wln/wlnNdr.c \
src/base/wln/wlnNtk.c \
src/base/wln/wlnObj.c \
src/base/wln/wlnRetime.c \
src/base/wln/wlnWriteVer.c
/**CFile****************************************************************
FileName [wln.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Word-level network.]
Synopsis []
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - September 23, 2018.]
Revision [$Id: wln.c,v 1.00 2018/09/23 00:00:00 alanmi Exp $]
***********************************************************************/
#include "wln.h"
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_IMPL_END
/**CFile****************************************************************
FileName [wlnObj.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Word-level network.]
Synopsis [Object construction procedures.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - September 23, 2018.]
Revision [$Id: wlnObj.c,v 1.00 2018/09/23 00:00:00 alanmi Exp $]
***********************************************************************/
#include "wln.h"
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis [Creating objects.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
char * Wln_ObjName( Wln_Ntk_t * p, int iObj )
{
static char Buffer[100];
if ( Wln_NtkHasNameId(p) && Wln_ObjNameId(p, iObj) )
return Abc_NamStr( p->pManName, Wln_ObjNameId(p, iObj) );
sprintf( Buffer, "n%d", iObj );
return Buffer;
}
char * Wln_ObjConstString( Wln_Ntk_t * p, int iObj )
{
assert( Wln_ObjIsConst(p, iObj) );
return Abc_NamStr( p->pManName, Wln_ObjFanin0(p, iObj) );
}
void Wln_ObjUpdateType( Wln_Ntk_t * p, int iObj, int Type )
{
assert( Wln_ObjIsNone(p, iObj) );
p->nObjs[Wln_ObjType(p, iObj)]--;
Vec_IntWriteEntry( &p->vTypes, iObj, Type );
p->nObjs[Wln_ObjType(p, iObj)]++;
}
void Wln_ObjSetConst( Wln_Ntk_t * p, int iObj, int NameId )
{
assert( Wln_ObjIsConst(p, iObj) );
Wln_ObjSetFanin( p, iObj, 0, NameId );
}
void Wln_ObjSetSlice( Wln_Ntk_t * p, int iObj, int SliceId )
{
assert( Wln_ObjIsSlice(p, iObj) );
Wln_ObjSetFanin( p, iObj, 1, SliceId );
}
void Wln_ObjAddFanin( Wln_Ntk_t * p, int iObj, int i )
{
Wln_Vec_t * pVec = p->vFanins + iObj;
if ( Wln_ObjFaninNum(p, iObj) < 2 )
pVec->Array[pVec->nSize++] = i;
else if ( Wln_ObjFaninNum(p, iObj) == 2 )
{
int * pArray = ABC_ALLOC( int, 4 );
pArray[0] = pVec->Array[0];
pArray[1] = pVec->Array[1];
pArray[2] = i;
pVec->pArray[0] = pArray;
pVec->nSize = 3;
pVec->nCap = 4;
}
else
{
if ( pVec->nSize == pVec->nCap )
pVec->pArray[0] = ABC_REALLOC( int, pVec->pArray[0], (pVec->nCap = 2*pVec->nSize) );
assert( pVec->nSize < pVec->nCap );
pVec->pArray[0][pVec->nSize++] = i;
}
}
int Wln_ObjAddFanins( Wln_Ntk_t * p, int iObj, Vec_Int_t * vFanins )
{
int i, iFanin;
Vec_IntForEachEntry( vFanins, iFanin, i )
Wln_ObjAddFanin( p, iObj, iFanin );
return iObj;
}
int Wln_ObjAlloc( Wln_Ntk_t * p, int Type, int Signed, int End, int Beg )
{
int iObj = Vec_IntSize(&p->vTypes);
if ( iObj == Vec_IntCap(&p->vTypes) )
{
p->vFanins = ABC_REALLOC( Wln_Vec_t, p->vFanins, 2 * iObj );
memset( p->vFanins + iObj, 0, sizeof(Wln_Vec_t) * iObj );
Vec_IntGrow( &p->vTypes, 2 * iObj );
}
assert( iObj == Vec_StrSize(&p->vSigns) );
assert( iObj == Vec_IntSize(&p->vRanges) );
Vec_IntPush( &p->vTypes, Type );
Vec_StrPush( &p->vSigns, (char)Signed );
Vec_IntPush( &p->vRanges, Hash_Int2ManInsert(p->pRanges, End, Beg, 0) );
if ( Wln_ObjIsCi(p, iObj) ) Wln_ObjSetFanin( p, iObj, 1, Vec_IntSize(&p->vCis) ), Vec_IntPush( &p->vCis, iObj );
if ( Wln_ObjIsCo(p, iObj) ) Wln_ObjSetFanin( p, iObj, 1, Vec_IntSize(&p->vCos) ), Vec_IntPush( &p->vCos, iObj );
if ( Wln_ObjIsFf(p, iObj) ) Vec_IntPush( &p->vFfs, iObj );
p->nObjs[Type]++;
return iObj;
}
int Wln_ObjClone( Wln_Ntk_t * pNew, Wln_Ntk_t * p, int iObj )
{
return Wln_ObjAlloc( pNew, Wln_ObjType(p, iObj), Wln_ObjIsSigned(p, iObj), Wln_ObjRangeEnd(p, iObj), Wln_ObjRangeBeg(p, iObj) );
}
int Wln_ObjCreateCo( Wln_Ntk_t * p, int iFanin )
{
int iCo = Wln_ObjClone( p, p, iFanin );
Wln_ObjUpdateType( p, iCo, ABC_OPER_CO );
Wln_ObjAddFanin( p, iCo, iFanin );
return iCo;
}
void Wln_ObjPrint( Wln_Ntk_t * p, int iObj )
{
int k, iFanin, Type = Wln_ObjType(p, iObj);
printf( "Obj %6d : Type = %6s Fanins = %d : ", iObj, Abc_OperName(Type), Wln_ObjFaninNum(p, iObj) );
Wln_ObjForEachFanin( p, iObj, iFanin, k )
printf( "%5d ", iFanin );
printf( "\n" );
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_IMPL_END
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment