summaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2020-03-18 22:34:08 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2020-03-18 22:34:08 -0700
commit6a6ffed8c545cd76d479da6a8a1d1e5aa35b1037 (patch)
treebd13cd66aa186c654d126d25e06a460e3aa28d34 /src/base
parente72438b2d3b83d9a5ac646a2499f4374b29ebfbd (diff)
downloadabc-6a6ffed8c545cd76d479da6a8a1d1e5aa35b1037.tar.gz
abc-6a6ffed8c545cd76d479da6a8a1d1e5aa35b1037.tar.bz2
abc-6a6ffed8c545cd76d479da6a8a1d1e5aa35b1037.zip
Various changes.
Diffstat (limited to 'src/base')
-rw-r--r--src/base/abc/abc.h2
-rw-r--r--src/base/abc/abcNtk.c33
-rw-r--r--src/base/abc/abcUtil.c6
-rw-r--r--src/base/acb/acbFunc.c140
-rw-r--r--src/base/acb/acbUtil.c44
5 files changed, 206 insertions, 19 deletions
diff --git a/src/base/abc/abc.h b/src/base/abc/abc.h
index 185ac7b9..312354da 100644
--- a/src/base/abc/abc.h
+++ b/src/base/abc/abc.h
@@ -789,7 +789,7 @@ extern ABC_DLL void Abc_NtkMakeComb( Abc_Ntk_t * pNtk, int fRemove
extern ABC_DLL void Abc_NtkPermute( Abc_Ntk_t * pNtk, int fInputs, int fOutputs, int fFlops, char * pFlopPermFile );
extern ABC_DLL void Abc_NtkUnpermute( Abc_Ntk_t * pNtk );
extern ABC_DLL Abc_Ntk_t * Abc_NtkCreateFromSops( char * pName, Vec_Ptr_t * vSops );
-extern ABC_DLL Abc_Ntk_t * Abc_NtkCreateFromGias( char * pName, Vec_Ptr_t * vGias );
+extern ABC_DLL Abc_Ntk_t * Abc_NtkCreateFromGias( char * pName, Vec_Ptr_t * vGias, Gia_Man_t * pMulti );
/*=== abcObj.c ==========================================================*/
extern ABC_DLL Abc_Obj_t * Abc_ObjAlloc( Abc_Ntk_t * pNtk, Abc_ObjType_t Type );
extern ABC_DLL void Abc_ObjRecycle( Abc_Obj_t * pObj );
diff --git a/src/base/abc/abcNtk.c b/src/base/abc/abcNtk.c
index 8e10ab3b..7c54f3c4 100644
--- a/src/base/abc/abcNtk.c
+++ b/src/base/abc/abcNtk.c
@@ -2250,15 +2250,43 @@ Abc_Ntk_t * Abc_NtkCreateFromSops( char * pName, Vec_Ptr_t * vSops )
SeeAlso []
***********************************************************************/
-Abc_Ntk_t * Abc_NtkCreateFromGias( char * pName, Vec_Ptr_t * vGias )
+Abc_Ntk_t * Abc_NtkCreateFromGias( char * pName, Vec_Ptr_t * vGias, Gia_Man_t * pMulti )
{
- Gia_Man_t * pGia = (Gia_Man_t *)Vec_PtrEntry(vGias, 0);
+ Gia_Man_t * pGia = pMulti ? pMulti : (Gia_Man_t *)Vec_PtrEntry(vGias, 0);
Abc_Ntk_t * pNtk = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
Abc_Obj_t * pAbcObj, * pAbcObjPo;
Gia_Obj_t * pObj; int i, k;
pNtk->pName = Extra_UtilStrsav( pName );
for ( k = 0; k < Gia_ManCiNum(pGia); k++ )
Abc_NtkCreatePi( pNtk );
+ if ( pMulti )
+ {
+ Gia_ManCleanValue(pGia);
+ Gia_ManForEachCi( pGia, pObj, k )
+ pObj->Value = Abc_ObjId( Abc_NtkCi(pNtk, k) );
+ Gia_ManForEachAnd( pGia, pObj, k )
+ {
+ Abc_Obj_t * pAbcObj0 = Abc_NtkObj( pNtk, Gia_ObjFanin0(pObj)->Value );
+ Abc_Obj_t * pAbcObj1 = Abc_NtkObj( pNtk, Gia_ObjFanin1(pObj)->Value );
+ pAbcObj0 = Abc_ObjNotCond( pAbcObj0, Gia_ObjFaninC0(pObj) );
+ pAbcObj1 = Abc_ObjNotCond( pAbcObj1, Gia_ObjFaninC1(pObj) );
+ pAbcObj = Abc_AigAnd( (Abc_Aig_t *)pNtk->pManFunc, pAbcObj0, pAbcObj1 );
+ pObj->Value = Abc_ObjId( pAbcObj );
+ }
+ Gia_ManForEachCo( pGia, pObj, k )
+ {
+ //pObj = Gia_ManCo(pGia, 0);
+ if ( Gia_ObjFaninId0p(pGia, pObj) == 0 )
+ pAbcObj = Abc_ObjNot( Abc_AigConst1(pNtk) );
+ else
+ pAbcObj = Abc_NtkObj( pNtk, Gia_ObjFanin0(pObj)->Value );
+ pAbcObj = Abc_ObjNotCond( pAbcObj, Gia_ObjFaninC0(pObj) );
+ pAbcObjPo = Abc_NtkCreatePo( pNtk );
+ Abc_ObjAddFanin( pAbcObjPo, pAbcObj );
+ }
+ }
+ else
+ {
Vec_PtrForEachEntry( Gia_Man_t *, vGias, pGia, i )
{
assert( Gia_ManCoNum(pGia) == 1 );
@@ -2283,6 +2311,7 @@ Abc_Ntk_t * Abc_NtkCreateFromGias( char * pName, Vec_Ptr_t * vGias )
pAbcObjPo = Abc_NtkCreatePo( pNtk );
Abc_ObjAddFanin( pAbcObjPo, pAbcObj );
}
+ }
Abc_NtkAddDummyPiNames( pNtk );
Abc_NtkAddDummyPoNames( pNtk );
return pNtk;
diff --git a/src/base/abc/abcUtil.c b/src/base/abc/abcUtil.c
index 038079e8..1f0c9725 100644
--- a/src/base/abc/abcUtil.c
+++ b/src/base/abc/abcUtil.c
@@ -3141,10 +3141,10 @@ Vec_Wec_t * Abc_SopSynthesize( Vec_Ptr_t * vSops )
assert( Vec_WecSize(vRes) == iNode );
return vRes;
}
-Vec_Wec_t * Abc_GiaSynthesize( Vec_Ptr_t * vGias )
+Vec_Wec_t * Abc_GiaSynthesize( Vec_Ptr_t * vGias, Gia_Man_t * pMulti )
{
Vec_Wec_t * vRes = NULL;
- Abc_Ntk_t * pNtk = Abc_NtkCreateFromGias( "top", vGias );
+ Abc_Ntk_t * pNtk = Abc_NtkCreateFromGias( "top", vGias, pMulti );
Abc_Ntk_t * pNtkNew;
Abc_Obj_t * pObj, * pFanin;
int i, k, iNode = 0;
@@ -3173,7 +3173,7 @@ Gia_Man_t * Abc_GiaSynthesizeInter( Gia_Man_t * p )
Abc_Ntk_t * pNtkNew, * pNtk;
Vec_Ptr_t * vGias = Vec_PtrAlloc( 1 );
Vec_PtrPush( vGias, p );
- pNtk = Abc_NtkCreateFromGias( "top", vGias );
+ pNtk = Abc_NtkCreateFromGias( "top", vGias, NULL );
Vec_PtrFree( vGias );
Abc_FrameReplaceCurrentNetwork( Abc_FrameReadGlobalFrame(), pNtk );
Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "balance; collapse; muxes; strash; dc2" );
diff --git a/src/base/acb/acbFunc.c b/src/base/acb/acbFunc.c
index 4c8ad4eb..f063f7fb 100644
--- a/src/base/acb/acbFunc.c
+++ b/src/base/acb/acbFunc.c
@@ -1893,8 +1893,8 @@ Vec_Ptr_t * Acb_GenerateSignalNames( Acb_Ntk_t * p, Vec_Int_t * vDivs, Vec_Int_t
Vec_Str_t * Acb_GeneratePatch( Acb_Ntk_t * p, Vec_Int_t * vDivs, Vec_Int_t * vUsed, Vec_Ptr_t * vSops, Vec_Ptr_t * vGias, Vec_Int_t * vTars )
{
extern Vec_Wec_t * Abc_SopSynthesize( Vec_Ptr_t * vSops );
- extern Vec_Wec_t * Abc_GiaSynthesize( Vec_Ptr_t * vGias );
- Vec_Wec_t * vGates = vGias ? Abc_GiaSynthesize(vGias) : Abc_SopSynthesize(vSops); Vec_Int_t * vGate;
+ extern Vec_Wec_t * Abc_GiaSynthesize( Vec_Ptr_t * vGias, Gia_Man_t * pMulti );
+ Vec_Wec_t * vGates = vGias ? Abc_GiaSynthesize(vGias, NULL) : Abc_SopSynthesize(vSops); Vec_Int_t * vGate;
int nOuts = vGias ? Vec_PtrSize(vGias) : Vec_PtrSize(vSops);
int i, k, iObj, nWires = Vec_WecSize(vGates) - Vec_IntSize(vUsed) - nOuts, fFirst = 1;
Vec_Ptr_t * vNames = Acb_GenerateSignalNames( p, vDivs, vUsed, nWires, vTars, vGates );
@@ -1961,6 +1961,142 @@ Vec_Str_t * Acb_GeneratePatch( Acb_Ntk_t * p, Vec_Int_t * vDivs, Vec_Int_t * vUs
/**Function*************************************************************
+ Synopsis [Patch generation.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+Vec_Str_t * Acb_GenerateInstance2( Vec_Ptr_t * vIns, Vec_Ptr_t * vOuts )
+{
+ char * pName; int i;
+ Vec_Str_t * vStr = Vec_StrAlloc( 100 );
+ Vec_StrAppend( vStr, " patch p0 (" );
+ Vec_PtrForEachEntry( char *, vOuts, pName, i )
+ Vec_StrPrintF( vStr, "%s .%s(target_%s)", i ? ",":"", pName, pName );
+ Vec_PtrForEachEntry( char *, vIns, pName, i )
+ Vec_StrPrintF( vStr, ", .%s(%s)", pName, pName );
+ Vec_StrAppend( vStr, " );\n\n" );
+ Vec_StrPush( vStr, '\0' );
+ return vStr;
+}
+Vec_Ptr_t * Acb_GenerateSignalNames2( Vec_Wec_t * vGates, Vec_Ptr_t * vIns, Vec_Ptr_t * vOuts )
+{
+ int nIns = Vec_PtrSize(vIns), nOuts = Vec_PtrSize(vOuts);
+ int nNodes = Vec_WecSize(vGates) - nIns - nOuts;
+ Vec_Ptr_t * vRes = Vec_PtrStart( Vec_WecSize(vGates) ); char * pName;
+ Vec_Str_t * vStr = Vec_StrAlloc(1000); int i, nWires = 1;
+ // create input names
+ Vec_PtrForEachEntry( char *, vIns, pName, i )
+ Vec_PtrWriteEntry( vRes, i, Abc_UtilStrsav(pName) );
+ // create names for nodes driving outputs
+ Vec_PtrForEachEntry( char *, vOuts, pName, i )
+ {
+ Vec_Int_t * vGate = Vec_WecEntry( vGates, nIns + nNodes + i );
+ assert( Vec_IntEntry(vGate, 0) == ABC_OPER_BIT_BUF );
+ Vec_PtrWriteEntry( vRes, Vec_IntEntry(vGate, 1), Abc_UtilStrsav(pName) );
+ }
+ for ( i = nIns; i < nIns + nNodes; i++ )
+ if ( Vec_PtrEntry(vRes, i) == NULL )
+ {
+ Vec_StrPrintF( vStr, "ww%d", nWires++ );
+ Vec_StrPush( vStr, '\0' );
+ Vec_PtrWriteEntry( vRes, i, Vec_StrReleaseArray(vStr) );
+ }
+ Vec_StrFree( vStr );
+ return vRes;
+}
+Vec_Str_t * Acb_GeneratePatch2( Gia_Man_t * pGia, Vec_Ptr_t * vIns, Vec_Ptr_t * vOuts )
+{
+ extern Vec_Wec_t * Abc_GiaSynthesize( Vec_Ptr_t * vGias, Gia_Man_t * pMulti );
+ Vec_Wec_t * vGates = Abc_GiaSynthesize( NULL, pGia ); Vec_Int_t * vGate;
+ int nIns = Vec_PtrSize(vIns), nOuts = Vec_PtrSize(vOuts); char * pName;
+ int i, k, iObj, nWires = Vec_WecSize(vGates) - nIns - nOuts, fFirst = 1;
+ Vec_Ptr_t * vNames = Acb_GenerateSignalNames2( vGates, vIns, vOuts );
+
+ Vec_Str_t * vStr = Vec_StrAlloc( 100 );
+ Vec_StrAppend( vStr, "module patch (" );
+
+ Vec_PtrForEachEntry( char *, vOuts, pName, i )
+ Vec_StrPrintF( vStr, "%s %s", i ? ",":"", pName );
+ Vec_PtrForEachEntry( char *, vIns, pName, i )
+ Vec_StrPrintF( vStr, ", %s", pName );
+ Vec_StrAppend( vStr, " );\n\n" );
+
+ Vec_StrAppend( vStr, " output" );
+ Vec_PtrForEachEntry( char *, vOuts, pName, i )
+ Vec_StrPrintF( vStr, "%s %s", i ? ",":"", pName );
+ Vec_StrAppend( vStr, ";\n" );
+
+ Vec_StrAppend( vStr, " input" );
+ Vec_PtrForEachEntry( char *, vIns, pName, i )
+ Vec_StrPrintF( vStr, "%s %s", i ? ",":"", pName );
+ Vec_StrAppend( vStr, ";\n" );
+
+ if ( nWires > nOuts )
+ {
+ Vec_StrAppend( vStr, " wire" );
+ for ( i = 0; i < nWires; i++ )
+ {
+ char * pName = (char *)Vec_PtrEntry( vNames, nIns+i );
+ if ( !strncmp(pName, "ww", 2) )
+ Vec_StrPrintF( vStr, "%s %s", fFirst ? "":",", pName ), fFirst = 0;
+ }
+ Vec_StrAppend( vStr, ";\n\n" );
+ }
+
+ // create internal nodes
+ Vec_WecForEachLevelStartStop( vGates, vGate, i, nIns, nIns+nWires )
+ {
+ if ( Vec_IntSize(vGate) > 2 )
+ {
+ Vec_StrPrintF( vStr, " %s (", Acb_Oper2Name(Vec_IntEntry(vGate, 0)) );
+ Vec_IntForEachEntryStart( vGate, iObj, k, 1 )
+ Vec_StrPrintF( vStr, "%s %s", k > 1 ? ",":"", (char *)Vec_PtrEntry(vNames, iObj) );
+ Vec_StrAppend( vStr, " );\n" );
+ }
+ else
+ {
+ assert( Vec_IntEntry(vGate, 0) == ABC_OPER_CONST_F || Vec_IntEntry(vGate, 0) == ABC_OPER_CONST_T );
+ Vec_StrPrintF( vStr, " %s (", Acb_Oper2Name( ABC_OPER_BIT_BUF ) );
+ Vec_StrPrintF( vStr, " %s, ", (char *)Vec_PtrEntry(vNames, Vec_IntEntry(vGate, 1)) );
+ Vec_StrPrintF( vStr, " 1\'b%d", Vec_IntEntry(vGate, 0) == ABC_OPER_CONST_T );
+ Vec_StrPrintF( vStr, " );\n" );
+ }
+ }
+ Vec_StrAppend( vStr, "\nendmodule\n\n" );
+ Vec_StrPush( vStr, '\0' );
+ Vec_PtrFreeFree( vNames );
+ Vec_WecFree( vGates );
+
+ printf( "Synthesized patch with %d inputs, %d outputs and %d gates.\n", nIns, nOuts, nWires );
+ return vStr;
+}
+void Acb_GenerateFile2( Gia_Man_t * pGia, Vec_Ptr_t * vIns, Vec_Ptr_t * vOuts, char * pFileName, char * pFileNameOut )
+{
+ extern void Acb_GenerateFilePatch( Vec_Str_t * p, char * pFileNamePatch );
+ extern void Acb_GenerateFileOut( Vec_Str_t * vPatchLine, char * pFileNameF, char * pFileNameOut, Vec_Str_t * vPatch );
+ extern void Acb_NtkInsert( char * pFileNameIn, char * pFileNameOut, Vec_Ptr_t * vNames, int fNumber );
+ Vec_Str_t * vInst = Acb_GenerateInstance2( vIns, vOuts );
+ Vec_Str_t * vPatch = Acb_GeneratePatch2( pGia, vIns, vOuts );
+ //printf( "%s", Vec_StrArray(vPatch) );
+ //Gia_AigerWrite( pGia, "test.aig", 0, 0, 0 );
+ // generate output files
+ Acb_GenerateFilePatch( vPatch, "patch.v" );
+ printf( "Finished dumping patch file \"%s\".\n", "patch.v" );
+ Acb_NtkInsert( pFileName, "temp.v", vOuts, 0 );
+ printf( "Finished dumping intermediate file \"%s\".\n", "temp.v" );
+ Acb_GenerateFileOut( vInst, "temp.v", pFileNameOut, vPatch );
+ printf( "Finished dumping the resulting file \"%s\".\n", pFileNameOut );
+ Vec_StrFree( vInst );
+ Vec_StrFree( vPatch );
+}
+
+/**Function*************************************************************
+
Synopsis [Produce output files.]
Description []
diff --git a/src/base/acb/acbUtil.c b/src/base/acb/acbUtil.c
index dfebd720..6c409c45 100644
--- a/src/base/acb/acbUtil.c
+++ b/src/base/acb/acbUtil.c
@@ -589,13 +589,14 @@ Gia_Man_t * Acb_NtkToGia2( Acb_Ntk_t * p, int fUseXors, Vec_Int_t * vTargets, in
SeeAlso []
***********************************************************************/
-Vec_Int_t * Acb_NtkCollectCopies( Acb_Ntk_t * p, Gia_Man_t * pGia, Vec_Ptr_t ** pvNodesR )
+Vec_Int_t * Acb_NtkCollectCopies( Acb_Ntk_t * p, Gia_Man_t * pGia, Vec_Ptr_t ** pvNodesR, Vec_Bit_t ** pvPolar )
{
int i, iObj, iLit, nTargets = Vec_IntSize(&p->vTargets);
Vec_Int_t * vObjs = Acb_NtkFindNodes2( p );
Vec_Int_t * vNodes = Vec_IntAlloc( Acb_NtkObjNum(p) );
Vec_Ptr_t * vNodesR = Vec_PtrStart( Gia_ManObjNum(pGia) );
Vec_Bit_t * vDriver = Vec_BitStart( Gia_ManObjNum(pGia) );
+ Vec_Bit_t * vPolar = Vec_BitStart( Gia_ManObjNum(pGia) );
Gia_ManForEachCiId( pGia, iObj, i )
if ( i < Gia_ManCiNum(pGia) - nTargets )
Vec_PtrWriteEntry( vNodesR, iObj, Abc_UtilStrsav(Acb_ObjNameStr(p, Acb_NtkCi(p, i))) );
@@ -614,12 +615,14 @@ Vec_Int_t * Acb_NtkCollectCopies( Acb_Ntk_t * p, Gia_Man_t * pGia, Vec_Ptr_t **
{
Vec_PtrWriteEntry( vNodesR, Abc_Lit2Var(iLit), Abc_UtilStrsav(Acb_ObjNameStr(p, iObj)) );
Vec_IntPush( vNodes, Abc_Lit2Var(iLit) );
+ Vec_BitWriteEntry( vPolar, Abc_Lit2Var(iLit), Abc_LitIsCompl(iLit) );
}
}
Vec_BitFree( vDriver );
Vec_IntFree( vObjs );
Vec_IntSort( vNodes, 0 );
*pvNodesR = vNodesR;
+ *pvPolar = vPolar;
return vNodes;
}
Vec_Int_t * Acb_NtkCollectUser( Acb_Ntk_t * p, Vec_Ptr_t * vUser )
@@ -656,7 +659,7 @@ Vec_Int_t * Acb_NtkCollectUser( Acb_Ntk_t * p, Vec_Ptr_t * vUser )
***********************************************************************/
int Acb_NtkExtract( char * pFileName0, char * pFileName1, int fUseXors, int fVerbose,
- Gia_Man_t ** ppGiaF, Gia_Man_t ** ppGiaG, Vec_Int_t ** pvNodes, Vec_Ptr_t ** pvNodesR )
+ Gia_Man_t ** ppGiaF, Gia_Man_t ** ppGiaG, Vec_Int_t ** pvNodes, Vec_Ptr_t ** pvNodesR, Vec_Bit_t ** pvPolar )
{
extern Acb_Ntk_t * Acb_VerilogSimpleRead( char * pFileName, char * pFileNameW );
Acb_Ntk_t * pNtkF = Acb_VerilogSimpleRead( pFileName0, NULL );
@@ -671,7 +674,7 @@ int Acb_NtkExtract( char * pFileName0, char * pFileName1, int fUseXors, int fVer
assert( Acb_NtkCoNum(pNtkF) == Acb_NtkCoNum(pNtkG) );
*ppGiaF = pGiaF;
*ppGiaG = pGiaG;
- *pvNodes = Acb_NtkCollectCopies( pNtkF, pGiaF, pvNodesR );
+ *pvNodes = Acb_NtkCollectCopies( pNtkF, pGiaF, pvNodesR, pvPolar );
RetValue = nTargets;
}
if ( pNtkF ) Acb_ManFree( pNtkF->pDesign );
@@ -690,7 +693,7 @@ int Acb_NtkExtract( char * pFileName0, char * pFileName1, int fUseXors, int fVer
SeeAlso []
***********************************************************************/
-Vec_Int_t * Abc_NtkCollectCopies( Abc_Ntk_t * p, Gia_Man_t * pGia, Vec_Ptr_t ** pvNodesR )
+Vec_Int_t * Abc_NtkCollectCopies( Abc_Ntk_t * p, Gia_Man_t * pGia, Vec_Ptr_t ** pvNodesR, Vec_Bit_t ** pvPolar )
{
int i, iObj, iLit;
Abc_Obj_t * pObj;
@@ -698,6 +701,7 @@ Vec_Int_t * Abc_NtkCollectCopies( Abc_Ntk_t * p, Gia_Man_t * pGia, Vec_Ptr_t **
Vec_Int_t * vNodes = Vec_IntAlloc( Abc_NtkObjNumMax(p) );
Vec_Ptr_t * vNodesR = Vec_PtrStart( Gia_ManObjNum(pGia) );
Vec_Bit_t * vDriver = Vec_BitStart( Gia_ManObjNum(pGia) );
+ Vec_Bit_t * vPolar = Vec_BitStart( Gia_ManObjNum(pGia) );
Gia_ManForEachCiId( pGia, iObj, i )
Vec_PtrWriteEntry( vNodesR, iObj, Abc_UtilStrsav(Abc_ObjName(Abc_NtkCi(p, i))) );
Gia_ManForEachCoId( pGia, iObj, i )
@@ -713,12 +717,14 @@ Vec_Int_t * Abc_NtkCollectCopies( Abc_Ntk_t * p, Gia_Man_t * pGia, Vec_Ptr_t **
{
Vec_PtrWriteEntry( vNodesR, Abc_Lit2Var(iLit), Abc_UtilStrsav(Abc_ObjName(pObj)) );
Vec_IntPush( vNodes, Abc_Lit2Var(iLit) );
+ Vec_BitWriteEntry( vPolar, Abc_Lit2Var(iLit), Abc_LitIsCompl(iLit) );
}
}
Vec_BitFree( vDriver );
Vec_PtrFree( vObjs );
Vec_IntSort( vNodes, 0 );
*pvNodesR = vNodesR;
+ *pvPolar = vPolar;
return vNodes;
}
int Abc_ObjToGia2( Gia_Man_t * pNew, Abc_Ntk_t * p, Abc_Obj_t * pObj, Vec_Int_t * vTemp, int fUseXors )
@@ -766,7 +772,7 @@ Gia_Man_t * Abc_NtkToGia2( Abc_Ntk_t * p, int fUseXors )
return pNew;
}
int Abc_NtkExtract( char * pFileName0, char * pFileName1, int fUseXors, int fVerbose,
- Gia_Man_t ** ppGiaF, Gia_Man_t ** ppGiaG, Vec_Int_t ** pvNodes, Vec_Ptr_t ** pvNodesR )
+ Gia_Man_t ** ppGiaF, Gia_Man_t ** ppGiaG, Vec_Int_t ** pvNodes, Vec_Ptr_t ** pvNodesR, Vec_Bit_t ** pvPolar )
{
Abc_Ntk_t * pNtkF = Io_Read( pFileName0, Io_ReadFileType(pFileName0), 1, 0 );
Abc_Ntk_t * pNtkG = Io_Read( pFileName1, Io_ReadFileType(pFileName1), 1, 0 );
@@ -779,7 +785,7 @@ int Abc_NtkExtract( char * pFileName0, char * pFileName1, int fUseXors, int fVer
assert( Abc_NtkCoNum(pNtkF) == Abc_NtkCoNum(pNtkG) );
*ppGiaF = pGiaF;
*ppGiaG = pGiaG;
- *pvNodes = Abc_NtkCollectCopies( pNtkF, pGiaF, pvNodesR );
+ *pvNodes = Abc_NtkCollectCopies( pNtkF, pGiaF, pvNodesR, pvPolar );
RetValue = 0;
}
if ( pNtkF ) Abc_NtkDelete( pNtkF );
@@ -839,7 +845,7 @@ Vec_Int_t * Acb_NtkPlaces( char * pFileName, Vec_Ptr_t * vNames )
ABC_FREE( pBuffer );
return vPlaces;
}
-void Acb_NtkInsert( char * pFileNameIn, char * pFileNameOut, Vec_Ptr_t * vNames )
+void Acb_NtkInsert( char * pFileNameIn, char * pFileNameOut, Vec_Ptr_t * vNames, int fNumber )
{
int i, k, Prev = 0, Pos, Pos2, iObj;
Vec_Int_t * vPlaces;
@@ -872,11 +878,27 @@ void Acb_NtkInsert( char * pFileNameIn, char * pFileNameOut, Vec_Ptr_t * vNames
fputc( pBuffer[k], pFile );
fprintf( pFile, "\n\n" );
fprintf( pFile, " wire " );
- Vec_PtrForEachEntry( char *, vNames, pName, i )
- fprintf( pFile, " t_%d%s", i, i==Vec_PtrSize(vNames)-1 ? ";" : "," );
+ if ( fNumber )
+ {
+ Vec_PtrForEachEntry( char *, vNames, pName, i )
+ fprintf( pFile, " t_%d%s", i, i==Vec_PtrSize(vNames)-1 ? ";" : "," );
+ }
+ else
+ {
+ Vec_PtrForEachEntry( char *, vNames, pName, i )
+ fprintf( pFile, " target_%s%s", pName, i==Vec_PtrSize(vNames)-1 ? ";" : "," );
+ }
fprintf( pFile, "\n\n" );
- Vec_PtrForEachEntry( char *, vNames, pName, i )
- fprintf( pFile, " buf( %s, t_%d );\n", pName, i );
+ if ( fNumber )
+ {
+ Vec_PtrForEachEntry( char *, vNames, pName, i )
+ fprintf( pFile, " buf( %s, t_%d );\n", pName, i );
+ }
+ else
+ {
+ Vec_PtrForEachEntry( char *, vNames, pName, i )
+ fprintf( pFile, " buf( %s, target_%s ); // t_%d\n", pName, pName, i );
+ }
fprintf( pFile, "\n" );
for ( k = Pos2; pBuffer[k]; k++ )
fputc( pBuffer[k], pFile );