Commit 05772a79 by Alan Mishchenko

Version abc80707

parent c7b331ef
......@@ -3322,6 +3322,10 @@ SOURCE=.\src\aig\nwk\nwkMerge.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\nwk\nwkMerge.h
# End Source File
# Begin Source File
SOURCE=.\src\aig\nwk\nwkObj.c
# End Source File
# Begin Source File
......
......@@ -108,21 +108,6 @@ struct Nwk_Obj_t_
Nwk_Obj_t ** pFanio; // fanins/fanouts
};
// the LUT merging parameters
typedef struct Nwk_LMPars_t_ Nwk_LMPars_t;
struct Nwk_LMPars_t_
{
int nMaxLutSize; // the max LUT size for merging (N=5)
int nMaxSuppSize; // the max total support size after merging (S=5)
int nMaxDistance; // the max number of nodes separating LUTs
int nMaxLevelDiff; // the max difference in levels
int nMaxFanout; // the max number of fanouts to traverse
int fUseTfiTfo; // enables the use of TFO/TFO nodes as candidates
int fVeryVerbose; // enables additional verbose output
int fVerbose; // enables verbose output
};
////////////////////////////////////////////////////////////////////////
/// MACRO DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
......
/**CFile****************************************************************
FileName [nwkMerge.h]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Logic network representation.]
Synopsis [External declarations.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: nwkMerge.h,v 1.1 2008/05/14 22:13:09 wudenni Exp $]
***********************************************************************/
#ifndef __NWK_MERGE_H__
#define __NWK_MERGE_H__
#ifdef __cplusplus
extern "C" {
#endif
////////////////////////////////////////////////////////////////////////
/// INCLUDES ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
#define NWK_MAX_LIST 16
////////////////////////////////////////////////////////////////////////
/// BASIC TYPES ///
////////////////////////////////////////////////////////////////////////
// the LUT merging parameters
typedef struct Nwk_LMPars_t_ Nwk_LMPars_t;
struct Nwk_LMPars_t_
{
int nMaxLutSize; // the max LUT size for merging (N=5)
int nMaxSuppSize; // the max total support size after merging (S=5)
int nMaxDistance; // the max number of nodes separating LUTs
int nMaxLevelDiff; // the max difference in levels
int nMaxFanout; // the max number of fanouts to traverse
int fUseDiffSupp; // enables the use of nodes with different support
int fUseTfiTfo; // enables the use of TFO/TFO nodes as candidates
int fVeryVerbose; // enables additional verbose output
int fVerbose; // enables verbose output
};
// edge of the graph
typedef struct Nwk_Edg_t_ Nwk_Edg_t;
struct Nwk_Edg_t_
{
int iNode1; // the first node
int iNode2; // the second node
Nwk_Edg_t * pNext; // the next edge
};
// vertex of the graph
typedef struct Nwk_Vrt_t_ Nwk_Vrt_t;
struct Nwk_Vrt_t_
{
int Id; // the vertex number
int iPrev; // the previous vertex in the list
int iNext; // the next vertex in the list
int nEdges; // the number of edges
int pEdges[0]; // the array of edges
};
// the connectivity graph
typedef struct Nwk_Grf_t_ Nwk_Grf_t;
struct Nwk_Grf_t_
{
// preliminary graph representation
int nObjs; // the number of objects
int nVertsMax; // the upper bound on the number of vertices
int nEdgeHash; // an approximate number of edges
Nwk_Edg_t ** pEdgeHash; // hash table for edges
Aig_MmFixed_t * pMemEdges; // memory for edges
// graph representation
int nEdges; // the number of edges
int nVerts; // the number of vertices
Nwk_Vrt_t ** pVerts; // the array of vertices
Aig_MmFlex_t * pMemVerts; // memory for vertices
// intermediate data
int pLists1[NWK_MAX_LIST+1]; // lists of nodes with one edge
int pLists2[NWK_MAX_LIST+1]; // lists of nodes with more than one edge
// the results of matching
Vec_Int_t * vPairs; // pairs matched in the graph
// object mappings
int * pMapLut2Id; // LUT numbers into vertex IDs
int * pMapId2Lut; // vertex IDs into LUT numbers
// other things
int nMemBytes1; // memory usage in bytes
int nMemBytes2; // memory usage in bytes
};
////////////////////////////////////////////////////////////////////////
/// MACRO DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
#define Nwk_GraphForEachEdge( p, pEdge, k ) \
for ( k = 0; k < p->nEdgeHash; k++ ) \
for ( pEdge = p->pEdgeHash[k]; pEdge; pEdge = pEdge->pNext )
#define Nwk_ListForEachVertex( p, List, pVrt ) \
for ( pVrt = List? p->pVerts[List] : NULL; pVrt; \
pVrt = pVrt->iNext? p->pVerts[pVrt->iNext] : NULL )
#define Nwk_VertexForEachAdjacent( p, pVrt, pNext, k ) \
for ( k = 0; (k < pVrt->nEdges) && (((pNext) = p->pVerts[pVrt->pEdges[k]]), 1); k++ )
////////////////////////////////////////////////////////////////////////
/// INLINED FUNCTIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// ITERATORS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
/*=== nwkMerge.c ==========================================================*/
extern ABC_DLL Nwk_Grf_t * Nwk_ManGraphAlloc( int nVertsMax );
extern ABC_DLL void Nwk_ManGraphFree( Nwk_Grf_t * p );
extern ABC_DLL void Nwk_ManGraphReportMemoryUsage( Nwk_Grf_t * p );
extern ABC_DLL void Nwk_ManGraphHashEdge( Nwk_Grf_t * p, int iLut1, int iLut2 );
extern ABC_DLL void Nwk_ManGraphSolve( Nwk_Grf_t * p );
extern ABC_DLL int Nwk_ManLutMergeGraphTest( char * pFileName );
#ifdef __cplusplus
}
#endif
#endif
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
......@@ -33,6 +33,7 @@
#include "mfx.h"
#include "fra.h"
#include "saig.h"
#include "nwkMerge.h"
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
......@@ -7578,13 +7579,15 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
{
FILE * pOut, * pErr;
Abc_Ntk_t * pNtk;
Abc_Ntk_t * pNtkRes;
// Abc_Ntk_t * pNtkRes;
int c;
int fBmc;
int nFrames;
int nLevels;
int fVerbose;
int fVeryVerbose;
char * pFileName;
// extern Abc_Ntk_t * Abc_NtkNewAig( Abc_Ntk_t * pNtk );
// extern Abc_Ntk_t * Abc_NtkIvy( Abc_Ntk_t * pNtk );
// extern void Abc_NtkMaxFlowTest( Abc_Ntk_t * pNtk );
......@@ -7605,13 +7608,12 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
extern void Abc_NtkDarTest( Abc_Ntk_t * pNtk );
pNtk = Abc_FrameReadNtk(pAbc);
pOut = Abc_FrameReadOut(pAbc);
pErr = Abc_FrameReadErr(pAbc);
printf( "This command is temporarily disabled.\n" );
return 0;
// printf( "This command is temporarily disabled.\n" );
// return 0;
// set defaults
fVeryVerbose = 0;
......@@ -7789,6 +7791,7 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
// Abc_NtkDarPartition( pNtk );
//Abc_NtkDarTest( pNtk );
/*
// pNtkRes = Abc_NtkDarRetimeStep( pNtk, 0 );
pNtkRes = Abc_NtkDarHaigRecord( pNtk, 3, 3000, 0, 0, 0, 0 );
if ( pNtkRes == NULL )
......@@ -7798,12 +7801,17 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
}
// replace the current network
Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes );
*/
if ( argc != globalUtilOptind + 1 )
goto usage;
pFileName = argv[globalUtilOptind];
Nwk_ManLutMergeGraphTest( pFileName );
return 0;
usage:
fprintf( pErr, "usage: test [-bvwh]\n" );
fprintf( pErr, "usage: test [-h] <file_name>\n" );
fprintf( pErr, "\t testbench for new procedures\n" );
fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
fprintf( pErr, "\t-w : toggle printing very verbose information [default = %s]\n", fVeryVerbose? "yes": "no" );
// fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
// fprintf( pErr, "\t-w : toggle printing very verbose information [default = %s]\n", fVeryVerbose? "yes": "no" );
fprintf( pErr, "\t-h : print the command usage\n");
return 1;
}
......@@ -17321,21 +17329,6 @@ usage:
}
//#include "nwk.h"
// the LUT merging parameters
typedef struct Nwk_LMPars_t_ Nwk_LMPars_t;
struct Nwk_LMPars_t_
{
int nMaxLutSize; // the max LUT size for merging (N=5)
int nMaxSuppSize; // the max total support size after merging (S=5)
int nMaxDistance; // the max number of nodes separating LUTs
int nMaxLevelDiff; // the max difference in levels
int nMaxFanout; // the max number of fanouts to traverse
int fUseTfiTfo; // enables the use of TFO/TFO nodes as candidates
int fVeryVerbose; // enables additional verbose output
int fVerbose; // enables verbose output
};
/**Function*************************************************************
......@@ -17353,11 +17346,6 @@ int Abc_CommandAbc8Merge( Abc_Frame_t * pAbc, int argc, char ** argv )
Nwk_LMPars_t Pars, * pPars = &Pars;
Vec_Int_t * vResult;
int c;
int fUseLutLib = 0;
int Percentage = 100;
int Degree = 5;
int fVerbose = 0;
int fVeryVerbose = 0;
extern Vec_Int_t * Nwk_ManLutMerge( void * pNtk, Nwk_LMPars_t * pPars );
// set defaults
......@@ -17367,11 +17355,12 @@ int Abc_CommandAbc8Merge( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->nMaxDistance = 3; // the max number of nodes separating LUTs
pPars->nMaxLevelDiff = 2; // the max difference in levels
pPars->nMaxFanout = 100; // the max number of fanouts to traverse
pPars->fUseDiffSupp = 0; // enables the use of nodes with different support
pPars->fUseTfiTfo = 0; // enables the use of TFO/TFO nodes as candidates
pPars->fVeryVerbose = 0; // enables additional verbose output
pPars->fVerbose = 1; // enables verbose output
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "NSDLFcvwh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "NSDLFscvwh" ) ) != EOF )
{
switch ( c )
{
......@@ -17430,6 +17419,9 @@ int Abc_CommandAbc8Merge( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( pPars->nMaxFanout < 2 )
goto usage;
break;
case 's':
pPars->fUseDiffSupp ^= 1;
break;
case 'c':
pPars->fUseTfiTfo ^= 1;
break;
......@@ -17456,13 +17448,14 @@ int Abc_CommandAbc8Merge( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;
usage:
fprintf( stdout, "usage: *merge [-NSDLF num] [-cwvh]\n" );
fprintf( stdout, "usage: *merge [-NSDLF num] [-scwvh]\n" );
fprintf( stdout, "\t creates pairs of topologically-related LUTs\n" );
fprintf( stdout, "\t-N <num> : the max LUT size for merging (1 < num) [default = %d]\n", pPars->nMaxLutSize );
fprintf( stdout, "\t-S <num> : the max total support size after merging (1 < num) [default = %d]\n", pPars->nMaxSuppSize );
fprintf( stdout, "\t-D <num> : the max distance in terms of LUTs (0 < num) [default = %d]\n", pPars->nMaxDistance );
fprintf( stdout, "\t-L <num> : the max difference in levels (0 <= num) [default = %d]\n", pPars->nMaxLevelDiff );
fprintf( stdout, "\t-F <num> : the max number of fanouts to stop traversal (0 < num) [default = %d]\n", pPars->nMaxFanout );
fprintf( stdout, "\t-s : toggle the use of nodes without support overlap [default = %s]\n", pPars->fUseDiffSupp? "yes" : "no" );
fprintf( stdout, "\t-c : toggle the use of TFI/TFO nodes as candidates [default = %s]\n", pPars->fUseTfiTfo? "yes" : "no" );
fprintf( stdout, "\t-w : toggle printing detailed stats for each node [default = %s]\n", pPars->fVeryVerbose? "yes": "no" );
fprintf( stdout, "\t-v : toggle printing optimization summary [default = %s]\n", pPars->fVerbose? "yes": "no" );
......
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