void Prs_ManWriteVerilogSignal( FILE * pFile, Prs_Ntk_t * p, int Sig ) { int Value = Abc_Lit2Var2( Sig ); Prs_ManType_t Type = Abc_Lit2Att2( Sig ); if ( Type == CBA_PRS_NAME || Type == CBA_PRS_CONST ) fprintf( pFile, "%s", Prs_NtkStr(p, Value) ); else if ( Type == CBA_PRS_SLICE ) fprintf( pFile, "%s%s", Prs_NtkStr(p, Prs_SliceName(p, Value)), Prs_NtkStr(p, Prs_SliceRange(p, Value)) ); else if ( Type == CBA_PRS_CONCAT ) Prs_ManWriteVerilogConcat( pFile, p, Value ); else assert( 0 ); }
ABC_NAMESPACE_IMPL_START //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ /* Vec_Int_t * Gia_WriteDotAigMarks( Gia_Man_t * p, Vec_Int_t * vFadds, Vec_Int_t * vHadds ) { int i; Vec_Int_t * vMarks = Vec_IntStart( Gia_ManObjNum(p) ); for ( i = 0; i < Vec_IntSize(vHadds)/2; i++ ) { Vec_IntWriteEntry( vMarks, Vec_IntEntry(vHadds, 2*i+0), Abc_Var2Lit(i+1, 0) ); Vec_IntWriteEntry( vMarks, Vec_IntEntry(vHadds, 2*i+1), Abc_Var2Lit(i+1, 0) ); } for ( i = 0; i < Vec_IntSize(vFadds)/5; i++ ) { Vec_IntWriteEntry( vMarks, Vec_IntEntry(vFadds, 5*i+3), Abc_Var2Lit(i+1, 1) ); Vec_IntWriteEntry( vMarks, Vec_IntEntry(vFadds, 5*i+4), Abc_Var2Lit(i+1, 1) ); } return vMarks; } int Gia_WriteDotAigLevel_rec( Gia_Man_t * p, Vec_Int_t * vMarks, Vec_Int_t * vFadds, Vec_Int_t * vHadds, int Id, Vec_Int_t * vLevel ) { int Level = Vec_IntEntry(vLevel, Id), Mark = Vec_IntEntry(vMarks, Id); if ( Level || Mark == -1 ) return Level; if ( Mark == 0 ) { Gia_Obj_t * pObj = Gia_ManObj( p, Id ); int Level0 = Gia_WriteDotAigLevel_rec( p, vMarks, vFadds, vHadds, Gia_ObjFaninId0(pObj, Id), vLevel ); int Level1 = Gia_WriteDotAigLevel_rec( p, vMarks, vFadds, vHadds, Gia_ObjFaninId1(pObj, Id), vLevel ); Level = Abc_MaxInt(Level0, Level1) + 1; Vec_IntWriteEntry( vLevel, Id, Level ); Vec_IntWriteEntry( vMarks, Id, -1 ); } else if ( Abc_LitIsCompl(Mark) ) // FA { int i, * pFanins = Vec_IntEntryP( vFadds, 5*(Abc_Lit2Var(Mark)-1) ); assert( pFanins[3] == Id || pFanins[4] == Id ); for ( i = 0; i < 3; i++ ) Level = Abc_MaxInt( Level, Gia_WriteDotAigLevel_rec( p, vMarks, vFadds, vHadds, pFanins[i], vLevel ) ); Vec_IntWriteEntry( vLevel, pFanins[3], Level+1 ); Vec_IntWriteEntry( vLevel, pFanins[4], Level+1 ); } else // HA { int * pFanins = Vec_IntEntryP( vHadds, 2*(Abc_Lit2Var(Mark)-1) ); Gia_Obj_t * pObj = Gia_ManObj( p, pFanins[1] ); int Level0 = Gia_WriteDotAigLevel_rec( p, vMarks, vFadds, vHadds, Gia_ObjFaninId0(pObj, Id), vLevel ); int Level1 = Gia_WriteDotAigLevel_rec( p, vMarks, vFadds, vHadds, Gia_ObjFaninId1(pObj, Id), vLevel ); assert( pFanins[0] == Id || pFanins[1] == Id ); Level = Abc_MaxInt(Level0, Level1) + 1; Vec_IntWriteEntry( vLevel, pFanins[0], Level ); Vec_IntWriteEntry( vLevel, pFanins[1], Level ); } return Level; } int Gia_WriteDotAigLevel( Gia_Man_t * p, Vec_Int_t * vFadds, Vec_Int_t * vHadds, Vec_Int_t ** pvMarks, Vec_Int_t ** pvLevel ) { Vec_Int_t * vMarks = Gia_WriteDotAigMarks( p, vFadds, vHadds ); Vec_Int_t * vLevel = Vec_IntStart( Gia_ManObjNum(p) ); int i, Id, Level = 0; Vec_IntWriteEntry( vMarks, 0, -1 ); Gia_ManForEachCiId( p, Id, i ) Vec_IntWriteEntry( vMarks, Id, -1 ); Gia_ManForEachCoDriverId( p, Id, i ) Level = Abc_MaxInt( Level, Gia_WriteDotAigLevel_rec(p, vMarks, vFadds, vHadds, Id, vLevel) ); Gia_ManForEachCoId( p, Id, i ) Vec_IntWriteEntry( vMarks, Id, -1 ); *pvMarks = vMarks; *pvLevel = vLevel; return Level; } */ int Gia_WriteDotAigLevel( Gia_Man_t * p, Vec_Int_t * vFadds, Vec_Int_t * vHadds, Vec_Int_t * vRecord, Vec_Int_t ** pvLevel, Vec_Int_t ** pvMarks, Vec_Int_t ** pvRemap ) { Vec_Int_t * vLevel = Vec_IntStart( Gia_ManObjNum(p) ); Vec_Int_t * vMarks = Vec_IntStart( Gia_ManObjNum(p) ); Vec_Int_t * vRemap = Vec_IntStartNatural( Gia_ManObjNum(p) ); int i, k, Id, Entry, LevelMax = 0; Vec_IntWriteEntry( vMarks, 0, -1 ); Gia_ManForEachCiId( p, Id, i ) Vec_IntWriteEntry( vMarks, Id, -1 ); Gia_ManForEachCoId( p, Id, i ) Vec_IntWriteEntry( vMarks, Id, -1 ); Vec_IntForEachEntry( vRecord, Entry, i ) { int Level = 0; int Node = Abc_Lit2Var2(Entry); int Attr = Abc_Lit2Att2(Entry); if ( Attr == 2 ) { int * pFanins = Vec_IntEntryP( vFadds, 5*Node ); for ( k = 0; k < 3; k++ ) Level = Abc_MaxInt( Level, Vec_IntEntry(vLevel, pFanins[k]) ); Vec_IntWriteEntry( vLevel, pFanins[3], Level+1 ); Vec_IntWriteEntry( vLevel, pFanins[4], Level+1 ); Vec_IntWriteEntry( vMarks, pFanins[4], Entry ); Vec_IntWriteEntry( vRemap, pFanins[3], pFanins[4] ); //printf( "Making FA output %d.\n", pFanins[4] ); } else if ( Attr == 1 ) { int * pFanins = Vec_IntEntryP( vHadds, 2*Node ); Gia_Obj_t * pObj = Gia_ManObj( p, pFanins[1] ); int pFaninsIn[2] = { Gia_ObjFaninId0(pObj, pFanins[1]), Gia_ObjFaninId1(pObj, pFanins[1]) }; for ( k = 0; k < 2; k++ ) Level = Abc_MaxInt( Level, Vec_IntEntry(vLevel, pFaninsIn[k]) ); Vec_IntWriteEntry( vLevel, pFanins[0], Level+1 ); Vec_IntWriteEntry( vLevel, pFanins[1], Level+1 ); Vec_IntWriteEntry( vMarks, pFanins[1], Entry ); Vec_IntWriteEntry( vRemap, pFanins[0], pFanins[1] ); //printf( "Making HA output %d.\n", pFanins[1] ); } else // if ( Attr == 3 || Attr == 0 ) { Gia_Obj_t * pObj = Gia_ManObj( p, Node ); int pFaninsIn[2] = { Gia_ObjFaninId0(pObj, Node), Gia_ObjFaninId1(pObj, Node) }; for ( k = 0; k < 2; k++ ) Level = Abc_MaxInt( Level, Vec_IntEntry(vLevel, pFaninsIn[k]) ); Vec_IntWriteEntry( vLevel, Node, Level+1 ); Vec_IntWriteEntry( vMarks, Node, -1 ); //printf( "Making node %d.\n", Node ); } LevelMax = Abc_MaxInt( LevelMax, Level+1 ); }