Skip to content

Commit

Permalink
Changes for version 0.17.18a
Browse files Browse the repository at this point in the history
Initial checksum changes.
  • Loading branch information
d-m-bailey committed Jun 7, 2019
1 parent 8f6dc9f commit 822bd43
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 126 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT(CVC, [0.17.17], [[email protected]])
AC_INIT(CVC, [0.17.18a], [[email protected]])
AC_CONFIG_SRCDIR(src)
AC_CONFIG_HEADERS([config.h])
AC_USE_SYSTEM_EXTENSIONS
Expand Down
25 changes: 24 additions & 1 deletion scripts/calibre_cvc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# calibre_cvc: runs calibre svs to create a standardized netlist

# Copyright 2106-2018 D. Mitch Bailey cvc at shuharisystem dot com
# Copyright 2106-2019 D. Mitch Bailey cvc at shuharisystem dot com

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -160,6 +160,29 @@ sed -e 's/^\(.\)\1/\1/' \
-e 's/\^SUB=/$SUB=/' $OUTPUT.0 | \
$BOX_FILTER > $OUTPUT

echo "Calculating cksums..."
if [[ ! -d sub_split ]] ; then
mkdir sub_split
fi

csplit -s -f sub_split/sub -n 3 $OUTPUT "/^\.SUBCKT /" "{*}"

for sub in sub_split/sub*; do
CIRCUIT=$(awk '/^\.SUBCKT/ {print $2; exit}' $sub)
sed -e '/^ *$/d' -e :a -e '$!N;s/\n+/ /; ta' -e 's/ */ /g' -e 'P;D' $sub | \
sort > sub_split/$CIRCUIT.cdl
rm $sub
done

DATE=${PWD##*/}

echo "# Checksum file for $PRIMARY $DATE" > $PRIMARY.cksum

cksum sub_split/* | \
sed -e 's,sub_split/,,' -e 's,\.cdl,,' >> $PRIMARY.cksum

rm -rf sub_split

if [[ ! -z "${compress+x}" ]]; then
gzip -f $OUTPUT
fi
Expand Down
42 changes: 7 additions & 35 deletions src/CCircuit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ void CCircuit::LoadDevices(CDevicePtrList * theDevicePtrList_p) {
for (CDevicePtrList::iterator device_ppit = theDevicePtrList_p->begin(); device_ppit != theDevicePtrList_p->end(); device_ppit++) {
myDevice_p = *device_ppit;
SetSignalIds(myDevice_p->signalList_p, myDevice_p->signalId_v);
// delete myDevice_p->signalList_p;
myDevice_p->parent_p = this;
if ( myDeviceIdMap.count(myDevice_p->name) ) {
cout << "ERROR: Duplicate instance " << myDevice_p->name << " in " << name << endl;
Expand Down Expand Up @@ -146,7 +145,6 @@ void CCircuit::CountObjectsAndLinkSubcircuits(unordered_map<text_t, CCircuit *>
} else {
myChild_p->CountObjectsAndLinkSubcircuits(theCircuitNameMap);
}
// assert((*subcircuit_ppit)->signalId_v.size() == myChild_p->portCount);
if ( (*subcircuit_ppit)->signalId_v.size() != myChild_p->portCount ) {
stringstream myErrorMessage;
myErrorMessage << "port mismatch in " << (*subcircuit_ppit)->name << " " << (*subcircuit_ppit)->signalId_v.size() << ":" << myChild_p->portCount << endl;
Expand Down Expand Up @@ -232,45 +230,22 @@ void CCircuitPtrList::Print (const string theIndentation, const string theHeadin
cout << theIndentation << theHeading << " end" << endl << endl;
}

/*
void CCircuitPtrList::CreateDatabase(const string theTopCircuitName) {
CCircuit * myTopCircuit = FindCircuit(theTopCircuitName);
myTopCircuit->CountObjectsAndLinkSubcircuits(circuitNameMap);
myTopCircuit->netCount += myTopCircuit->portCount;
myTopCircuit->subcircuitCount++;
myTopCircuit->instanceCount++;
// myTopCircuit->AssignGlobalId();
}
*/

CCircuit * CCircuitPtrList::FindCircuit(const string theSearchCircuitName) {
// error handling in calling routine
return(circuitNameMap.at(cdlText.GetTextAddress(theSearchCircuitName)));
/* move error handling to calling routine
try {
return(circuitNameMap.at(cdlText.GetTextAddress(theSearchCircuitName)));
}
catch (const out_of_range& oor_exception) {
// cout << "** ERROR: could not find subcircuit: " << theSearchCircuitName << endl;
throw EFatalError("could not find subcircuit: " + theSearchCircuitName);
// exit(1);
}
*/
}

void CCircuitPtrList::SetChecksum(const string theCircuitName, const string theChecksum) {
CCircuit * myCircuitPtr = FindCircuit(theCircuitName);
myCircuitPtr->checksum = theChecksum;
}

void CCircuitPtrList::PrintAndResetCircuitErrors(CCvcDb * theCvcDb_p, deviceId_t theErrorLimit, ofstream & theLogFile, ogzstream & theErrorFile,
string theSummaryHeading, int theErrorSubIndex, set<modelType_t> & theModelList) {
list<string> myErrorSummaryList;
// theLogFile << theSummaryHeading << endl;
theErrorFile << theSummaryHeading << endl;
for (auto circuit_ppit = begin(); circuit_ppit != end(); circuit_ppit++) {
if ( (*circuit_ppit)->instanceCount == 0 ) continue; // ignore unused circuits
/*
if ( theErrorLimit > 0 && (*circuit_ppit)->errorCount > theErrorLimit ) {
cout << "INFO: SUBCKT " << (*circuit_ppit)->name << " error count " << (*circuit_ppit)->errorCount << "/" << (*circuit_ppit)->instanceId_v.size();
cout << " exceeded error limit " << theErrorLimit << endl;
}
(*circuit_ppit)->errorCount = 0;
*/
for (size_t device_it = 0; device_it < (*circuit_ppit)->devicePtr_v.size(); device_it++) {
if ( theModelList.empty() || theModelList.count((*circuit_ppit)->devicePtr_v[device_it]->model_p->type) > 0 ) {
if ( (*circuit_ppit)->devicePrintCount_v[device_it][theErrorSubIndex] > 0 ) {
Expand All @@ -280,10 +255,9 @@ void CCircuitPtrList::PrintAndResetCircuitErrors(CCvcDb * theCvcDb_p, deviceId_t
myErrorSummary << "(" << (*circuit_ppit)->devicePtr_v[device_it]->model_p->name << ")";
myErrorSummary << " error count " << (*circuit_ppit)->deviceErrorCount_v[device_it][theErrorSubIndex] << "/" << (*circuit_ppit)->instanceId_v.size();
if ( theErrorLimit > 0 && (*circuit_ppit)->deviceErrorCount_v[device_it][theErrorSubIndex] > theErrorLimit ) {
// theErrorFile << "INFO: SUBCKT " << (*circuit_ppit)->name << "/" << (*circuit_ppit)->devicePtr_v[device_it]->name << " error count ";
// theErrorFile << (*circuit_ppit)->deviceErrorCount_v[device_it] << "/" << (*circuit_ppit)->instanceId_v.size();
myErrorSummary << " exceeded error limit " << theErrorLimit;
}
myErrorSummary << " checksum(" << (*circuit_ppit)->checksum << ")";
myErrorSummaryList.push_front(myErrorSummary.str());
}
(*circuit_ppit)->deviceErrorCount_v[device_it][theErrorSubIndex] = 0;
Expand All @@ -293,10 +267,8 @@ void CCircuitPtrList::PrintAndResetCircuitErrors(CCvcDb * theCvcDb_p, deviceId_t
}
myErrorSummaryList.sort();
for ( auto error_pit = myErrorSummaryList.begin(); error_pit != myErrorSummaryList.end(); error_pit++ ) {
// theLogFile << (*error_pit) << endl;
theErrorFile << (*error_pit) << endl;
}
// theLogFile << endl << "! Finished" << endl << endl;
theErrorFile << endl<< "! Finished" << endl << endl;
theCvcDb_p->cellErrorCountMap.clear();
}
Expand Down
2 changes: 2 additions & 0 deletions src/CCircuit.hh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public:
instanceId_t subcircuitCount = 0;
// the number of instantiations
instanceId_t instanceCount = 0;
string checksum = "";

// deviceId_t errorCount = 0;
// deviceId_t warningCount = 0;
Expand Down Expand Up @@ -105,6 +106,7 @@ public:
void Print(const string theIndentation = "", const string theHeading = "CircuitList>");
// void CreateDatabase(const string theTopBlockName);
CCircuit * FindCircuit(const string theSearchCircuit);
void SetChecksum(const string theSearchCircuit, const string theChecksum);
void PrintAndResetCircuitErrors(CCvcDb * theCvcDb_p, deviceId_t theErrorLimit, ofstream & theLogFile, ogzstream & theErrorFile,
string theSummaryHeading = "", int theSubErrorIndex = 0, set<modelType_t> & theModelList = emptyModelList);
};
Expand Down
1 change: 1 addition & 0 deletions src/CCvcDb.hh
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ public:
bool IsOppositeLogic(netId_t theFirstNet, netId_t theSecondNet);
void PrintNetSuggestions();
returnCode_t LoadCellErrorLimits();
void LoadCellChecksums();

// error
void PrintFuseError(netId_t theTargetNetId, CConnection & theConnections);
Expand Down
29 changes: 28 additions & 1 deletion src/CCvcDb_init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1554,7 +1554,7 @@ returnCode_t CCvcDb::LoadCellErrorLimits() {
igzstream myCellErrorLimitFile;
myCellErrorLimitFile.open(cvcParameters.cvcCellErrorLimitFile);
if ( myCellErrorLimitFile.fail() ) {
throw EFatalError("Could not open " + cvcParameters.cvcCellErrorLimitFile);
throw EFatalError("Could not open cell error limit file '" + cvcParameters.cvcCellErrorLimitFile + "'");
exit(1);
}
string myInput;
Expand All @@ -1580,3 +1580,30 @@ returnCode_t CCvcDb::LoadCellErrorLimits() {
return OK;
}

void CCvcDb::LoadCellChecksums() {
if ( IsEmpty(cvcParameters.cvcCellChecksumFile) ) return;
igzstream myCellChecksumFile;
myCellChecksumFile.open(cvcParameters.cvcCellChecksumFile);
if ( myCellChecksumFile.fail() ) {
throw EFatalError("Could not open cell checksum file: '" + cvcParameters.cvcCellChecksumFile + "'");
exit(1);
}
string myInput;

reportFile << "CVC: Reading cell checksums..." << endl;
string myCellName;
while ( getline(myCellChecksumFile, myInput) ) {
int myCellNameStart = myInput.find_last_of(" ");
myCellName = myInput.substr(myCellNameStart + 1);
try {
CCircuit * theMaster_p = cvcCircuitList.FindCircuit(myCellName);
theMaster_p->checksum = myInput.substr(0, myCellNameStart);
debugFile << "INFO: checksum for " << myCellName << " is " << theMaster_p->checksum << endl;
}
catch (...) {
reportFile << "ERROR: Could not find checksum cell " << myCellName << " in netlist" << endl;
}
}
myCellChecksumFile.close();
}

4 changes: 4 additions & 0 deletions src/CCvcDb_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,15 @@ void CCvcDb::VerifyCircuitForAllModes(int argc, const char * argv[]) {
cvcParameters.SaveDatabaseParameters();
reportFile << "Cdl fixed data size " << cvcCircuitList.cdlText.Size() << endl;
reportFile << PrintProgress(&lastSnapshot, "CDL ") << endl;
LoadCellChecksums();
CountObjectsAndLinkSubcircuits();
AssignGlobalIDs();
reportFile << PrintProgress(&lastSnapshot, "DB ") << endl;
}
returnCode_t myCellErrorLimitStatus = LoadCellErrorLimits();
if ( myCellErrorLimitStatus != OK ) {
throw EFatalError("Could not load " + cvcParameters.cvcCellErrorLimitFile);
}
reportFile << "CVC: " << topCircuit_p->subcircuitCount << "(" << subcircuitCount << ") instances, "
<< topCircuit_p->netCount << "(" << netCount << ") nets, "
<< topCircuit_p->deviceCount << "(" << deviceCount << ") devices." << endl;
Expand Down
1 change: 1 addition & 0 deletions src/CCvcDb_print.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ void CCvcDb::SetOutputFiles(string theReportFilename) {
remove(myBaseCompressedFilename.c_str());
}
}
cout << "DEBUG: report file '" << theReportFilename << "'" << endl;
logFile.open(theReportFilename);
if ( ! logFile.good() ) {
throw EFatalError("Could not open " + theReportFilename);
Expand Down
96 changes: 9 additions & 87 deletions src/CCvcParameters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,6 @@
#include "wordexp.h"
#include "gzstream.h"

/*
CCvcParameters::CCvcParameters() {
// cvcDate = "20130731";
// cvcTopBlock = "CVC_TEST";
// cvcFileName = "CVC_TEST.cdl";
// cvcReportTitle = "CVC TEST CIRCUIT";
// cvcHtmlFilenameTemplate = cvcTopBlock + "_" + cvcDate + "_";
}
CCvcParameters::CCvcParameters(const int argc, const char * argv[]) {
// cvcDate = "20130731";
// cvcTopBlock = "CVC_TEST";
// cvcFileName = "CVC_TEST.cdl";
// cvcReportTitle = "CVC TEST CIRCUIT";
// cvcHtmlFilenameTemplate = cvcTopBlock + "_" + cvcDate + "_";
if (argc > 1) {
// cvcFileName.assign(argv[1]);
LoadEnvironment(argv[1]);
// cvcFileName.assign(getenv("CVC_NETLIST"));
}
if (argc > 2 && strcmp(argv[2], "--debug") == 0) debug_cvc = true;
}
*/

string CCvcParameters::CvcFileName() {
return cvcNetlistFilename;
}
Expand Down Expand Up @@ -116,7 +91,11 @@ void CCvcParameters::ResetEnvironment() {
cvcExpectedErrorThreshold = defaultErrorThreshold;
//! Ignore errors with voltage difference less than the threshold. Default is 0, flag errors regardless of voltage difference.
cvcParallelCircuitPortLimit = defaultParallelCircuitPortLimit;
//! Port count limit for parallel cell processing
cvcCellErrorLimitFile = defaultCellErrorLimitFile;
//! Name of file containing list of cells with error limits
cvcCellChecksumFile = defaultCellChecksumFile;
//! Name of file containing list of checksums for each circuit
}

void CCvcParameters::PrintEnvironment(ostream & theOutputFile) {
Expand Down Expand Up @@ -149,6 +128,7 @@ void CCvcParameters::PrintEnvironment(ostream & theOutputFile) {
theOutputFile << "CVC_EXPECTED_ERROR_THRESHOLD = '" << Voltage_to_float(cvcExpectedErrorThreshold) << "'" << endl;
theOutputFile << "CVC_PARALLEL_CIRCUIT_PORT_LIMIT = '" << cvcParallelCircuitPortLimit << "'" << endl;
theOutputFile << "CVC_CELL_ERROR_LIMIT_FILE = '" << cvcCellErrorLimitFile << "'" << endl;
theOutputFile << "CVC_CELL_CHECKSUM_FILE = '" << cvcCellChecksumFile << "'" << endl;
theOutputFile << "End of parameters" << endl << endl;
}

Expand Down Expand Up @@ -188,6 +168,7 @@ void CCvcParameters::PrintDefaultEnvironment() {
myDefaultCvcrc << "CVC_EXPECTED_ERROR_THRESHOLD = '" << Voltage_to_float(cvcExpectedErrorThreshold) << "'" << endl;
myDefaultCvcrc << "CVC_PARALLEL_CIRCUIT_PORT_LIMIT = '" << cvcParallelCircuitPortLimit << "'" << endl;
myDefaultCvcrc << "CVC_CELL_ERROR_LIMIT_FILE = '" << cvcCellErrorLimitFile << "'" << endl;
myDefaultCvcrc << "CVC_CELL_CHECKSUM_FILE = '" << cvcCellChecksumFile << "'" << endl;
myDefaultCvcrc.close();
}

Expand Down Expand Up @@ -290,23 +271,14 @@ void CCvcParameters::LoadEnvironment(const string theEnvironmentFilename, const
cvcParallelCircuitPortLimit = MAX_PARALLEL_CIRCUIT_PORT_LIMIT;
}
} else if ( myVariable == "CVC_CELL_ERROR_LIMIT_FILE" ) {
cvcCellErrorLimitFile = myBuffer;
cvcCellErrorLimitFile = myBuffer;
} else if ( myVariable == "CVC_CELL_CHECKSUM_FILE" ) {
cvcCellChecksumFile = myBuffer;
}
}
if ( ! IsEmpty(theReportPrefix) ) {
cvcReportName = theReportPrefix + "-" + cvcReportName;
}
/*
if ( gInteractive_cvc ) {
cvcReportName = "i-" + cvcReportName;
// size_t myBaseNameOffset = cvcReportFilename.find_last_of("/\\");
// if ( myBaseNameOffset < cvcReportFilename.length() ) {
// cvcReportFilename = cvcReportFilename.substr(0, myBaseNameOffset + 1) + "i-" + cvcReportFilename.substr(myBaseNameOffset + 1);
// } else {
// cvcReportFilename = "i-" + cvcReportFilename;
// }
}
*/
cvcReportFilename = cvcReportDirectory + cvcReportName;
cvcLockFile = cvcReportDirectory + "." + cvcReportName;
myEnvironmentFile.close();
Expand Down Expand Up @@ -339,18 +311,12 @@ returnCode_t CCvcParameters::LoadModels() {
reportFile << "ERROR: Could not open " << cvcModelFilename << endl;
return (FAIL);
}
// throw EFatalError("Could not open " + cvcModelFilename);
// exit(1);
}
string myInput, myVariable, myValue;
// wordexp_t myWordExpansion;
// char myBuffer[1024];

reportFile << "CVC: Reading device model settings..." << endl;
cvcModelListMap.hasError = false;
while ( getline(myModelFile, myInput) ) {
// myModelFile.getline(myBuffer, 1024);
// myInput = myBuffer;
if ( myInput[0] == '#' ) continue; // skip comments
if ( myInput.find_first_not_of(" \t\n") > myInput.length() ) continue; // skip blank lines
cvcModelListMap.AddModel(myInput);
Expand All @@ -365,27 +331,6 @@ returnCode_t CCvcParameters::LoadModels() {

}

/*
void CCvcParameters::AddTestPower() {
cvcPowerPtrList.push_back(new CPower("VDD 1.1"));
cvcPowerPtrList.push_back(new CPower("VSS -0.5"));
cvcPowerPtrList.push_back(new CPower("IN1 [email protected] [email protected] [email protected]"));
cvcPowerPtrList.push_back(new CPower("IN2 [email protected] [email protected]"));
cvcPowerPtrList.push_back(new CPower("OUT [email protected]"));
cvcPowerPtrList.push_back(new CPower("VDD 1.2"));
cvcPowerPtrList.push_back(new CPower("VSS 0.0"));
cvcPowerPtrList.push_back(new CPower("VCC 3.3"));
cvcPowerPtrList.push_back(new CPower("VBB -0.5"));
cvcPowerPtrList.push_back(new CPower("INH [email protected] [email protected] [email protected]"));
cvcPowerPtrList.push_back(new CPower("INL [email protected] [email protected] [email protected]"));
cvcPowerPtrList.push_back(new CPower("INX [email protected] [email protected]"));
cvcPowerPtrList.push_back(new CPower("OUTH [email protected]"));
cvcPowerPtrList.push_back(new CPower("OUTL [email protected]"));
}
*/

returnCode_t CCvcParameters::LoadPower() {
igzstream myPowerFile;
myPowerFile.open(cvcPowerFilename);
Expand All @@ -400,11 +345,8 @@ returnCode_t CCvcParameters::LoadPower() {
reportFile << "ERROR: Could not open " << cvcPowerFilename << endl;
return (FAIL);
}
// throw EFatalError("Could not open " + cvcPowerFilename);
// exit(1);
}
string myInput, myVariable, myValue;
// wordexp_t myWordExpansion;

reportFile << "CVC: Reading power settings..." << endl;
bool myPowerErrorFlag = false;
Expand All @@ -417,26 +359,6 @@ returnCode_t CCvcParameters::LoadPower() {
if ( myInput[0] == '#' && ! (myIsMacro || myIsInstance) ) continue; // skip comments
if ( myInput.find_first_not_of(" \t\n") > myInput.length() ) continue; // skip blank lines
myInput = trim_(myInput);
/* // handle bus signals in SetModePower
size_t mySignalEnd = myInput.find_first_of(" \t");
size_t myBusBegin = myInput.find_first_of("<");
size_t myBusDelimiter = myInput.find_first_of(":");
size_t myBusEnd = myInput.find_first_of(">");
if ( myBusBegin < myBusDelimiter && myBusDelimiter < myBusEnd && myBusEnd < mySignalEnd ) {
// cout << "Adding bus power definition:" << myInput << endl;
string myBaseSignal = myInput.substr(0, myBusBegin + 1);
int myFirstBusIndex = from_string<int>(myInput.substr(myBusBegin + 1, myBusDelimiter - myBusBegin - 1));
int myLastBusIndex = from_string<int>(myInput.substr(myBusDelimiter + 1, myBusEnd - myBusDelimiter - 1));
for ( int myBusIndex = min(myFirstBusIndex, myLastBusIndex); myBusIndex <= max(myFirstBusIndex, myLastBusIndex); myBusIndex++ ) {
string myPowerDefinition = myBaseSignal + to_string<int>(myBusIndex) + myInput.substr(myBusEnd);
cvcPowerPtrList.push_back(new CPower(myPowerDefinition));
// cout << " Added:" << myPowerDefinition << endl;
}
} else
*/
// cout << "Power definition: " << myInput << endl;
string myMacroName = "";
string myMacroDefinition;
if ( myIsMacro ) {
Expand Down
Loading

0 comments on commit 822bd43

Please sign in to comment.