From 40be8dc4561529217e69318aaed5f963f5c7a43e Mon Sep 17 00:00:00 2001 From: Damien Dupuis Date: Fri, 8 Oct 2010 07:52:15 +0000 Subject: [PATCH] parseOpenChams can now parse any file or default inverter.xml file. --- .../openChams/cplusplus/parseOpenChams.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/vlsisapd/examples/openChams/cplusplus/parseOpenChams.cpp b/vlsisapd/examples/openChams/cplusplus/parseOpenChams.cpp index 68488150..bf2b197d 100644 --- a/vlsisapd/examples/openChams/cplusplus/parseOpenChams.cpp +++ b/vlsisapd/examples/openChams/cplusplus/parseOpenChams.cpp @@ -17,7 +17,17 @@ using namespace std; #include "vlsisapd/openChams/Layout.h" int main(int argc, char * argv[]) { - OpenChams::Circuit* circuit = OpenChams::Circuit::readFromFile("./inverter.xml"); + string file = ""; + if (argc == 1) + file = "./inverter.xml"; + else if (argc == 2) + file = argv[1]; + else { + cerr << "Usage: openChamsParser [filename]" << endl; + exit(1); + } + + OpenChams::Circuit* circuit = OpenChams::Circuit::readFromFile(file); cerr << circuit->getName().getString() << endl; cerr << " + parameters" << endl; @@ -39,7 +49,10 @@ int main(int argc, char * argv[]) { cerr << " | | + " << inst->getName().getString() << " : " << inst->getModel().getString() << " - " << inst->getMosType().getString() << " - " << (inst->isSourceBulkConnected()?"true":"false") << endl; cerr << " | | | + connectors" << endl; for (map::const_iterator cit = inst->getConnectors().begin() ; cit != inst->getConnectors().end() ; ++cit) { - cerr << " | | | | " << ((*cit).first).getString() << " : " << ((*cit).second)->getName().getString() << endl; + if ((*cit).second) + cerr << " | | | | " << ((*cit).first).getString() << " : " << ((*cit).second)->getName().getString() << endl; + else + cerr << " | | | | " << ((*cit).first).getString() << endl; // no net connected ! } cerr << " | | | + transistors" << endl; for (size_t j = 0 ; j < inst->getTransistors().size() ; j++) {