Commit faf8d6ec by Vinicius Callegaro

Disjoint-support decomposition with cofactoring and boolean difference analysis

from V. Callegaro, F. S. Marranghello, M. G. A. Martins, R. P. Ribas and A. I. Reis,
entitled "Bottom-up disjoint-support decomposition based on cofactor and boolean difference analysis" presented in ICCD'15.
parent 6cd66183
......@@ -22,7 +22,7 @@ MODULES := \
src/misc/mem src/misc/bar src/misc/bbl src/misc/parse \
src/opt/cut src/opt/fxu src/opt/fxch src/opt/rwr src/opt/mfs src/opt/sim \
src/opt/ret src/opt/fret src/opt/res src/opt/lpk src/opt/nwk src/opt/rwt \
src/opt/cgt src/opt/csw src/opt/dar src/opt/dau src/opt/sfm \
src/opt/cgt src/opt/csw src/opt/dar src/opt/dau src/opt/dsc src/opt/sfm \
src/sat/bsat src/sat/csat src/sat/msat src/sat/psat src/sat/cnf src/sat/bmc \
src/bool/bdc src/bool/deco src/bool/dec src/bool/kit src/bool/lucky \
src/bool/rsb src/bool/rpo \
......
......@@ -6212,6 +6212,9 @@ usage:
Abc_Print( -2, "\t 3: disjoint-support decomposition with cofactoring\n" );
Abc_Print( -2, "\t 4: updated disjoint-support decomposition with cofactoring\n" );
Abc_Print( -2, "\t 5: enumerating decomposable variable sets\n" );
Abc_Print( -2, "\t 6: disjoint-support decomposition with cofactoring and boolean difference analysis\n" );
Abc_Print( -2, "\t from V. Callegaro, F. S. Marranghello, M. G. A. Martins, R. P. Ribas and A. I. Reis,\n");
Abc_Print( -2, "\t \"Bottom-up disjoint-support decomposition based on cofactor and boolean difference analysis,\" ICCD'15.\n" );
Abc_Print( -2, "\t-N <num> : the number of support variables (binary files only) [default = unused]\n" );
Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
......@@ -26,6 +26,7 @@
#include "bool/kit/kit.h"
#include "opt/dau/dau.h"
#include "misc/util/utilTruth.h"
#include "opt/dsc/dsc.h"
ABC_NAMESPACE_IMPL_START
......@@ -484,6 +485,8 @@ void Abc_TruthDecPerform( Abc_TtStore_t * p, int DecType, int fVerbose )
pAlgoName = "fast DSD";
else if ( DecType == 5 )
pAlgoName = "analysis";
else if ( DecType == 6 )
pAlgoName = "DSD ICCD'15";
if ( pAlgoName )
printf( "Applying %-10s to %8d func%s of %2d vars... ",
......@@ -577,6 +580,23 @@ void Abc_TruthDecPerform( Abc_TtStore_t * p, int DecType, int fVerbose )
if ( fVerbose )
printf( "\n" );
}
} else if ( DecType == 6 )
{
char pDsd[DSC_MAX_STR];
/* memory pool with a capacity of storing 3*nVars
truth-tables for negative and positive cofactors and
the boolean difference for each input variable */
word *mem_pool = Dsc_alloc_pool(p->nVars);
for ( i = 0; i < p->nFuncs; i++ )
{
if ( fVerbose )
printf( "%7d : ", i );
Dsc_Decompose(p->pFuncs[i], p->nVars, pDsd, mem_pool);
if ( fVerbose )
printf( "%s\n", pDsd[0] ? pDsd : "NULL");
nNodes += Dsc_CountAnds( pDsd );
}
Dsc_free_pool(mem_pool);
}
else assert( 0 );
......@@ -629,7 +649,7 @@ int Abc_DecTest( char * pFileName, int DecType, int nVarNum, int fVerbose )
printf( "Using truth tables from file \"%s\"...\n", pFileName );
if ( DecType == 0 )
{ if ( nVarNum < 0 ) Abc_TtStoreTest( pFileName ); }
else if ( DecType >= 1 && DecType <= 5 )
else if ( DecType >= 1 && DecType <= 6 )
Abc_TruthDecTest( pFileName, DecType, nVarNum, fVerbose );
else
printf( "Unknown decomposition type value (%d).\n", DecType );
......
/**CFile****************************************************************
FileName [dsc.h]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Disjoint support decomposition - ICCD'15]
Synopsis [Disjoint-support decomposition with cofactoring and boolean difference analysis
from V. Callegaro, F. S. Marranghello, M. G. A. Martins, R. P. Ribas and A. I. Reis,
"Bottom-up disjoint-support decomposition based on cofactor and boolean difference analysis," ICCD'15]
Author [Vinicius Callegaro, Mayler G. A. Martins, Felipe S. Marranghello, Renato P. Ribas and Andre I. Reis]
Affiliation [UFRGS - Federal University of Rio Grande do Sul - Brazil]
Date [Ver. 1.0. Started - October 24, 2014.]
Revision [$Id: dsc.h,v 1.00 2014/10/24 00:00:00 vcallegaro Exp $]
***********************************************************************/
#ifndef ABC__DSC___h
#define ABC__DSC___h
////////////////////////////////////////////////////////////////////////
/// INCLUDES ///
////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#include <string.h>
#include "misc/util/abc_global.h"
////////////////////////////////////////////////////////////////////////
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_HEADER_START
#define DSC_MAX_VAR 16 // should be 6 or more, i.e. DSC_MAX_VAR >= 6
#define DSC_MAX_STR DSC_MAX_VAR << 2 // DSC_MAX_VAR * 4
////////////////////////////////////////////////////////////////////////
/// BASIC TYPES ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// MACRO DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
/*=== dsc.c ==========================================================*/
/**
* memory allocator with a capacity of storing 3*nVars
* truth-tables for negative and positive cofactors and
* the boolean difference for each input variable
*/
extern word * Dsc_alloc_pool(int nVars);
/**
* This method implements the paper proposed by V. Callegaro, F. S. Marranghello, M. G. A. Martins, R. P. Ribas and A. I. Reis,
* entitled "Bottom-up disjoint-support decomposition based on cofactor and boolean difference analysis", presented at ICCD 2015.
* pTruth: pointer for the truth table representing the target function.
* nVarsInit: the number of variables of the truth table of the target function.
* pRes: pointer for storing the resulting decomposition, whenever a decomposition can be found.
* pool: NULL or a pointer for with a capacity of storing 3*nVars truth-tables. IF NULL, the function will allocate and free the memory of each call.
* (the results presented on ICCD paper are running this method with NULL for the memory pool).
* The method returns 0 if a full decomposition was found and a negative value otherwise.
*/
extern int Dsc_Decompose(word * pTruth, const int nVarsInit, char * const pRes, word *pool);
/**
* just free the memory pool
*/
extern void Dsc_free_pool(word * pool);
int * Dsc_ComputeMatches( char * p );
int Dsc_CountAnds_rec( char * pStr, char ** p, int * pMatches );
extern int Dsc_CountAnds( char * pDsd );
ABC_NAMESPACE_HEADER_END
#endif
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
SRC += src/opt/dsc/dsc.c
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