diff --git a/src/CCvcDb_main.cc b/src/CCvcDb_main.cc index c4e42c0..0bdaebe 100755 --- a/src/CCvcDb_main.cc +++ b/src/CCvcDb_main.cc @@ -102,13 +102,13 @@ void CCvcDb::VerifyCircuitForAllModes(int argc, const char * argv[]) { } cvcParameters.SaveDatabaseParameters(); reportFile << "Cdl fixed data size " << cvcCircuitList.cdlText.Size() << endl; - reportFile << PrintProgress(&lastSnapshot, "CDL ") << endl; + reportFile << PrintProgress(&lastSnapshot, "CDL") << endl; LoadCellChecksums(); CountObjectsAndLinkSubcircuits(); AssignGlobalIDs(); LoadNetChecks(); PrintLargeCircuits(); - reportFile << PrintProgress(&lastSnapshot, "DB ") << endl; + reportFile << PrintProgress(&lastSnapshot, "DB") << endl; } returnCode_t myCellErrorLimitStatus = LoadCellErrorLimits(); if ( myCellErrorLimitStatus != OK ) { @@ -161,7 +161,7 @@ void CCvcDb::VerifyCircuitForAllModes(int argc, const char * argv[]) { if ( gSetup_cvc ) { PrintNetSuggestions(); } - reportFile << PrintProgress(&lastSnapshot, "EQUIV ") << endl; + reportFile << PrintProgress(&lastSnapshot, "EQUIV") << endl; reportFile << "Power nets " << CPower::powerCount << endl; // DumpStatistics(parameterModelPtrMap, "parameter->model map", logFile); DumpStatistics(parameterResistanceMap, "parameter->resistance map", logFile); @@ -176,7 +176,7 @@ void CCvcDb::VerifyCircuitForAllModes(int argc, const char * argv[]) { ShortNonConductingResistors(); // SetResistorVoltagesForMosSwitches(); SetResistorVoltagesByPower(); - reportFile << PrintProgress(&lastSnapshot, "RES ") << endl; + reportFile << PrintProgress(&lastSnapshot, "RES") << endl; reportFile << "Power nets " << CPower::powerCount << endl; if ( gInteractive_cvc && --gContinueCount < 1 && InteractiveCvc(STAGE_RESISTANCE) == SKIP ) continue; @@ -190,7 +190,7 @@ void CCvcDb::VerifyCircuitForAllModes(int argc, const char * argv[]) { /// - PMOS gate-source errors\n ResetMinMaxPower(); SetAnalogNets(); - reportFile << PrintProgress(&lastSnapshot, "MIN/MAX1 ") << endl; + reportFile << PrintProgress(&lastSnapshot, "MIN/MAX1") << endl; reportFile << "Power nets " << CPower::powerCount << endl; if ( detectErrorFlag ) { if ( ! cvcParameters.cvcLogicDiodes ) { @@ -208,7 +208,7 @@ void CCvcDb::VerifyCircuitForAllModes(int argc, const char * argv[]) { if ( ! gSetup_cvc ) { FindPmosGateVsSourceErrors(); } - reportFile << PrintProgress(&lastSnapshot, "ERROR ") << endl; + reportFile << PrintProgress(&lastSnapshot, "ERROR") << endl; } if ( gInteractive_cvc && --gContinueCount < 1 && InteractiveCvc(STAGE_FIRST_MINMAX) == SKIP ) continue; @@ -219,7 +219,7 @@ void CCvcDb::VerifyCircuitForAllModes(int argc, const char * argv[]) { SaveMinMaxLeakVoltages(); SetSimPower(POWER_NETS_ONLY); cvcCircuitList.PrintAndResetCircuitErrors(this, cvcParameters.cvcCircuitErrorLimit, logFile, errorFile, "! Logic shorts 1"); - reportFile << PrintProgress(&lastSnapshot, "SIM1 ") << endl; + reportFile << PrintProgress(&lastSnapshot, "SIM1") << endl; reportFile << "Power nets " << CPower::powerCount << endl; if ( ! cvcParameters.cvcSOI ) { CheckConnections(); @@ -238,7 +238,7 @@ void CCvcDb::VerifyCircuitForAllModes(int argc, const char * argv[]) { SetSCRCPower(); } SetSimPower(ALL_NETS_AND_FUSE); - reportFile << PrintProgress(&lastSnapshot, "SIM2 ") << endl; + reportFile << PrintProgress(&lastSnapshot, "SIM2") << endl; reportFile << "Power nets " << CPower::powerCount << endl; CNetIdSet myNewNetSet; vector myIgnoreNet_v(simNet_v.size(), false); @@ -263,7 +263,7 @@ void CCvcDb::VerifyCircuitForAllModes(int argc, const char * argv[]) { /// - expected value errors ResetMinMaxPower(); SetInverters(); - reportFile << PrintProgress(&lastSnapshot, "MIN/MAX2 ") << endl; + reportFile << PrintProgress(&lastSnapshot, "MIN/MAX2") << endl; reportFile << "Power nets " << CPower::powerCount << endl; if ( detectErrorFlag ) { if ( cvcParameters.cvcLogicDiodes ) { @@ -277,7 +277,7 @@ void CCvcDb::VerifyCircuitForAllModes(int argc, const char * argv[]) { } PrintErrorTotals(); // PrintShortedNets(cvcParameters.cvcReportBaseFilename + ".shorts.gz"); - reportFile << PrintProgress(&lastSnapshot, "Total ") << endl; + reportFile << PrintProgress(&lastSnapshot, "Total") << endl; if ( gDebug_cvc ) { PrintAllVirtualNets(minNet_v, simNet_v, maxNet_v, "(3)"); cvcCircuitList.Print("", "CVC Full Circuit List"); diff --git a/src/CCvcDb_print.cc b/src/CCvcDb_print.cc index 10e7e0b..70c1962 100755 --- a/src/CCvcDb_print.cc +++ b/src/CCvcDb_print.cc @@ -38,88 +38,89 @@ void CCvcDb::SetOutputFiles(string theReportFilename) { string mySystemCommand; myBaseFilename = theReportFilename.substr(0, theReportFilename.find(".log")); cvcParameters.cvcReportBaseFilename = myBaseFilename; - int myFileSuffix = 0; - myBackupFilename = theReportFilename; - myCompressedFilename = myBackupFilename + ".gz"; - while ( ( myTestFile.open(myBackupFilename), myTestFile.good() ) || ( myTestFile.open(myCompressedFilename), myTestFile.good() ) ) { - myTestFile.close(); - myBackupFilename = theReportFilename + "." + to_string(++myFileSuffix); + if ( cvcParameters.cvcBackupResults ) { + int myFileSuffix = 0; + myBackupFilename = theReportFilename; myCompressedFilename = myBackupFilename + ".gz"; - } - if ( myFileSuffix > 0 ) { - cout << "INFO: Moving " << theReportFilename << " to " << myCompressedFilename << endl; - assert(rename(theReportFilename.c_str(), myBackupFilename.c_str()) == 0); - mySystemCommand = "gzip -f " + myBackupFilename; - assert(system(mySystemCommand.c_str()) == 0); - - myBaseFilename = cvcParameters.cvcReportBaseFilename + ".error"; - myBaseCompressedFilename = myBaseFilename + ".gz"; - myBackupFilename = myBaseFilename + "." + to_string(myFileSuffix); - myCompressedFilename = myBackupFilename + ".gz"; - if ( ( myTestFile.open(myBackupFilename), myTestFile.good() ) || ( myTestFile.open(myCompressedFilename), myTestFile.good() ) ) { + while ( ( myTestFile.open(myBackupFilename), myTestFile.good() ) || ( myTestFile.open(myCompressedFilename), myTestFile.good() ) ) { myTestFile.close(); - cout << "INFO: Removing " << myBackupFilename << endl; - assert((remove(myBackupFilename.c_str()) == 0) || (remove(myCompressedFilename.c_str()) == 0)); + myBackupFilename = theReportFilename + "." + to_string(++myFileSuffix); + myCompressedFilename = myBackupFilename + ".gz"; } - if ( myTestFile.open(myBaseFilename), myTestFile.good() ) { - myTestFile.close(); - cout << "INFO: Moving " << myBaseFilename << " to " << myCompressedFilename << endl; - assert(rename(myBaseFilename.c_str(), myBackupFilename.c_str()) == 0); + if ( myFileSuffix > 0 ) { + cout << "INFO: Moving " << theReportFilename << " to " << myCompressedFilename << endl; + assert(rename(theReportFilename.c_str(), myBackupFilename.c_str()) == 0); mySystemCommand = "gzip -f " + myBackupFilename; assert(system(mySystemCommand.c_str()) == 0); - } else if ( myTestFile.open(myBaseCompressedFilename), myTestFile.good() ) { - myTestFile.close(); - cout << "INFO: Moving " << myBaseCompressedFilename << " to " << myCompressedFilename << endl; - assert(rename(myBaseCompressedFilename.c_str(), myCompressedFilename.c_str()) == 0); - } - myBaseFilename = cvcParameters.cvcReportBaseFilename + ".shorts"; - myBaseCompressedFilename = myBaseFilename + ".gz"; - myBackupFilename = myBaseFilename + "." + to_string(myFileSuffix); - myCompressedFilename = myBackupFilename + ".gz"; - if ( ( myTestFile.open(myBackupFilename), myTestFile.good() ) || ( myTestFile.open(myCompressedFilename), myTestFile.good() ) ) { - myTestFile.close(); - cout << "INFO: Removing " << myBackupFilename << endl; - assert((remove(myBackupFilename.c_str()) == 0) || (remove(myCompressedFilename.c_str()) == 0)); - } - if ( myTestFile.open(myBaseFilename), myTestFile.good() ) { - myTestFile.close(); - cout << "INFO: Moving " << myBaseFilename << " to " << myCompressedFilename << endl; - assert(rename(myBaseFilename.c_str(), myBackupFilename.c_str()) == 0); - mySystemCommand = "gzip -f " + myBackupFilename; - assert(system(mySystemCommand.c_str()) == 0); - } else if ( myTestFile.open(myBaseCompressedFilename), myTestFile.good() ) { - myTestFile.close(); - cout << "INFO: Moving " << myBaseCompressedFilename << " to " << myCompressedFilename << endl; - assert(rename(myBaseCompressedFilename.c_str(), myCompressedFilename.c_str()) == 0); - } - } else { - myBaseFilename = cvcParameters.cvcReportBaseFilename + ".error"; - myBaseCompressedFilename = myBaseFilename + ".gz"; - if ( myTestFile.open(myBaseFilename), myTestFile.good() ) { - myTestFile.close(); - cout << "INFO: Removing " << myBaseFilename << endl; - remove(myBaseFilename.c_str()); - } - if ( myTestFile.open(myBaseCompressedFilename), myTestFile.good() ) { - myTestFile.close(); - cout << "INFO: Removing " << myBaseCompressedFilename << endl; - remove(myBaseCompressedFilename.c_str()); - } - myBaseFilename = cvcParameters.cvcReportBaseFilename + ".shorts"; - myBaseCompressedFilename = myBaseFilename + ".gz"; - if ( myTestFile.open(myBaseFilename), myTestFile.good() ) { - myTestFile.close(); - cout << "INFO: Removing " << myBaseFilename << endl; - remove(myBaseFilename.c_str()); - } - if ( myTestFile.open(myBaseCompressedFilename), myTestFile.good() ) { - myTestFile.close(); - cout << "INFO: Removing " << myBaseCompressedFilename << endl; - remove(myBaseCompressedFilename.c_str()); + myBaseFilename = cvcParameters.cvcReportBaseFilename + ".error"; + myBaseCompressedFilename = myBaseFilename + ".gz"; + myBackupFilename = myBaseFilename + "." + to_string(myFileSuffix); + myCompressedFilename = myBackupFilename + ".gz"; + if ( ( myTestFile.open(myBackupFilename), myTestFile.good() ) || ( myTestFile.open(myCompressedFilename), myTestFile.good() ) ) { + myTestFile.close(); + cout << "INFO: Removing " << myBackupFilename << endl; + assert((remove(myBackupFilename.c_str()) == 0) || (remove(myCompressedFilename.c_str()) == 0)); + } + if ( myTestFile.open(myBaseFilename), myTestFile.good() ) { + myTestFile.close(); + cout << "INFO: Moving " << myBaseFilename << " to " << myCompressedFilename << endl; + assert(rename(myBaseFilename.c_str(), myBackupFilename.c_str()) == 0); + mySystemCommand = "gzip -f " + myBackupFilename; + assert(system(mySystemCommand.c_str()) == 0); + } else if ( myTestFile.open(myBaseCompressedFilename), myTestFile.good() ) { + myTestFile.close(); + cout << "INFO: Moving " << myBaseCompressedFilename << " to " << myCompressedFilename << endl; + assert(rename(myBaseCompressedFilename.c_str(), myCompressedFilename.c_str()) == 0); + } + + myBaseFilename = cvcParameters.cvcReportBaseFilename + ".shorts"; + myBaseCompressedFilename = myBaseFilename + ".gz"; + myBackupFilename = myBaseFilename + "." + to_string(myFileSuffix); + myCompressedFilename = myBackupFilename + ".gz"; + if ( ( myTestFile.open(myBackupFilename), myTestFile.good() ) || ( myTestFile.open(myCompressedFilename), myTestFile.good() ) ) { + myTestFile.close(); + cout << "INFO: Removing " << myBackupFilename << endl; + assert((remove(myBackupFilename.c_str()) == 0) || (remove(myCompressedFilename.c_str()) == 0)); + } + if ( myTestFile.open(myBaseFilename), myTestFile.good() ) { + myTestFile.close(); + cout << "INFO: Moving " << myBaseFilename << " to " << myCompressedFilename << endl; + assert(rename(myBaseFilename.c_str(), myBackupFilename.c_str()) == 0); + mySystemCommand = "gzip -f " + myBackupFilename; + assert(system(mySystemCommand.c_str()) == 0); + } else if ( myTestFile.open(myBaseCompressedFilename), myTestFile.good() ) { + myTestFile.close(); + cout << "INFO: Moving " << myBaseCompressedFilename << " to " << myCompressedFilename << endl; + assert(rename(myBaseCompressedFilename.c_str(), myCompressedFilename.c_str()) == 0); + } + } else { + myBaseFilename = cvcParameters.cvcReportBaseFilename + ".error"; + myBaseCompressedFilename = myBaseFilename + ".gz"; + if ( myTestFile.open(myBaseFilename), myTestFile.good() ) { + myTestFile.close(); + cout << "INFO: Removing " << myBaseFilename << endl; + remove(myBaseFilename.c_str()); + } + if ( myTestFile.open(myBaseCompressedFilename), myTestFile.good() ) { + myTestFile.close(); + cout << "INFO: Removing " << myBaseCompressedFilename << endl; + remove(myBaseCompressedFilename.c_str()); + } + myBaseFilename = cvcParameters.cvcReportBaseFilename + ".shorts"; + myBaseCompressedFilename = myBaseFilename + ".gz"; + if ( myTestFile.open(myBaseFilename), myTestFile.good() ) { + myTestFile.close(); + cout << "INFO: Removing " << myBaseFilename << endl; + remove(myBaseFilename.c_str()); + } + if ( myTestFile.open(myBaseCompressedFilename), myTestFile.good() ) { + myTestFile.close(); + cout << "INFO: Removing " << myBaseCompressedFilename << endl; + remove(myBaseCompressedFilename.c_str()); + } } } - cout << "DEBUG: report file '" << theReportFilename << "'" << endl; logFile.open(theReportFilename); if ( ! logFile.good() ) { throw EFatalError("Could not open " + theReportFilename); @@ -978,7 +979,7 @@ void CCvcDb::PrintLargeCircuits() { for ( auto circuit_ppit = cvcCircuitList.begin(); circuit_ppit != cvcCircuitList.end(); circuit_ppit++ ) { if ( (*circuit_ppit)->deviceCount > cvcParameters.cvcLargeCircuitSize ) { for ( auto instance_pit = (*circuit_ppit)->instanceId_v.begin(); instance_pit != (*circuit_ppit)->instanceId_v.end(); instance_pit++ ) { - reportFile << "INFO: Large circuit " << HierarchyName(*instance_pit, true, true) << " device count " << (*circuit_ppit)->deviceCount << endl; + debugFile << "INFO: Large circuit " << HierarchyName(*instance_pit, true, true) << " device count " << (*circuit_ppit)->deviceCount << endl; } } } diff --git a/src/CCvcParameters.cc b/src/CCvcParameters.cc index a4307df..61f57f5 100755 --- a/src/CCvcParameters.cc +++ b/src/CCvcParameters.cc @@ -85,6 +85,8 @@ void CCvcParameters::ResetEnvironment() { //! When true, uses logic values, if known, for diode checks. Default is to ignore logic values. cvcAnalogGates = defaultAnalogGates; //! When false, ignore errors from analog gates. Default is to use analog values. + cvcBackupResults = defaultBackupResults; + //! When true, backup log and error file. Default is to not create backups. cvcMosDiodeErrorThreshold = defaultErrorThreshold; cvcShortErrorThreshold = defaultErrorThreshold; cvcBiasErrorThreshold = defaultErrorThreshold; @@ -128,7 +130,8 @@ void CCvcParameters::PrintEnvironment(ostream & theOutputFile) { theOutputFile << "CVC_IGNORE_NO_LEAK_FLOATING = '" << (( cvcIgnoreNoLeakFloating ) ? "true" : "false") << "'" << endl; theOutputFile << "CVC_LEAK_OVERVOLTAGE = '" << (( cvcLeakOvervoltage ) ? "true" : "false") << "'" << endl; theOutputFile << "CVC_LOGIC_DIODES = '" << (( cvcLogicDiodes ) ? "true" : "false") << "'" << endl; - theOutputFile << "CVC_ANALOG_GATES = '" << (( cvcLogicDiodes ) ? "true" : "false") << "'" << endl; + theOutputFile << "CVC_ANALOG_GATES = '" << (( cvcAnalogGates ) ? "true" : "false") << "'" << endl; + theOutputFile << "CVC_BACKUP_RESULTS = '" << (( cvcBackupResults ) ? "true" : "false") << "'" << endl; theOutputFile << "CVC_MOS_DIODE_ERROR_THRESHOLD = '" << Voltage_to_float(cvcMosDiodeErrorThreshold) << "'" << endl; theOutputFile << "CVC_SHORT_ERROR_THRESHOLD = '" << Voltage_to_float(cvcShortErrorThreshold) << "'" << endl; theOutputFile << "CVC_BIAS_ERROR_THRESHOLD = '" << Voltage_to_float(cvcBiasErrorThreshold) << "'" << endl; @@ -174,6 +177,7 @@ void CCvcParameters::PrintDefaultEnvironment() { myDefaultCvcrc << "CVC_LEAK_OVERVOLTAGE = '" << (( cvcLeakOvervoltage ) ? "true" : "false") << "'" << endl; myDefaultCvcrc << "CVC_LOGIC_DIODES = '" << (( cvcLogicDiodes ) ? "true" : "false") << "'" << endl; myDefaultCvcrc << "CVC_ANALOG_GATES = '" << (( cvcAnalogGates ) ? "true" : "false") << "'" << endl; + myDefaultCvcrc << "CVC_BACKUP_RESULTS = '" << (( cvcBackupResults ) ? "true" : "false") << "'" << endl; myDefaultCvcrc << "CVC_MOS_DIODE_ERROR_THRESHOLD = '" << Voltage_to_float(cvcMosDiodeErrorThreshold) << "'" << endl; myDefaultCvcrc << "CVC_SHORT_ERROR_THRESHOLD = '" << Voltage_to_float(cvcShortErrorThreshold) << "'" << endl; myDefaultCvcrc << "CVC_BIAS_ERROR_THRESHOLD = '" << Voltage_to_float(cvcBiasErrorThreshold) << "'" << endl; @@ -266,6 +270,8 @@ void CCvcParameters::LoadEnvironment(const string theEnvironmentFilename, const cvcLogicDiodes = strcasecmp(myBuffer, "true") == 0; } else if ( myVariable == "CVC_ANALOG_GATES" ) { cvcAnalogGates = strcasecmp(myBuffer, "true") == 0; + } else if ( myVariable == "CVC_BACKUP_RESULTS" ) { + cvcBackupResults = strcasecmp(myBuffer, "true") == 0; } else if ( myVariable == "CVC_MOS_DIODE_ERROR_THRESHOLD" ) { cvcMosDiodeErrorThreshold = String_to_Voltage(string(myBuffer)); } else if ( myVariable == "CVC_SHORT_ERROR_THRESHOLD" ) { diff --git a/src/CCvcParameters.hh b/src/CCvcParameters.hh index 539c8ca..032b731 100755 --- a/src/CCvcParameters.hh +++ b/src/CCvcParameters.hh @@ -50,12 +50,13 @@ public: const bool defaultLeakOvervoltage = true; const bool defaultLogicDiodes = false; const bool defaultAnalogGates = true; + const bool defaultBackupResults = false; const voltage_t defaultErrorThreshold = 0; const size_t defaultParallelCircuitPortLimit = 0; const string defaultCellErrorLimitFile = ""; const string defaultCellChecksumFile = ""; const size_t defaultLargeCircuitSize = 10e6; - const string defaultNetCheckFile = ""; + const string defaultNetCheckFile = ""; string cvcReportTitle; @@ -91,6 +92,7 @@ public: bool cvcLeakOvervoltage = defaultLeakOvervoltage; bool cvcLogicDiodes = defaultLogicDiodes; bool cvcAnalogGates = defaultAnalogGates; + bool cvcBackupResults = defaultBackupResults; voltage_t cvcMosDiodeErrorThreshold = defaultErrorThreshold; voltage_t cvcShortErrorThreshold = defaultErrorThreshold; voltage_t cvcBiasErrorThreshold = defaultErrorThreshold; diff --git a/src/CInstance.cc b/src/CInstance.cc index b5f0f61..5b8b1ed 100755 --- a/src/CInstance.cc +++ b/src/CInstance.cc @@ -70,8 +70,8 @@ void CInstance::AssignTopGlobalIDs(CCvcDb * theCvcDb_p, CCircuit * theMaster_p) } theCvcDb_p->netParent_v.shrink_to_fit(); theCvcDb_p->deviceParent_v.shrink_to_fit(); - cout << "DEBUG: netParent size " << theCvcDb_p->netParent_v.size() << "; deviceParent size " << theCvcDb_p->deviceParent_v.size() << endl; - cout << "DEBUG: parallel collisions " << gHashCollisionCount << " max length " << gMaxHashLength << endl; + theCvcDb_p->debugFile << "DEBUG: netParent size " << theCvcDb_p->netParent_v.size() << "; deviceParent size " << theCvcDb_p->deviceParent_v.size() << endl; + theCvcDb_p->debugFile << "DEBUG: parallel collisions " << gHashCollisionCount << " max length " << gMaxHashLength << endl; } void CInstance::AssignGlobalIDs(CCvcDb * theCvcDb_p, const instanceId_t theInstanceId, CDevice * theSubcircuit_p, const instanceId_t theParentId, diff --git a/src/resource.cc b/src/resource.cc index 9ca393a..f7995c8 100755 --- a/src/resource.cc +++ b/src/resource.cc @@ -34,7 +34,7 @@ char * PrintProgress(rusage * theLastSnapshot_p, string theHeading) { TakeSnapshot(¤tSnapshot); - sprintf(myString, "%sUsage: Time: %ld Memory: %ld I/O: %ld Swap: %ld", theHeading.c_str(), currentSnapshot.ru_utime.tv_sec, + sprintf(myString, "Usage %s: Time: %ld Memory: %ld I/O: %ld Swap: %ld", theHeading.c_str(), currentSnapshot.ru_utime.tv_sec, currentSnapshot.ru_maxrss, currentSnapshot.ru_inblock + currentSnapshot.ru_oublock, currentSnapshot.ru_nswap);