diff --git a/vlsisapd/examples/openChams/CMakeLists.txt b/vlsisapd/examples/openChams/CMakeLists.txt index eaaa9a91..8e866eba 100644 --- a/vlsisapd/examples/openChams/CMakeLists.txt +++ b/vlsisapd/examples/openChams/CMakeLists.txt @@ -1,4 +1,8 @@ ADD_SUBDIRECTORY(cplusplus) ADD_SUBDIRECTORY(python) -INSTALL ( FILES inverter.xml DESTINATION share/doc/coriolis2/examples/vlsisapd/openChams ) +SET ( XML_FILES inverter.xml + buffer.xml + ) + +INSTALL ( FILES ${XML_FILES} DESTINATION share/doc/coriolis2/examples/vlsisapd/openChams ) diff --git a/vlsisapd/examples/openChams/buffer.xml b/vlsisapd/examples/openChams/buffer.xml new file mode 100644 index 00000000..20c8b872 --- /dev/null +++ b/vlsisapd/examples/openChams/buffer.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vlsisapd/examples/openChams/cplusplus/driveOpenChams.cpp b/vlsisapd/examples/openChams/cplusplus/driveOpenChams.cpp index 81f4d7c3..5d77cf91 100644 --- a/vlsisapd/examples/openChams/cplusplus/driveOpenChams.cpp +++ b/vlsisapd/examples/openChams/cplusplus/driveOpenChams.cpp @@ -4,6 +4,7 @@ using namespace std; #include "vlsisapd/openChams/Circuit.h" #include "vlsisapd/openChams/Netlist.h" #include "vlsisapd/openChams/Instance.h" +#include "vlsisapd/openChams/Device.h" #include "vlsisapd/openChams/Transistor.h" #include "vlsisapd/openChams/Net.h" #include "vlsisapd/openChams/Schematic.h" @@ -27,7 +28,7 @@ int main(int argc, char * argv[]) { OpenChams::Netlist* netlist = circuit->createNetlist(); // instances // nmos1 - OpenChams::Instance* inst_nmos1 = netlist->addInstance(OpenChams::Name("nmos1"), OpenChams::Name("Transistor"), OpenChams::Name("NMOS"), true); + OpenChams::Device* inst_nmos1 = netlist->addDevice(OpenChams::Name("nmos1"), OpenChams::Name("Transistor"), OpenChams::Name("NMOS"), true); inst_nmos1->addConnector(OpenChams::Name("G")); inst_nmos1->addConnector(OpenChams::Name("S")); inst_nmos1->addConnector(OpenChams::Name("D")); @@ -37,7 +38,7 @@ int main(int argc, char * argv[]) { tr_nmos1->setDrain (OpenChams::Name("D")); tr_nmos1->setBulk (OpenChams::Name("S")); // pmos1 - OpenChams::Instance* inst_pmos1 = netlist->addInstance(OpenChams::Name("pmos1"), OpenChams::Name("Transistor"), OpenChams::Name("PMOS"), true); + OpenChams::Device* inst_pmos1 = netlist->addDevice(OpenChams::Name("pmos1"), OpenChams::Name("Transistor"), OpenChams::Name("PMOS"), true); inst_pmos1->addConnector(OpenChams::Name("G")); inst_pmos1->addConnector(OpenChams::Name("S")); inst_pmos1->addConnector(OpenChams::Name("D")); diff --git a/vlsisapd/examples/openChams/cplusplus/parseOpenChams.cpp b/vlsisapd/examples/openChams/cplusplus/parseOpenChams.cpp index bf2b197d..c4e4619c 100644 --- a/vlsisapd/examples/openChams/cplusplus/parseOpenChams.cpp +++ b/vlsisapd/examples/openChams/cplusplus/parseOpenChams.cpp @@ -9,12 +9,14 @@ using namespace std; #include "vlsisapd/openChams/Parameters.h" #include "vlsisapd/openChams/Netlist.h" #include "vlsisapd/openChams/Instance.h" +#include "vlsisapd/openChams/Device.h" #include "vlsisapd/openChams/Net.h" #include "vlsisapd/openChams/Transistor.h" #include "vlsisapd/openChams/Schematic.h" #include "vlsisapd/openChams/Sizing.h" #include "vlsisapd/openChams/Operator.h" #include "vlsisapd/openChams/Layout.h" +#include "vlsisapd/openChams/OpenChamsException.h" int main(int argc, char * argv[]) { string file = ""; @@ -27,7 +29,13 @@ int main(int argc, char * argv[]) { exit(1); } - OpenChams::Circuit* circuit = OpenChams::Circuit::readFromFile(file); + OpenChams::Circuit* circuit = NULL; + try { + circuit = OpenChams::Circuit::readFromFile(file); + } catch (OpenChams::OpenChamsException& e) { + cerr << e.what() << endl; + exit(48); + } cerr << circuit->getName().getString() << endl; cerr << " + parameters" << endl; @@ -46,7 +54,13 @@ int main(int argc, char * argv[]) { if (netlist && !netlist->hasNoInstances()) { for (size_t i = 0 ; i < netlist->getInstances().size() ; i++) { OpenChams::Instance* inst = netlist->getInstances()[i]; - cerr << " | | + " << inst->getName().getString() << " : " << inst->getModel().getString() << " - " << inst->getMosType().getString() << " - " << (inst->isSourceBulkConnected()?"true":"false") << endl; + OpenChams::Device* dev = NULL; + if (dynamic_cast(inst)) { + dev = static_cast(inst); + cerr << " | | + " << dev->getName().getString() << " : " << dev->getModel().getString() << " - " << dev->getMosType().getString() << " - " << (dev->isSourceBulkConnected()?"true":"false") << endl; + } else { + cerr << " | | + " << inst->getName().getString() << " : " << inst->getModel().getString() << endl; + } cerr << " | | | + connectors" << endl; for (map::const_iterator cit = inst->getConnectors().begin() ; cit != inst->getConnectors().end() ; ++cit) { if ((*cit).second) @@ -54,10 +68,12 @@ int main(int argc, char * argv[]) { else cerr << " | | | | " << ((*cit).first).getString() << endl; // no net connected ! } - cerr << " | | | + transistors" << endl; - for (size_t j = 0 ; j < inst->getTransistors().size() ; j++) { - OpenChams::Transistor* tr = inst->getTransistors()[j]; - cerr << " | | | | name: " << tr->getName().getString() << " - gate: " << tr->getGate().getString() << " - source: " << tr->getSource().getString() << " - drain: " << tr->getDrain().getString() << " - bulk: " << tr->getBulk().getString() << endl; + if (dev) { + cerr << " | | | + transistors" << endl; + for (size_t j = 0 ; j < dev->getTransistors().size() ; j++) { + OpenChams::Transistor* tr = dev->getTransistors()[j]; + cerr << " | | | | name: " << tr->getName().getString() << " - gate: " << tr->getGate().getString() << " - source: " << tr->getSource().getString() << " - drain: " << tr->getDrain().getString() << " - bulk: " << tr->getBulk().getString() << endl; + } } } } diff --git a/vlsisapd/examples/openChams/inverter.xml b/vlsisapd/examples/openChams/inverter.xml index 5cd473f6..1eef7c55 100644 --- a/vlsisapd/examples/openChams/inverter.xml +++ b/vlsisapd/examples/openChams/inverter.xml @@ -1,5 +1,5 @@ - +