mirror of https://github.com/YosysHQ/abc.git
Multi-output gate mapper.
This commit is contained in:
parent
cf5da03652
commit
d54cbda229
2
Makefile
2
Makefile
|
|
@ -37,7 +37,7 @@ MODULES := \
|
|||
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/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/if/acd \
|
||||
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/map/emap \
|
||||
src/misc/extra src/misc/mvc src/misc/st src/misc/util src/misc/nm \
|
||||
src/misc/vec src/misc/hash src/misc/tim src/misc/bzlib src/misc/zlib \
|
||||
src/misc/mem src/misc/bar src/misc/bbl src/misc/parse src/misc/btor \
|
||||
|
|
|
|||
16
abclib.dsp
16
abclib.dsp
|
|
@ -4801,6 +4801,22 @@ SOURCE=.\src\map\mpm\mpmTruth.c
|
|||
SOURCE=.\src\map\mpm\mpmUtil.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "emap"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\map\emap\emap.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\map\emap\emap.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\map\emap\emapCore.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Group
|
||||
# Begin Group "misc"
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ extern void Load_Init( Abc_Frame_t * pAbc );
|
|||
extern void Load_End( Abc_Frame_t * pAbc );
|
||||
extern void Scl_Init( Abc_Frame_t * pAbc );
|
||||
extern void Scl_End( Abc_Frame_t * pAbc );
|
||||
extern void Emap_Init( Abc_Frame_t * pAbc );
|
||||
extern void Emap_End( Abc_Frame_t * pAbc );
|
||||
extern void Wlc_Init( Abc_Frame_t * pAbc );
|
||||
extern void Wlc_End( Abc_Frame_t * pAbc );
|
||||
extern void Wln_Init( Abc_Frame_t * pAbc );
|
||||
|
|
@ -118,6 +120,7 @@ void Abc_FrameInit( Abc_Frame_t * pAbc )
|
|||
Libs_Init( pAbc );
|
||||
Load_Init( pAbc );
|
||||
Scl_Init( pAbc );
|
||||
Emap_Init( pAbc );
|
||||
Wlc_Init( pAbc );
|
||||
Wln_Init( pAbc );
|
||||
Bac_Init( pAbc );
|
||||
|
|
@ -159,6 +162,7 @@ void Abc_FrameEnd( Abc_Frame_t * pAbc )
|
|||
Super_End( pAbc );
|
||||
Libs_End( pAbc );
|
||||
Load_End( pAbc );
|
||||
Emap_End( pAbc );
|
||||
Scl_End( pAbc );
|
||||
Wlc_End( pAbc );
|
||||
Wln_End( pAbc );
|
||||
|
|
|
|||
|
|
@ -0,0 +1,158 @@
|
|||
/**CFile****************************************************************
|
||||
|
||||
FileName [emap.c]
|
||||
|
||||
SystemName [ABC: Logic synthesis and verification system.]
|
||||
|
||||
PackageName [Multi-output gate mapper.]
|
||||
|
||||
Synopsis [ABC command entry points.]
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
#include "emap.h"
|
||||
|
||||
#include "base/abc/abc.h"
|
||||
#include "base/cmd/cmd.h"
|
||||
#include "base/main/mainInt.h"
|
||||
#include "map/mio/mio.h"
|
||||
#include "misc/extra/extra.h"
|
||||
|
||||
ABC_NAMESPACE_IMPL_START
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// DECLARATIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static int Emap_CommandCountMogPairs( Mio_Library_t * pLib );
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// FUNCTION DEFINITIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Starts the package.]
|
||||
|
||||
***********************************************************************/
|
||||
void Emap_Init( Abc_Frame_t * pAbc )
|
||||
{
|
||||
Cmd_CommandAdd( pAbc, "SC mapping", "emap", Emap_Command, 1 );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Stops the package.]
|
||||
|
||||
***********************************************************************/
|
||||
void Emap_End( Abc_Frame_t * pAbc )
|
||||
{
|
||||
(void)pAbc;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Counts physical two-output gates represented as twin gates.]
|
||||
|
||||
***********************************************************************/
|
||||
static int Emap_CommandCountMogPairs( Mio_Library_t * pLib )
|
||||
{
|
||||
Mio_Gate_t * pGate;
|
||||
int nTwinOutputs = 0;
|
||||
if ( pLib == NULL )
|
||||
return 0;
|
||||
Mio_LibraryForEachGate( pLib, pGate )
|
||||
nTwinOutputs += (Mio_GateReadTwin(pGate) != NULL);
|
||||
return nTwinOutputs / 2;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Runs the ABC-native exact mapper.]
|
||||
|
||||
***********************************************************************/
|
||||
int Emap_Command( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
{
|
||||
Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
|
||||
Mio_Library_t * pLib = (Mio_Library_t *)Abc_FrameReadLibGen();
|
||||
Abc_Ntk_t * pNtkRes;
|
||||
int c, fUseMogs = 1, fAreaMode = 0, fVerbose = 0;
|
||||
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "amvh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
case 'a':
|
||||
fAreaMode ^= 1;
|
||||
break;
|
||||
case 'm':
|
||||
fUseMogs ^= 1;
|
||||
break;
|
||||
case 'v':
|
||||
fVerbose ^= 1;
|
||||
break;
|
||||
case 'h':
|
||||
goto usage;
|
||||
default:
|
||||
goto usage;
|
||||
}
|
||||
}
|
||||
if ( argc != globalUtilOptind )
|
||||
goto usage;
|
||||
|
||||
if ( pNtk == NULL )
|
||||
{
|
||||
fprintf( pAbc->Err, "There is no current network.\n" );
|
||||
return 1;
|
||||
}
|
||||
if ( pLib == NULL )
|
||||
{
|
||||
fprintf( pAbc->Err, "There is no current GENLIB library. Use read_genlib/read_lib first.\n" );
|
||||
return 1;
|
||||
}
|
||||
if ( !Abc_NtkIsStrash(pNtk) )
|
||||
{
|
||||
fprintf( pAbc->Err, "The current network is not an AIG. Run strash first.\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( fVerbose )
|
||||
{
|
||||
int nMogPairs = fUseMogs ? Emap_CommandCountMogPairs( pLib ) : 0;
|
||||
fprintf( pAbc->Out, "ABC-native emap setup: PI = %d PO = %d AND = %d\n",
|
||||
Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk), Abc_NtkNodeNum(pNtk) );
|
||||
fprintf( pAbc->Out, "GENLIB \"%s\": gates = %d MOG pairs = %d MOG use = %s mode = %s\n",
|
||||
Mio_LibraryReadName(pLib), Mio_LibraryReadGateNum(pLib), nMogPairs, fUseMogs ? "yes" : "no", fAreaMode ? "area" : "delay" );
|
||||
}
|
||||
|
||||
pNtkRes = Emap_ManMapAigStructural( pNtk, pLib, fUseMogs, fAreaMode, fVerbose );
|
||||
if ( pNtkRes == NULL )
|
||||
{
|
||||
fprintf( pAbc->Err, "ABC-native emap structural mapping has failed.\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes );
|
||||
return 0;
|
||||
|
||||
usage:
|
||||
fprintf( pAbc->Err, "usage: emap [-amvh]\n" );
|
||||
fprintf( pAbc->Err, "\t maps the current AIG using the current GENLIB library\n" );
|
||||
fprintf( pAbc->Err, "\t-a : toggle area-oriented mode without required-time pruning [default = %s]\n", fAreaMode ? "yes" : "no" );
|
||||
fprintf( pAbc->Err, "\t-m : toggle using multi-output gates when present [default = %s]\n", fUseMogs ? "yes" : "no" );
|
||||
fprintf( pAbc->Err, "\t-v : toggle verbose output [default = %s]\n", fVerbose ? "yes" : "no" );
|
||||
fprintf( pAbc->Err, "\t-h : prints the command summary\n\n" );
|
||||
fprintf( pAbc->Err, "\tThe mapper is inspired by \"emap\" in Mockturtle developed by Alessandro Tempia Calvino\n" );
|
||||
fprintf( pAbc->Err, "\tavailable at https://mockturtle.readthedocs.io/en/latest/algorithms/mapper.html\n" );
|
||||
fprintf( pAbc->Err, "\tand described in A. T. Calvino and G. De Micheli, \"Technology mapping using multi-output\n" );
|
||||
fprintf( pAbc->Err, "\tlibrary cells\", Proc. ICCAD\'23, https://aletempiac.github.io/publication/2023_006\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
ABC_NAMESPACE_IMPL_END
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
/**CFile****************************************************************
|
||||
|
||||
FileName [emap.h]
|
||||
|
||||
SystemName [ABC: Logic synthesis and verification system.]
|
||||
|
||||
PackageName [Multi-output gate mapper.]
|
||||
|
||||
Synopsis [External declarations.]
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
#ifndef ABC__map__emap__emap_h
|
||||
#define ABC__map__emap__emap_h
|
||||
|
||||
#include "base/main/main.h"
|
||||
|
||||
ABC_NAMESPACE_HEADER_START
|
||||
|
||||
typedef struct Abc_Ntk_t_ Abc_Ntk_t;
|
||||
typedef struct Mio_LibraryStruct_t_ Mio_Library_t;
|
||||
|
||||
extern void Emap_Init ( Abc_Frame_t * pAbc );
|
||||
extern void Emap_End ( Abc_Frame_t * pAbc );
|
||||
extern int Emap_Command( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
|
||||
extern Abc_Ntk_t * Emap_ManMapAigStructural( Abc_Ntk_t * pNtk, Mio_Library_t * pLib, int fUseMogs, int fAreaMode, int fVerbose );
|
||||
|
||||
ABC_NAMESPACE_HEADER_END
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,2 @@
|
|||
SRC += src/map/emap/emap.c \
|
||||
src/map/emap/emapCore.c
|
||||
Loading…
Reference in New Issue