summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2020-05-03 12:11:48 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2020-05-03 12:11:48 -0700
commit2b58a83ac082397a025f9d93df32d549aeac2ae9 (patch)
treefc0cfed0e424785d892e2121dd388f2733ed779a
parent559f8f5b5eca41b30e3ee7946a32a03437ad80b8 (diff)
downloadabc-2b58a83ac082397a025f9d93df32d549aeac2ae9.tar.gz
abc-2b58a83ac082397a025f9d93df32d549aeac2ae9.tar.bz2
abc-2b58a83ac082397a025f9d93df32d549aeac2ae9.zip
Adding dumping of genlib library in Verilog.
-rw-r--r--src/map/mio/exp.h30
-rw-r--r--src/map/mio/mioUtils.c30
2 files changed, 30 insertions, 30 deletions
diff --git a/src/map/mio/exp.h b/src/map/mio/exp.h
index adbc2f58..962e218a 100644
--- a/src/map/mio/exp.h
+++ b/src/map/mio/exp.h
@@ -121,36 +121,6 @@ static inline void Exp_Print( int nVars, Vec_Int_t * p )
Exp_PrintLit( nVars, Vec_IntEntryLast(p) );
Abc_Print( 1, "\n" );
}
-static inline void Exp_PrintNodeVerilog( FILE * pFile, int nVars, Vec_Int_t * p, Vec_Ptr_t * vNames, int Node, int fCompl )
-{
- static void Exp_PrintLitVerilog( FILE * pFile, int nVars, Vec_Int_t * p, Vec_Ptr_t * vNames, int Lit );
- if ( Vec_IntEntry(p, 2*Node+1) >= 2*nVars )
- fprintf( pFile, "(" );
- Exp_PrintLitVerilog( pFile, nVars, p, vNames, Vec_IntEntry(p, 2*Node+1) ^ fCompl );
- if ( Vec_IntEntry(p, 2*Node+1) >= 2*nVars )
- fprintf( pFile, ")" );
- fprintf( pFile, " %c ", fCompl ? '|' : '&' );
- if ( Vec_IntEntry(p, 2*Node+0) >= 2*nVars )
- fprintf( pFile, "(" );
- Exp_PrintLitVerilog( pFile, nVars, p, vNames, Vec_IntEntry(p, 2*Node+0) ^ fCompl );
- if ( Vec_IntEntry(p, 2*Node+0) >= 2*nVars )
- fprintf( pFile, ")" );
-}
-static inline void Exp_PrintLitVerilog( FILE * pFile, int nVars, Vec_Int_t * p, Vec_Ptr_t * vNames, int Lit )
-{
- if ( Lit == EXP_CONST0 )
- fprintf( pFile, "1\'b0" );
- else if ( Lit == EXP_CONST1 )
- fprintf( pFile, "1\'b1" );
- else if ( Lit < 2 * nVars )
- fprintf( pFile, "%s%s", (Lit&1) ? "~" : "", (char *)Vec_PtrEntry(vNames, Lit/2) );
- else
- Exp_PrintNodeVerilog( pFile, nVars, p, vNames, Lit/2-nVars, Lit&1 );
-}
-static inline void Exp_PrintVerilog( FILE * pFile, int nVars, Vec_Int_t * p, Vec_Ptr_t * vNames )
-{
- Exp_PrintLitVerilog( pFile, nVars, p, vNames, Vec_IntEntryLast(p) );
-}
static inline Vec_Int_t * Exp_Reverse( Vec_Int_t * p )
{
Vec_IntReverseOrder( p );
diff --git a/src/map/mio/mioUtils.c b/src/map/mio/mioUtils.c
index 2adb2bd0..19b69861 100644
--- a/src/map/mio/mioUtils.c
+++ b/src/map/mio/mioUtils.c
@@ -297,6 +297,36 @@ void Mio_WriteLibrary( FILE * pFile, Mio_Library_t * pLib, int fPrintSops, int f
SeeAlso []
***********************************************************************/
+void Exp_PrintNodeVerilog( FILE * pFile, int nVars, Vec_Int_t * p, Vec_Ptr_t * vNames, int Node, int fCompl )
+{
+ extern void Exp_PrintLitVerilog( FILE * pFile, int nVars, Vec_Int_t * p, Vec_Ptr_t * vNames, int Lit );
+ if ( Vec_IntEntry(p, 2*Node+1) >= 2*nVars )
+ fprintf( pFile, "(" );
+ Exp_PrintLitVerilog( pFile, nVars, p, vNames, Vec_IntEntry(p, 2*Node+1) ^ fCompl );
+ if ( Vec_IntEntry(p, 2*Node+1) >= 2*nVars )
+ fprintf( pFile, ")" );
+ fprintf( pFile, " %c ", fCompl ? '|' : '&' );
+ if ( Vec_IntEntry(p, 2*Node+0) >= 2*nVars )
+ fprintf( pFile, "(" );
+ Exp_PrintLitVerilog( pFile, nVars, p, vNames, Vec_IntEntry(p, 2*Node+0) ^ fCompl );
+ if ( Vec_IntEntry(p, 2*Node+0) >= 2*nVars )
+ fprintf( pFile, ")" );
+}
+void Exp_PrintLitVerilog( FILE * pFile, int nVars, Vec_Int_t * p, Vec_Ptr_t * vNames, int Lit )
+{
+ if ( Lit == EXP_CONST0 )
+ fprintf( pFile, "1\'b0" );
+ else if ( Lit == EXP_CONST1 )
+ fprintf( pFile, "1\'b1" );
+ else if ( Lit < 2 * nVars )
+ fprintf( pFile, "%s%s", (Lit&1) ? "~" : "", (char *)Vec_PtrEntry(vNames, Lit/2) );
+ else
+ Exp_PrintNodeVerilog( pFile, nVars, p, vNames, Lit/2-nVars, Lit&1 );
+}
+void Exp_PrintVerilog( FILE * pFile, int nVars, Vec_Int_t * p, Vec_Ptr_t * vNames )
+{
+ Exp_PrintLitVerilog( pFile, nVars, p, vNames, Vec_IntEntryLast(p) );
+}
void Mio_WriteGateVerilog( FILE * pFile, Mio_Gate_t * pGate, Vec_Ptr_t * vNames )
{
char * pName; int i;