diff --git a/vlsisapd/examples/CMakeLists.txt b/vlsisapd/examples/CMakeLists.txt index 0efb27ba..4d1996a5 100644 --- a/vlsisapd/examples/CMakeLists.txt +++ b/vlsisapd/examples/CMakeLists.txt @@ -1,6 +1,10 @@ ADD_SUBDIRECTORY(cif) ADD_SUBDIRECTORY(agds) -ADD_SUBDIRECTORY(dtr) -ADD_SUBDIRECTORY(openChams) +if( IS_DIRECTORY dtr ) + ADD_SUBDIRECTORY(dtr) +endif( IS_DIRECTORY dtr ) +if( IS_DIRECTORY openChams ) + ADD_SUBDIRECTORY(openChams) +endif( IS_DIRECTORY openChams ) ADD_SUBDIRECTORY(liberty) ADD_SUBDIRECTORY(spice) diff --git a/vlsisapd/src/configuration/src/ConfEditorMain.cpp b/vlsisapd/src/configuration/src/ConfEditorMain.cpp index bf6e8d37..ea184d96 100644 --- a/vlsisapd/src/configuration/src/ConfEditorMain.cpp +++ b/vlsisapd/src/configuration/src/ConfEditorMain.cpp @@ -2,26 +2,22 @@ // -*- C++ -*- // // This file is part of the VSLSI Stand-Alone Software. -// Copyright (c) UPMC/LIP6 2008-2011, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | C O R I O L I S | +// +-----------------------------------------------------------------+ +// | V L S I Stand - Alone Parsers / Drivers | // | C o n f i g u r a t i o n D a t a - B a s e | // | | // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | -// | C++ Module : "./ConfEditorMain.cpp" | -// x-----------------------------------------------------------------x +// | C++ Module : "./ConfEditorMain.cpp" | +// +-----------------------------------------------------------------+ +#include #include #include -#include #include namespace boptions = boost::program_options; diff --git a/vlsisapd/src/configuration/src/PyConfiguration.cpp b/vlsisapd/src/configuration/src/PyConfiguration.cpp index 84b6eef9..bc9e066d 100644 --- a/vlsisapd/src/configuration/src/PyConfiguration.cpp +++ b/vlsisapd/src/configuration/src/PyConfiguration.cpp @@ -2,20 +2,16 @@ // -*- C++ -*- // // This file is part of the VSLSI Stand-Alone Software. -// Copyright (c) UPMC/LIP6 2008-2011, All Rights Reserved -// -// =================================================================== -// -// $Id$ +// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved // // +-----------------------------------------------------------------+ -// | C O R I O L I S | +// | V L S I Stand - Alone Parsers / Drivers | // | C o n f i g u r a t i o n D a t a - B a s e | // | | // | Author : Jean-Paul CHAPUT | // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | -// | C++ Module : "./PyConfiguration.cpp" | +// | C++ Module : "./PyConfiguration.cpp" | // +-----------------------------------------------------------------+ @@ -309,6 +305,7 @@ namespace Cfg { .def("getParameter" , cfgGetParameter2 , return_value_policy()) .def("addParameter" , cfgAddParameter2 , return_value_policy()) .def("addParameter" , cfgAddParameter3 , return_value_policy()) + .def("readFromFile" , &Configuration::readFromFile ) .def("pushDefaultPriority", &Configuration::pushDefaultPriority) .def("popDefaultPriority" , &Configuration::popDefaultPriority ) .def("getDefaultPriority" , &Configuration::getDefaultPriority ) diff --git a/vlsisapd/src/openChams/src/CMakeLists.txt b/vlsisapd/src/openChams/src/CMakeLists.txt index 6e86a39a..01f87f6e 100644 --- a/vlsisapd/src/openChams/src/CMakeLists.txt +++ b/vlsisapd/src/openChams/src/CMakeLists.txt @@ -5,7 +5,6 @@ SET ( hpps vlsisapd/openChams/Circuit.h vlsisapd/openChams/Instance.h vlsisapd/openChams/Device.h vlsisapd/openChams/Net.h - vlsisapd/openChams/Name.h vlsisapd/openChams/Operator.h vlsisapd/openChams/Parameters.h vlsisapd/openChams/Schematic.h @@ -28,7 +27,6 @@ SET ( cpps Circuit.cpp Instance.cpp Device.cpp Net.cpp - Name.cpp Operator.cpp Parameters.cpp Schematic.cpp diff --git a/vlsisapd/src/openChams/src/Circuit.cpp b/vlsisapd/src/openChams/src/Circuit.cpp index c477fb9b..dd78c1a0 100644 --- a/vlsisapd/src/openChams/src/Circuit.cpp +++ b/vlsisapd/src/openChams/src/Circuit.cpp @@ -1,11 +1,18 @@ -/* - * Circuit.cpp - * openChams - * - * Created by damien dupuis on 18/12/09. - * Copyright 2009 UPMC / LIP6. All rights reserved. - * - */ + +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2009-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./Circuit.cpp" | +// +-----------------------------------------------------------------+ #include #include @@ -37,6 +44,7 @@ using namespace std; #include "vlsisapd/openChams/DDP.h" #include "vlsisapd/openChams/DesignerCstrOC.h" + namespace OpenChams { @@ -145,13 +153,14 @@ namespace OpenChams { static bool readSizingDone = false; static bool readLayoutDone = false; - Circuit::Circuit(Name name, Name techno) : _name(name) - , _absolutePath("") - , _techno(techno) - , _netlist(NULL) - , _schematic(NULL) - , _sizing(NULL) - , _layout(NULL) + Circuit::Circuit(const std::string& name, const std::string& techno) + : _name (name) + , _absolutePath("") + , _techno (techno) + , _netlist (NULL) + , _schematic (NULL) + , _sizing (NULL) + , _layout (NULL) { readSubCircuitsPathsDone = false; readCircuitParametersDone = false; @@ -164,47 +173,53 @@ namespace OpenChams { readLayoutDone = false; } + // COMPARISON FUNCTION // - bool ConnectionsSort(const Net::Connection* c1, const Net::Connection* c2) { - return c1->getInstanceName() < c2->getInstanceName(); - } + bool ConnectionsSort(const Net::Connection* c1, const Net::Connection* c2) + { return c1->getInstanceName() < c2->getInstanceName(); } - bool InstanceNameSort(const Instance* i1, const Instance* i2) { - return i1->getName() < i2->getName(); - } - bool NetNameSort(const Net* n1, const Net* n2) { - return n1->getName() < n2->getName(); - } + bool InstanceNameSort(const Instance* i1, const Instance* i2) + { return i1->getName() < i2->getName(); } + + + bool NetNameSort(const Net* n1, const Net* n2) + { return n1->getName() < n2->getName(); } + // USEFUL // - void Circuit::check_uppercase(string& str, vector& compares, string message) { + void Circuit::check_uppercase(string& str, vector& compares, string message) + { transform(str.begin(), str.end(), str.begin(), ::toupper); bool equal = false; for (size_t i = 0 ; i < compares.size() ; i++) { if (str == compares[i]) { - equal = true; + equal = true; } } if (!equal) { throw OpenChamsException(message); } } - - void Circuit::check_lowercase(string& str, vector& compares, string message) { + + + void Circuit::check_lowercase(string& str, vector& compares, string message) + { transform(str.begin(), str.end(), str.begin(), ::tolower); bool equal = false; for (size_t i = 0 ; i < compares.size() ; i++) { if (str == compares[i]) { - equal = true; + equal = true; } } if (!equal) { throw OpenChamsException(message); } } + - void Circuit::addSimulModel(unsigned id, SimulModel::Base base, SimulModel::Version version, std::string filePath) { + void Circuit::addSimulModel(unsigned id, SimulModel::Base base, SimulModel::Version version, std::string filePath) + { SimulModel* sim = new SimulModel(id, base, version, filePath); map::iterator it = _simulModels.find(id); if (it != _simulModels.end()) @@ -212,30 +227,30 @@ namespace OpenChams { _simulModels[id] = sim; } - Name Circuit::readParameter(xmlNode* node, const xmlChar*& value) { + + string Circuit::readParameter(xmlNode* node, const xmlChar*& value) { xmlChar* paramNameC = xmlGetProp(node, (xmlChar*)"name"); value = xmlGetProp(node, (xmlChar*)"value"); - if (paramNameC and value) { - Name name((const char*)paramNameC); - return name; - } else { + if (!paramNameC or !value) throw OpenChamsException("[ERROR] 'parameter' node must have 'name' and 'value' properties."); - } - } - - Name Circuit::readConnector(xmlNode* node) { - xmlChar* connectorNameC = xmlGetProp(node, (xmlChar*)"name"); - if (connectorNameC) { - Name name((const char*)connectorNameC); - return name; - } else { - throw OpenChamsException("[ERROR] 'connector' node must have 'name' property."); - //return Name(""); - } + + return string((const char*)paramNameC); } + + string Circuit::readConnector(xmlNode* node) + { + xmlChar* connectorNameC = xmlGetProp(node, (xmlChar*)"name"); + if (!connectorNameC) + throw OpenChamsException("[ERROR] 'connector' node must have 'name' property."); + + return string((const char*)connectorNameC); + } + + // CIRCUIT // - void Circuit::readSubCircuitsPaths(xmlNode* node) { + void Circuit::readSubCircuitsPaths(xmlNode* node) + { if (readSubCircuitsPathsDone) { cerr << "[WARNING] Only one 'subCircuitsPaths' node is allowed in circuit, others will be ignored." << endl; return; @@ -274,8 +289,8 @@ namespace OpenChams { if (paramNode->type == XML_ELEMENT_NODE) { if (xmlStrEqual(paramNode->name, (xmlChar*)"parameter")) { const xmlChar* value = NULL; - Name paramName = readParameter(paramNode, value); - if (paramName == Name("")) return; // error + string paramName = readParameter(paramNode, value); + if (paramName.empty()) return; // error addParameter(paramName, (const char*)value); } else { cerr << "[WARNING] Only 'parameter' and 'parameterEq' nodes are allowed under 'parameters' node." << endl; @@ -400,8 +415,8 @@ namespace OpenChams { xmlChar* iSBCC = xmlGetProp(node, (xmlChar*)"sourceBulkConnected"); Instance* inst = NULL; if (iNameC && iModelC && iOrderC && iMOSC && iSBCC) { // this is a device - Name instanceName((const char*)iNameC); - Name modelName((const char*)iModelC); + const std::string& instanceName((const char*)iNameC); + const std::string& modelName((const char*)iModelC); unsigned order = stringAs(iOrderC); string mosStr((const char*)iMOSC); string mosComp[2] = {"NMOS", "PMOS"}; @@ -412,10 +427,10 @@ namespace OpenChams { vector sbcComps(sbcComp, sbcComp+4); check_lowercase(sourceBulkStr, sbcComps, "[ERROR] In 'instance', 'sourceBulkConnected' property must be 'true', 'false', 'on' or 'off'."); bool sourceBulkConnected = ((sourceBulkStr == "true") || (sourceBulkStr == "on")) ? true : false; - inst = (Instance*)netlist->addDevice(instanceName, modelName, order, Name(mosStr), sourceBulkConnected); + inst = (Instance*)netlist->addDevice(instanceName, modelName, order, mosStr, sourceBulkConnected); } else if (iNameC && iModelC && iOrderC && !iMOSC && !iSBCC) { // this is a subcircuit - Name instanceName((const char*)iNameC); - Name modelName((const char*)iModelC); + const std::string& instanceName((const char*)iNameC); + const std::string& modelName((const char*)iModelC); unsigned order = stringAs(iOrderC); inst = netlist->addInstance(instanceName, modelName, order); } else { @@ -448,8 +463,8 @@ namespace OpenChams { for (xmlNode* node = child; node; node = node->next) { if (node->type == XML_ELEMENT_NODE) { if (xmlStrEqual(node->name, (xmlChar*)"connector")) { - Name connectorName = readConnector(node); - if (connectorName == Name("")) return; // error + string connectorName = readConnector(node); + if (connectorName.empty()) return; // error inst->addConnector(connectorName); } } @@ -462,8 +477,8 @@ namespace OpenChams { if (node->type == XML_ELEMENT_NODE) { if (xmlStrEqual(node->name, (xmlChar*)"parameter")) { const xmlChar* value = NULL; - Name paramName = readParameter(node, value); - if (paramName == Name("")) return; // error + string paramName = readParameter(node, value); + if (paramName.empty()) return; // error inst->addParameter(paramName, (const char*)value); } else { cerr << "[WARNING] Only 'parameter' and 'parameterEq' nodes are allowed under 'instance' node." << endl; @@ -491,7 +506,7 @@ namespace OpenChams { xmlChar* tNameC = xmlGetProp(node, (xmlChar*)"name"); Transistor* trans = NULL; if (tNameC) { - Name tName((const char*)tNameC); + const std::string& tName((const char*)tNameC); trans = dev->addTransistor(tName); } else { throw OpenChamsException("[ERROR] 'transistor' node must have 'name' property."); @@ -518,10 +533,10 @@ namespace OpenChams { xmlChar* drainC = xmlGetProp(node, (xmlChar*)"drain"); xmlChar* bulkC = xmlGetProp(node, (xmlChar*)"bulk"); if (gateC && sourceC && drainC && bulkC) { - Name gateN ((const char*)gateC); - Name sourceN((const char*)sourceC); - Name drainN ((const char*)drainC); - Name bulkN ((const char*)bulkC); + const std::string& gateN ((const char*)gateC); + const std::string& sourceN((const char*)sourceC); + const std::string& drainN ((const char*)drainC); + const std::string& bulkN ((const char*)bulkC); trans->setGate(gateN); trans->setSource(sourceN); trans->setDrain(drainN); @@ -557,7 +572,7 @@ namespace OpenChams { xmlChar* nExternC = xmlGetProp(node, (xmlChar*)"isExternal"); Net* net = NULL; if (nNameC && nTypeC && nExternC) { - Name netName((const char*)nNameC); + const std::string& netName((const char*)nNameC); string typeStr((const char*)nTypeC); string typeComp[3] = {"power", "ground", "logical"}; vector typeComps(typeComp, typeComp+3); @@ -567,7 +582,7 @@ namespace OpenChams { vector extComps(extComp, extComp+4); check_lowercase(externStr, extComps, "[ERROR] In 'net', 'isExternal' must be 'true', 'false', 'on' or 'off'."); bool isExternal = ((externStr == "true") || (externStr == "on")) ? true : false; - net = netlist->addNet(netName, Name(typeStr), isExternal); + net = netlist->addNet(netName, typeStr, isExternal); } else { throw OpenChamsException("[ERROR] 'net' node must have 'name', 'type' and 'isExternal' properties."); //return net; @@ -591,14 +606,14 @@ namespace OpenChams { xmlChar* instanceNameC = xmlGetProp(node, (xmlChar*)"instance"); xmlChar* connectorNameC = xmlGetProp(node, (xmlChar*)"name"); if (instanceNameC && connectorNameC) { - Name iName((const char*)instanceNameC); - Name cName((const char*)connectorNameC); + const std::string& iName((const char*)instanceNameC); + const std::string& cName((const char*)connectorNameC); Instance* inst = net->getNetlist()->getInstance(iName); if (!inst) { string error("[ERROR] no instance named \""); - error += iName.getString(); + error += iName; error += "\" in connector of net \""; - error += net->getName().getString(); + error += net->getName(); error += "\"."; throw OpenChamsException(error); //return; @@ -640,14 +655,14 @@ namespace OpenChams { xmlChar* yC = xmlGetProp(node, (xmlChar*)"y"); xmlChar* orientC = xmlGetProp(node, (xmlChar*)"orient"); if (nameC && xC && yC && orientC) { - Name iName((const char*)nameC); + const std::string& iName((const char*)nameC); double x = stringAs((const char*)xC); double y = stringAs((const char*)yC); string orientStr((const char*)orientC); string orientComp[8] = {"ID", "R1", "R2", "R3", "MX", "XR", "MY", "YR"}; vector orientComps (orientComp, orientComp+8); check_uppercase(orientStr, orientComps, "[ERROR] In 'schematic'.'instance', 'orient' must be 'ID', 'R1', 'R2', 'R3', 'MX', 'XR', 'MY' or 'YR'."); - schematic->addInstance(iName, x, y, Name(orientStr)); + schematic->addInstance(iName, x, y, orientStr); } else { throw OpenChamsException("[ERROR] 'instance' node in 'schematic' must have 'name', 'x', 'y' and 'orient' properties."); } @@ -656,11 +671,11 @@ namespace OpenChams { void Circuit::readNetSchematic(xmlNode* node, Circuit* circuit) { xmlChar* nameC = xmlGetProp(node, (xmlChar*)"name"); if (nameC) { - Name nName((const char*)nameC); + const std::string& nName((const char*)nameC); Net* net = circuit->getNetlist()->getNet(nName); if (!net) { string error ("[ERROR] In 'schematic' section cannot specify wires for net "); - error += nName.getString(); + error += nName; error += " since it has not been defined in netlist section."; throw OpenChamsException(error); } @@ -688,7 +703,7 @@ namespace OpenChams { xmlChar* yC = xmlGetProp(node, (xmlChar*)"y"); xmlChar* orientC = xmlGetProp(node, (xmlChar*)"orient"); if (typeC && idxC && xC && yC && orientC) { - Name pType((const char*)typeC); + const std::string& pType((const char*)typeC); unsigned idx = stringAs(idxC); double x = stringAs(xC); double y = stringAs(yC); @@ -696,7 +711,7 @@ namespace OpenChams { string orientComp[8] = {"ID", "R1", "R2", "R3", "MX", "XR", "MY", "YR"}; vector orientComps (orientComp, orientComp+8); check_uppercase(orientStr, orientComps, "[ERROR] In 'schematic'.'port', 'orient' must be 'ID', 'R1', 'R2', 'R3', 'MX', 'XR', 'MY' or 'YR'."); - net->addPort(pType, idx, x, y, Name(orientStr)); + net->addPort(pType, idx, x, y, orientStr); } else { throw OpenChamsException("[ERROR] 'schematic'.'port' must have 'type', 'idx', 'x', 'y' and 'orient' properties."); } @@ -712,8 +727,8 @@ namespace OpenChams { xmlChar* plugC = xmlGetProp(node, (xmlChar*)"plug"); xmlChar* idxC = xmlGetProp(node, (xmlChar*)"idx"); if (nameC && plugC) { - Name name((const char*)nameC); - Name plug((const char*)plugC); + const std::string& name((const char*)nameC); + const std::string& plug((const char*)plugC); if (!wire->getStartPoint()) { wire->setStartPoint(name, plug); } else if (!wire->getEndPoint()) { @@ -781,11 +796,11 @@ namespace OpenChams { xmlChar* operatorC = xmlGetProp(node, (xmlChar*)"operator"); xmlChar* simulModC = xmlGetProp(node, (xmlChar*)"simulModel"); if (nameC && operatorC && simulModC) { - Name iName ((const char*)nameC); + const std::string& iName ((const char*)nameC); string opStr ((const char*)operatorC); transform(opStr.begin(), opStr.end(), opStr.begin(), ::toupper); - Name opName (opStr); - Name simulMod((const char*)simulModC); + const std::string& opName (opStr); + const std::string& simulMod((const char*)simulModC); Operator* op = sizing->addOperator(iName, opName, simulMod); xmlNode* child = node->children; for (xmlNode* node = child; node; node = node->next) { @@ -813,17 +828,17 @@ namespace OpenChams { xmlChar* refEqC = xmlGetProp(node, (xmlChar*)"refEquation"); xmlChar* factorC = xmlGetProp(node, (xmlChar*)"factor"); if (paramC && refC && refParamC) { - Name param ((const char*)paramC); - Name ref ((const char*)refC); - Name refParam ((const char*)refParamC); + const std::string& param ((const char*)paramC); + const std::string& ref ((const char*)refC); + const std::string& refParam ((const char*)refParamC); double factor = 1.0; if (factorC) { factor = stringAs(factorC); } op->addConstraint(param, ref, refParam, factor); } else if (paramC && refEqC) { - Name param ((const char*)paramC); - Name refEq ((const char*)refEqC); + const std::string& param ((const char*)paramC); + const std::string& refEq ((const char*)refEqC); double factor = 1.0; if (factorC) { factor = stringAs(factorC); @@ -860,7 +875,7 @@ namespace OpenChams { xmlChar* nameC = xmlGetProp(eqNode, (xmlChar*)"name"); xmlChar* equationC = xmlGetProp(eqNode, (xmlChar*)"equation"); if (nameC && equationC) { - Name eName ((const char*)nameC); + const std::string& eName ((const char*)nameC); string eqStr ((const char*)equationC); HighLevelCstr* equation = new HighLevelCstr(); equation->addEquation(eqStr); @@ -880,7 +895,7 @@ namespace OpenChams { xmlChar* nameC = xmlGetProp(eqNode, (xmlChar*)"name"); xmlChar* equationC = xmlGetProp(eqNode, (xmlChar*)"equation"); if (nameC && equationC) { - Name eName ((const char*)nameC); + const std::string& eName ((const char*)nameC); string eqStr ((const char*)equationC); DesignerCstrOC* equation = new DesignerCstrOC(); equation->addEquation(eqStr); @@ -903,7 +918,7 @@ namespace OpenChams { xmlChar* paramC = xmlGetProp(eqNode, (xmlChar*)"param"); xmlChar* equationC = xmlGetProp(eqNode, (xmlChar*)"equation"); if (nameC && equationC && paramC) { - Name eName ((const char*)nameC); + const std::string& eName ((const char*)nameC); string eqStr ((const char*)equationC); string paramStr ((const char*)paramC); NRCCstr* equation = new NRCCstr(paramStr); @@ -926,7 +941,7 @@ namespace OpenChams { if (eqNode->type == XML_ELEMENT_NODE && xmlStrEqual(eqNode->name, (xmlChar*)"ddp_i")) { xmlChar* nameC = xmlGetProp(eqNode, (xmlChar*)"name"); if (nameC) { - Name eName ((const char*)nameC); + const std::string& eName ((const char*)nameC); DDP* equation = new DDP(); for(xmlNode* eqNode2 = eqNode->children ; eqNode2 ; eqNode2 = eqNode2->next) { if (eqNode2->type == XML_ELEMENT_NODE && xmlStrEqual(eqNode2->name, (xmlChar*)"ddp_eq")) { @@ -978,8 +993,8 @@ namespace OpenChams { xmlChar* nameC = xmlGetProp(node, (xmlChar*)"name"); xmlChar* styleC = xmlGetProp(node, (xmlChar*)"style"); if (nameC && styleC) { - Name iName ((const char*)nameC); - Name styleName ((const char*)styleC); + const std::string& iName ((const char*)nameC); + const std::string& styleName ((const char*)styleC); layout->addInstance(iName, styleName); } else { throw OpenChamsException("[ERROR] 'instance' node in 'layout' must have 'name' and 'style' properties."); @@ -1007,7 +1022,7 @@ namespace OpenChams { if (!nameC) throw OpenChamsException("[ERROR] 'bloc' and 'group' nodes in 'hbtree' must have at least a 'name' property."); Node* nodeOC = NULL; - Name name ((const char*)nameC); + const std::string& name ((const char*)nameC); Node::Position pos = Node::NONE; if (posiC) { string posStr ((const char*)posiC); @@ -1097,8 +1112,8 @@ namespace OpenChams { xmlChar* technoNameC = xmlGetProp(rootElement, (xmlChar*)"techno"); if (circuitNameC && technoNameC) { - Name circuitName ((const char*)circuitNameC); - Name technoName ((const char*)technoNameC); + const std::string& circuitName ((const char*)circuitNameC); + const std::string& technoName ((const char*)technoNameC); cir = new Circuit(circuitName, technoName); } else { throw OpenChamsException("[ERROR] 'circuit' node must have 'name' and 'techno' properties."); @@ -1208,7 +1223,7 @@ namespace OpenChams { Bloc* bloc = dynamic_cast(node); if (bloc) { - file << "getName().getString() << "\""; + file << "getName() << "\""; if (pos != "") file << " position=\"" << pos << "\""; if (bloc->getTop() == NULL && bloc->getRight() == NULL) @@ -1236,7 +1251,7 @@ namespace OpenChams { default: break; } - file << "getName().getString() << "\""; + file << "getName() << "\""; if (pos != "") file << " position=\"" << pos << "\""; if (align != "") file << " align=\"" << align << "\""; if (group->isIsolated()) file << " isolated=\"true\""; @@ -1279,7 +1294,7 @@ namespace OpenChams { } file << "" << endl - << "" << endl; + << "" << endl; if (_subCircuitsPaths.size() != 0) { file << " " << endl; for (size_t i = 0 ; i < _subCircuitsPaths.size() ; i++ ) { @@ -1289,8 +1304,8 @@ namespace OpenChams { } if (!_params.isEmpty()) { file << " " << endl; - for (map::const_iterator it = _params.getValues().begin() ; it != _params.getValues().end() ; ++it) { - file << " " << endl; + for (map::const_iterator it = _params.getValues().begin() ; it != _params.getValues().end() ; ++it) { + file << " " << endl; } cerr << "_params.getValues().size() = " << _params.getValues().size() << endl; file << " " << endl; @@ -1304,34 +1319,34 @@ namespace OpenChams { Device* dev = dynamic_cast(inst); if (inst->hasNoConnectors()) { string error("[ERROR] Cannot writeToFile since instance ("); - error += inst->getName().getString(); + error += inst->getName(); error += ") has no connectors !"; throw OpenChamsException(error); //return false; } if (dev && dev->hasNoTransistors()) { string error("[ERROR] Cannot writeToFile since device instance ("); - error += dev->getName().getString(); + error += dev->getName(); error += ") has no transistors !"; throw OpenChamsException(error); } if (dev) { string sourceBulkStr = (dev->isSourceBulkConnected()) ? "True" : "False"; - file << " getName().getString() << "\" model=\"" << dev->getModel().getString() << "\" mostype=\"" << dev->getMosType().getString() << "\" sourceBulkConnected=\"" << sourceBulkStr << "\" order=\"" << dev->getOrder() << "\">" << endl; + file << " getName() << "\" model=\"" << dev->getModel() << "\" mostype=\"" << dev->getMosType() << "\" sourceBulkConnected=\"" << sourceBulkStr << "\" order=\"" << dev->getOrder() << "\">" << endl; } else { - file << " getName().getString() << "\" model=\"" << inst->getModel().getString() << "\" order=\"" << inst->getOrder() << "\">" << endl; + file << " getName() << "\" model=\"" << inst->getModel() << "\" order=\"" << inst->getOrder() << "\">" << endl; } file << " " << endl; - for (map::const_iterator it = inst->getConnectors().begin() ; it != inst->getConnectors().end() ; ++it) { - file << " " << endl; + for (map::const_iterator it = inst->getConnectors().begin() ; it != inst->getConnectors().end() ; ++it) { + file << " " << endl; } file << " " << endl; if (dev) { file << " " << endl; for (vector::const_iterator it = dev->getTransistors().begin() ; it != dev->getTransistors().end() ; ++it ) { Transistor* tr = (*it); - file << " getName().getString() << "\">" << endl - << " getGate().getString() << "\" source=\"" << tr->getSource().getString() << "\" drain=\"" << tr->getDrain().getString() << "\" bulk=\"" << tr->getBulk().getString() << "\"/>" << endl + file << " getName() << "\">" << endl + << " getGate() << "\" source=\"" << tr->getSource() << "\" drain=\"" << tr->getDrain() << "\" bulk=\"" << tr->getBulk() << "\"/>" << endl << " " << endl; } file << " " << endl; @@ -1339,8 +1354,8 @@ namespace OpenChams { if (!inst->getParameters().isEmpty()) { Parameters params = inst->getParameters(); file << " " << endl; - for (map::const_iterator it = params.getValues().begin() ; it != params.getValues().end() ; ++it) { - file << " " << endl; + for (map::const_iterator it = params.getValues().begin() ; it != params.getValues().end() ; ++it) { + file << " " << endl; } file << " " << endl; } @@ -1355,7 +1370,7 @@ namespace OpenChams { Net* net = (*it); if (net->hasNoConnections()) { string error("[ERROR] Cannot writeToFile since net ("); - error += net->getName().getString(); + error += net->getName(); error += ") has no connectors !"; throw OpenChamsException(error); //return false; @@ -1363,11 +1378,11 @@ namespace OpenChams { if (!net->hasNoPorts() || !net->hasNoWires()) schematicNets = true; string externStr = (net->isExternal()) ? "True" : "False"; - file << " getName().getString() << "\" type=\"" << net->getType().getString() << "\" isExternal=\"" << externStr << "\">" << endl; + file << " getName() << "\" type=\"" << net->getType() << "\" isExternal=\"" << externStr << "\">" << endl; vector connections = net->getConnections(); sort(connections.begin(), connections.end(), ConnectionsSort); for (vector::iterator it = connections.begin() ; it != connections.end() ; ++it) { - file << " getInstanceName().getString() << "\" name=\"" << (*it)->getConnectorName().getString() << "\"/>" << endl; + file << " getInstanceName() << "\" name=\"" << (*it)->getConnectorName() << "\"/>" << endl; } file << " " << endl; } @@ -1375,21 +1390,21 @@ namespace OpenChams { file << " " << endl; if (_schematic && !_schematic->hasNoInstances()) { file << " " << endl; - for (map::const_iterator it = _schematic->getInstances().begin() ; it != _schematic->getInstances().end(); ++it ) { + for (map::const_iterator it = _schematic->getInstances().begin() ; it != _schematic->getInstances().end(); ++it ) { Schematic::Infos* infos = (*it).second; - file << " getX() << "\" y=\"" << infos->getY() << "\" orient=\"" << infos->getOrientation().getString() << "\"/>" << endl; + file << " getX() << "\" y=\"" << infos->getY() << "\" orient=\"" << infos->getOrientation() << "\"/>" << endl; } if (schematicNets) { for (size_t i = 0 ; i < nets.size() ; i++) { Net* net = nets[i]; if (net->hasNoPorts() && net->hasNoWires()) continue; - file << " getName().getString() << "\">" << endl; + file << " getName() << "\">" << endl; for (size_t j = 0 ; j < net->getPorts().size() ; j++) { Port* port = net->getPorts()[j]; if (!port) continue; - file << " getType().getString() << "\" idx=\"" << port->getIndex() << "\" x=\"" << port->getX() << "\" y=\"" << port->getY() << "\" orient=\"" << port->getOrientation().getString() << "\"/>" << endl; + file << " getType() << "\" idx=\"" << port->getIndex() << "\" x=\"" << port->getX() << "\" y=\"" << port->getY() << "\" orient=\"" << port->getOrientation() << "\"/>" << endl; } for (size_t j = 0 ; j < net->getWires().size() ; j++) { Wire* wire = net->getWires()[j]; @@ -1399,7 +1414,7 @@ namespace OpenChams { // start point if (dynamic_cast(start)) { InstancePoint* iP = static_cast(start); - file << " getName().getString() << "\" plug=\"" << iP->getPlug().getString() << "\"/>" << endl; + file << " getName() << "\" plug=\"" << iP->getPlug() << "\"/>" << endl; } else if (dynamic_cast(start)) { PortPoint* pP = static_cast(start); file << " getIndex() << "\"/>" << endl; @@ -1414,7 +1429,7 @@ namespace OpenChams { // end point if (dynamic_cast(end)) { InstancePoint* iP = static_cast(end); - file << " getName().getString() << "\" plug=\"" << iP->getPlug().getString() << "\"/>" << endl; + file << " getName() << "\" plug=\"" << iP->getPlug() << "\"/>" << endl; } else if (dynamic_cast(end)) { PortPoint* pP = static_cast(end); file << " getIndex() << "\"/>" << endl; @@ -1434,19 +1449,19 @@ namespace OpenChams { file << " " << endl; if (_sizing && !_sizing->hasNoOperators()) { // file << " " << endl; - for (map::const_iterator it = _sizing->getOperators().begin() ; it != _sizing->getOperators().end() ; ++it) { + for (map::const_iterator it = _sizing->getOperators().begin() ; it != _sizing->getOperators().end() ; ++it) { Operator* op = (*it).second; - string opName = op->getName().getString(); + string opName = op->getName(); transform(opName.begin(), opName.end(), opName.begin(), ::toupper); - file << " getSimulModel().getString() << "\">" << endl; + file << " getSimulModel() << "\">" << endl; if (!op->hasNoConstraints()) { - for (map::const_iterator cit = op->getConstraints().begin() ; cit != op->getConstraints().end() ; ++cit) { + for (map::const_iterator cit = op->getConstraints().begin() ; cit != op->getConstraints().end() ; ++cit) { Operator::Constraint* cn = (*cit).second; - Name ref = cn->getRef(); - if (ref == Name("")) { - file << " getRefParam().getString() << "\" factor=\"" << cn->getFactor() << "\"/>" << endl; + const std::string& ref = cn->getRef(); + if (ref.empty()) { + file << " getRefParam() << "\" factor=\"" << cn->getFactor() << "\"/>" << endl; } else { - file << " getRef().getString() << "\" refParam=\"" << cn->getRefParam().getString() << "\" factor=\"" << cn->getFactor() << "\"/>" << endl; + file << " getRef() << "\" refParam=\"" << cn->getRefParam() << "\" factor=\"" << cn->getFactor() << "\"/>" << endl; } } } @@ -1456,35 +1471,35 @@ namespace OpenChams { // EQUATIONS if (_sizing && !_sizing->hasNoEquations()) { file << " " << endl; - // for (map::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) - // file << " " << endl; + // for (map::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) + // file << " " << endl; file << " " << endl; - for(map::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) { + for(map::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) { if(dynamic_cast((*it).second)) - file << " getEquationStr()[0] << "\"/>" << endl; + file << " getEquationStr()[0] << "\"/>" << endl; } file << " " << endl; file << " " << endl; - for(map::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) { + for(map::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) { if(dynamic_cast((*it).second)) - file << " getEquationStr()[0] << "\"/>" << endl; + file << " getEquationStr()[0] << "\"/>" << endl; } file << " " << endl; file << " " << endl; - for(map::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) { + for(map::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) { if(dynamic_cast((*it).second)) { NRCCstr* nrcCstr = (NRCCstr*)((*it).second); - file << " getVoltage() << "\" equation=\"" << (*it).second->getEquationStr()[0] << "\"/>" << endl; + file << " getVoltage() << "\" equation=\"" << (*it).second->getEquationStr()[0] << "\"/>" << endl; } } file << " " << endl; file << " " << endl; - for(map::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) { + for(map::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) { if(dynamic_cast((*it).second)) { - file << " " << endl; + file << " " << endl; for(map::const_iterator it2 = (*it).second->getEquationStr().begin(); it2!=(*it).second->getEquationStr().end(); ++it2) file << " " << endl; file << " " << endl; @@ -1502,8 +1517,8 @@ namespace OpenChams { if (_layout) { file << " " << endl; if (!_layout->hasNoInstance()) { - for (map::const_iterator it = _layout->getInstances().begin() ; it != _layout->getInstances().end() ; ++it) { - file << " " << endl; + for (map::const_iterator it = _layout->getInstances().begin() ; it != _layout->getInstances().end() ; ++it) { + file << " " << endl; } } if (Node* root = _layout->getHBTreeRoot()) { diff --git a/vlsisapd/src/openChams/src/Device.cpp b/vlsisapd/src/openChams/src/Device.cpp index 7e2080f6..ca80933b 100644 --- a/vlsisapd/src/openChams/src/Device.cpp +++ b/vlsisapd/src/openChams/src/Device.cpp @@ -1,11 +1,19 @@ -/* - * Device.cpp - * openChams - * - * Created by damien dupuis on 22/11/10. - * Copyright 2010 UPMC / LIP6. All rights reserved. - * - */ + +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./Device.cpp" | +// +-----------------------------------------------------------------+ + #include using namespace std; @@ -16,19 +24,35 @@ using namespace std; #include "vlsisapd/openChams/OpenChamsException.h" namespace OpenChams { -Device::Device(Name name, Name model, unsigned order, Name mosType, bool sourceBulkConnected, Netlist* netlist) - : Instance(name, model, order, netlist) - , _mosType(mosType) - , _sourceBulkConnected(sourceBulkConnected) - , _trans() {} -Transistor* Device::addTransistor(Name name) { + + Device::Device ( const string& name + , const string& model + , unsigned order + , const string& mosType + , bool sourceBulkConnected + , Netlist* netlist ) + : Instance (name,model,order,netlist) + , _mosType (mosType) + , _sourceBulkConnected(sourceBulkConnected) + , _trans () + { } + + + Device::~Device () + { } + + + Transistor* Device::addTransistor ( const string& name ) + { Transistor* tr = new Transistor(name, this); if (!tr) - throw OpenChamsException("[ERROR] Cannot create transistor."); + throw OpenChamsException("[ERROR] Cannot create transistor."); _trans.push_back(tr); return tr; -} -} + } + + +} // OpenChams namespace diff --git a/vlsisapd/src/openChams/src/Instance.cpp b/vlsisapd/src/openChams/src/Instance.cpp index 517302d3..f25f76b3 100644 --- a/vlsisapd/src/openChams/src/Instance.cpp +++ b/vlsisapd/src/openChams/src/Instance.cpp @@ -1,11 +1,19 @@ -/* - * Instance.cpp - * openChams - * - * Created by damien dupuis on 12/01/10. - * Copyright 2010 UPMC / LIP6. All rights reserved. - * - */ + +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./Instance.cpp" | +// +-----------------------------------------------------------------+ + #include using namespace std; @@ -15,56 +23,64 @@ using namespace std; #include "vlsisapd/openChams/Net.h" #include "vlsisapd/openChams/OpenChamsException.h" + namespace OpenChams { -Instance::Instance(Name name, Name model, unsigned order, Netlist* netlist) + + Instance::Instance(const string& name, const string& model, unsigned order, Netlist* netlist) : _name(name) , _model(model) , _order(order) , _netlist(netlist) , _params() - , _netMap() {} + , _netMap() + { } Instance::~Instance () { } -void Instance::addConnector(Name name) { - // si name n'est pas déjà présent dans la map on ajoute name, NULL (pas de net) - map::iterator it = _netMap.find(name); + void Instance::addConnector(const string& name) + { + // si name n'est pas déjà présent dans la map on ajoute name, NULL (pas de net) + map::iterator it = _netMap.find(name); if (it == _netMap.end()) { - _netMap[name] = NULL; + _netMap[name] = NULL; } else { - string error("[ERROR] The same instance cannot have several connectors with same name ("); - error += name.getString(); - error += ")."; - throw OpenChamsException(error); + string error("[ERROR] The same instance cannot have several connectors with same name ("); + error += name; + error += ")."; + throw OpenChamsException(error); } -} - -void Instance::connect(Name connectorName, Name netName) { - // si connectorName n'est pas déjà présent dans la map : - // on cherche le net associé a netName dans la netlist (getNet(Name)) - // on ajoute cName, net a la map - map::iterator it = _netMap.find(connectorName); + } + + + void Instance::connect(const string& connectorName, const string& netName) + { + // si connectorName n'est pas déjà présent dans la map : + // on cherche le net associé a netName dans la netlist (getNet(const string&)) + // on ajoute cName, net a la map + map::iterator it = _netMap.find(connectorName); if (it != _netMap.end()) { - Net* net = _netlist->getNet(netName); - if (!net) { - string error("[ERROR] While connecting instance : net ("); - error += netName.getString(); - error += ") does not exist."; - throw OpenChamsException(error); - } - else - _netMap[connectorName] = net; - } - else { - string error("[ERROR] While connecting instance : connector ("); - error += connectorName.getString(); + Net* net = _netlist->getNet(netName); + if (!net) { + string error("[ERROR] While connecting instance : net ("); + error += netName; error += ") does not exist."; throw OpenChamsException(error); + } + else + _netMap[connectorName] = net; } -} -} + else { + string error("[ERROR] While connecting instance : connector ("); + error += connectorName; + error += ") does not exist."; + throw OpenChamsException(error); + } + } + + +} // OpenChams namespace. diff --git a/vlsisapd/src/openChams/src/Layout.cpp b/vlsisapd/src/openChams/src/Layout.cpp index 57de6285..90f10274 100644 --- a/vlsisapd/src/openChams/src/Layout.cpp +++ b/vlsisapd/src/openChams/src/Layout.cpp @@ -1,32 +1,47 @@ -/* - * Layout.cpp - * openChams - * - * Created by damien dupuis on 31/08/10. - * Copyright 2008-2011 UPMC / LIP6. All rights reserved. - * - */ -#include -using namespace std; +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./Layout.cpp" | +// +-----------------------------------------------------------------+ + #include "vlsisapd/openChams/Layout.h" #include "vlsisapd/openChams/Circuit.h" #include "vlsisapd/openChams/OpenChamsException.h" +using namespace std; + namespace OpenChams { -Layout::Layout(Circuit* circuit): _circuit(circuit), _hbTreeRoot(NULL), _instances() {} - -void Layout::addInstance(Name name, Name style) { - map::iterator it = _instances.find(name); + + + Layout::Layout ( Circuit* circuit ) + : _circuit (circuit) + , _hbTreeRoot(NULL) + , _instances () + { } + + + void Layout::addInstance ( const string& name, const string& style ) + { + map::iterator it = _instances.find(name); if (it != _instances.end()) { - string error("[ERROR] Cannot set several instances with the same name in 'layout' ("); - error += name.getString(); - error += ")."; - throw OpenChamsException(error); + string error("[ERROR] Cannot set several instances with the same name in 'layout' ("); + error += name; + error += ")."; + throw OpenChamsException(error); } _instances[name] = style; -} + } -} // namespace +} // OpenChams namespace. diff --git a/vlsisapd/src/openChams/src/Name.cpp b/vlsisapd/src/openChams/src/Name.cpp deleted file mode 100644 index 0ed88663..00000000 --- a/vlsisapd/src/openChams/src/Name.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Name.cpp - * openChams - * - * Created by damien dupuis on 18/12/09. - * Copyright 2009 UPMC / LIP6. All rights reserved. - * - */ - -using namespace std; - -#include "vlsisapd/openChams/Name.h" - -namespace OpenChams { -unsigned long Name::_globalId = 0; -map Name::_dict; - -Name::Name() : _str(NULL) { - map::iterator it = _dict.find(""); - if (it != _dict.end()) { - _id = (*it).second; - _str = &((*it).first); - } else { - _id = _globalId++; - it = _dict.insert(_dict.begin(), make_pair("", _id)); - _str = &((*it).first); - } -} - -Name::Name(string str) : _str(NULL) { - map::iterator it = _dict.find(str); - if (it != _dict.end()) { - _id = (*it).second; - _str = &((*it).first); - } else { - _id = _globalId++; - it = _dict.insert(_dict.begin(), make_pair(str, _id)); - _str = &((*it).first); - } -} - -Name::Name(const char* c) : _str(NULL) { - string str(c); - map::iterator it = _dict.find(str); - if (it != _dict.end()) { - _id = (*it).second; - _str = &((*it).first); - } else { - _id = _globalId++; - it = _dict.insert(_dict.begin(), make_pair(str, _id)); - _str = &((*it).first); - } -} - -bool Name::operator==(const Name& n) const { - return (_id == n._id); -} - -bool Name::operator==(const string& str) const { - Name n(str); - return (_id == n._id); -} -bool Name::operator<(const Name& n) const { - //return (_id < n._id); // does not assert determinism in driving since hurricane do not care about name's ID --> need an alphabetical check on string - return (*_str < n.getString()); -} -} // namespace - diff --git a/vlsisapd/src/openChams/src/Net.cpp b/vlsisapd/src/openChams/src/Net.cpp index c87162b5..017d76f8 100644 --- a/vlsisapd/src/openChams/src/Net.cpp +++ b/vlsisapd/src/openChams/src/Net.cpp @@ -1,13 +1,19 @@ -/* - * Net.cpp - * openChams - * - * Created by damien dupuis on 12/01/10. - * Copyright 2010 UPMC / LIP6. All rights reserved. - * - */ -using namespace std; +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./Net.cpp" | +// +-----------------------------------------------------------------+ + #include "vlsisapd/openChams/Net.h" #include "vlsisapd/openChams/Instance.h" @@ -16,47 +22,63 @@ using namespace std; #include "vlsisapd/openChams/Wire.h" #include "vlsisapd/openChams/OpenChamsException.h" +using namespace std; + + namespace OpenChams { -Net::Net(Name netName, Name typeName, bool isExternal, Netlist* netlist) - : _name(netName) - , _typeName(typeName) - , _isExternal(isExternal) - , _netlist(netlist) + + + Net::Net(const std::string& netName, const std::string& typeName, bool isExternal, Netlist* netlist) + : _name (netName) + , _typeName (typeName) + , _isExternal (isExternal) + , _netlist (netlist) , _connections() - , _ports() - , _wires() -{} + , _ports () + , _wires () + { } -void Net::connectTo(Name instanceName, Name connectorName) { + + void Net::connectTo(const std::string& instanceName, const std::string& connectorName) + { _connections.push_back(new Net::Connection(instanceName, connectorName)); Instance* inst = _netlist->getInstance(instanceName); if (!inst) { - string error ("[ERROR] While connecting net "); - error += _name.getString(); - error += " to instance "; - error += instanceName.getString(); - error += ": instance does not exist in netlist !"; - throw OpenChamsException(error); + string error ("[ERROR] While connecting net "); + error += _name; + error += " to instance "; + error += instanceName; + error += ": instance does not exist in netlist !"; + throw OpenChamsException(error); } else { - inst->connect(connectorName, _name); + inst->connect(connectorName, _name); } -} + } -Port* Net::addPort(Name type, unsigned idx, double x, double y, Name orient) { + + Port* Net::addPort(const std::string& type, unsigned idx, double x, double y, const std::string& orient) + { while (_ports.size() <= idx) - _ports.push_back(NULL); + _ports.push_back(NULL); if (_ports[idx]) - throw OpenChamsException("[ERROR] Net::addPort: cannot add port since another one with the same id already exists."); + throw OpenChamsException("[ERROR] Net::addPort: cannot add port since another one with the same id already exists."); _ports[idx] = new Port(type, idx, x, y, orient); return _ports[idx]; -} + } -Wire* Net::addWire() { + + Wire* Net::addWire() { Wire* w = new Wire(); _wires.push_back(w); return w; -} + } -Net::Connection::Connection(Name instanceName, Name connectorName) : _instanceName(instanceName), _connectorName(connectorName) {} -} // namespace + + Net::Connection::Connection(const std::string& instanceName, const std::string& connectorName) + : _instanceName (instanceName) + , _connectorName(connectorName) + { } + + +} // OpenChams namespace. diff --git a/vlsisapd/src/openChams/src/Netlist.cpp b/vlsisapd/src/openChams/src/Netlist.cpp index 99fa19fe..bd48f6ea 100644 --- a/vlsisapd/src/openChams/src/Netlist.cpp +++ b/vlsisapd/src/openChams/src/Netlist.cpp @@ -1,11 +1,19 @@ -/* - * Netlist.cpp - * openChams - * - * Created by damien dupuis on 12/01/10. - * Copyright 2010 UPMC / LIP6. All rights reserved. - * - */ + +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./Netlist.cpp" | +// +-----------------------------------------------------------------+ + #include #include @@ -18,77 +26,93 @@ using namespace std; #include "vlsisapd/openChams/Circuit.h" #include "vlsisapd/openChams/OpenChamsException.h" + namespace OpenChams { -Netlist::Netlist(Circuit* circuit) : _circuit(circuit) {} + + + Netlist::Netlist(Circuit* circuit) + : _circuit(circuit) + { } + -Instance* Netlist::addInstance(Name name, Name model, unsigned order) { + Instance* Netlist::addInstance(const std::string& name, const std::string& model, unsigned order) + { for (vector::iterator it = _instances.begin() ; it != _instances.end() ; ++it) { - if ((*it)->getName() == name) { - string error("[ERROR] Cannot define two instances with the same name in netlist ("); - error += name.getString(); - error += ")."; - throw OpenChamsException(error); - } + if ((*it)->getName() == name) { + string error("[ERROR] Cannot define two instances with the same name in netlist ("); + error += name; + error += ")."; + throw OpenChamsException(error); + } } Instance* inst = new Instance(name, model, order, this); if (!inst) - throw OpenChamsException("[ERROR] Cannot create instance."); + throw OpenChamsException("[ERROR] Cannot create instance."); _instances.push_back(inst); - + return inst; -} + } -Device* Netlist::addDevice(Name name, Name model, unsigned order, Name mosType, bool sourceBulkConnected) { + + Device* Netlist::addDevice(const std::string& name, const std::string& model, unsigned order, const std::string& mosType, bool sourceBulkConnected) + { for (vector::iterator it = _instances.begin() ; it != _instances.end() ; ++it) { - if ((*it)->getName() == name) { - string error("[ERROR] Cannot define two instances with the same name in netlist ("); - error += name.getString(); - error += ")."; - throw OpenChamsException(error); - } + if ((*it)->getName() == name) { + string error("[ERROR] Cannot define two instances with the same name in netlist ("); + error += name; + error += ")."; + throw OpenChamsException(error); + } } Device* dev = new Device(name, model, order, mosType, sourceBulkConnected, this); if (!dev) - throw OpenChamsException("[ERROR] Cannot create device."); + throw OpenChamsException("[ERROR] Cannot create device."); _instances.push_back(dev); return dev; -} + } -Net* Netlist::addNet(Name name, Name type, bool external) { + + Net* Netlist::addNet(const std::string& name, const std::string& type, bool external) + { for (vector::iterator it = _nets.begin() ; it != _nets.end() ; ++it ) { - if ((*it)->getName() == name) { - string error("[ERROR] Cannot define two nets with the same name in netlist ("); - error += name.getString(); - error += ")."; - throw OpenChamsException(error); - } + if ((*it)->getName() == name) { + string error("[ERROR] Cannot define two nets with the same name in netlist ("); + error += name; + error += ")."; + throw OpenChamsException(error); + } } Net* net = new Net(name, type, external, this); if (!net) - throw OpenChamsException("[ERROR] Cannot create net."); + throw OpenChamsException("[ERROR] Cannot create net."); _nets.push_back(net); return net; -} - -Instance* Netlist::getInstance(Name instanceName) { - for (size_t i = 0 ; i < _instances.size() ; ++i) { - if (_instances[i]->getName() == instanceName) { - return _instances[i]; - } - } - return NULL; -} - -Net* Netlist::getNet(Name netName) { - for (size_t i = 0; i < _nets.size(); ++i) { - if (_nets[i]->getName() == netName) { - return _nets[i]; - } - } - return NULL; -} -} // namespace + } + + + Instance* Netlist::getInstance(const std::string& instanceName) + { + for (size_t i = 0 ; i < _instances.size() ; ++i) { + if (_instances[i]->getName() == instanceName) { + return _instances[i]; + } + } + return NULL; + } + + + Net* Netlist::getNet(const std::string& netName) { + for (size_t i = 0; i < _nets.size(); ++i) { + if (_nets[i]->getName() == netName) { + return _nets[i]; + } + } + return NULL; + } + + +} // OpenChams namespace. diff --git a/vlsisapd/src/openChams/src/Node.cpp b/vlsisapd/src/openChams/src/Node.cpp index 4c1e0f5e..1dc76867 100644 --- a/vlsisapd/src/openChams/src/Node.cpp +++ b/vlsisapd/src/openChams/src/Node.cpp @@ -1,34 +1,47 @@ -/* - * Node.cpp - * openChams - * - * Created by damien dupuis on 23/08/11. - * Copyright 2010-2011 UPMC / LIP6. All rights reserved. - * - */ -using namespace std; +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2011-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./Node.cpp" | +// +-----------------------------------------------------------------+ + #include "vlsisapd/openChams/Node.h" +using namespace std; + namespace OpenChams { -Node::Node(Name nodeName, Position pos, Node* parent) - : _name(nodeName) + + + Node::Node(const string& nodeName, Position pos, Node* parent) + : _name (nodeName) , _position(pos) - , _parent(parent) - , _right(NULL) - , _top(NULL) -{} + , _parent (parent) + , _right (NULL) + , _top (NULL) + { } -Bloc::Bloc(Name blocName, Position pos, Node* parent) - : Node(blocName, pos, parent) -{} -Group::Group(Name groupName, Position pos, Node* parent) - : Node(groupName, pos, parent) - , _isolated(false) - , _paired(false) - , _align(Group::NONE) -{} + Bloc::Bloc(const string& blocName, Position pos, Node* parent) + : Node(blocName,pos,parent) + { } -} // namespace + + Group::Group(const string& groupName, Position pos, Node* parent) + : Node(groupName,pos,parent) + , _isolated(false) + , _paired(false) + , _align(Group::NONE) + { } + + +} // OpenChams namespace. diff --git a/vlsisapd/src/openChams/src/Operator.cpp b/vlsisapd/src/openChams/src/Operator.cpp index 9f6579bc..95ee1c3e 100644 --- a/vlsisapd/src/openChams/src/Operator.cpp +++ b/vlsisapd/src/openChams/src/Operator.cpp @@ -1,11 +1,19 @@ -/* - * Operator.cpp - * openChams - * - * Created by damien dupuis on 08/02/10. - * Copyright 2010 UPMC / LIP6. All rights reserved. - * - */ + +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./Operator.cpp" | +// +-----------------------------------------------------------------+ + #include using namespace std; @@ -13,44 +21,56 @@ using namespace std; #include "vlsisapd/openChams/Operator.h" #include "vlsisapd/openChams/OpenChamsException.h" -namespace OpenChams { -Operator::Operator(Name operatorName, Name simulModel) - : _name(operatorName) - , _simulModel(simulModel) {} - -void Operator::addConstraint(Name paramName, Name ref, Name refParam) { - addConstraint(paramName, ref, refParam, 1.0); -} -void Operator::addConstraint(Name paramName, Name ref, Name refParam, double factor) { - map::iterator it = _constraints.find(paramName); +namespace OpenChams { + + + Operator::Operator(const string& operatorName, const string& simulModel) + : _name (operatorName) + , _simulModel(simulModel) + { } + + + void Operator::addConstraint(const string& paramName, const string& ref, const string& refParam) + { addConstraint(paramName, ref, refParam, 1.0); } + + + void Operator::addConstraint(const string& paramName, const string& ref, const string& refParam, double factor) + { + map::iterator it = _constraints.find(paramName); if (it != _constraints.end()) { - string error("[ERROR] Cannot set two constraints for the same parameter ("); - error += paramName.getString(); - error += ")."; - throw OpenChamsException(error); + string error("[ERROR] Cannot set two constraints for the same parameter ("); + error += paramName; + error += ")."; + throw OpenChamsException(error); } _constraints[paramName] = new Operator::Constraint(ref, refParam, factor); -} - -void Operator::addConstraint(Name paramName, Name refEquation) { - addConstraint(paramName, refEquation, 1.0); -} + } -void Operator::addConstraint(Name paramName, Name refEquation, double factor) { - map::iterator it = _constraints.find(paramName); + + void Operator::addConstraint(const string& paramName, const string& refEquation) + { addConstraint(paramName, refEquation, 1.0); } + + + void Operator::addConstraint(const string& paramName, const string& refEquation, double factor) + { + map::iterator it = _constraints.find(paramName); if (it != _constraints.end()) { - string error("[ERROR] Cannot set two constraints for the same parameter ("); - error += paramName.getString(); - error += ")."; - throw OpenChamsException(error); + string error("[ERROR] Cannot set two constraints for the same parameter ("); + error += paramName; + error += ")."; + throw OpenChamsException(error); } - _constraints[paramName] = new Operator::Constraint(Name(""), refEquation, factor); -} - -Operator::Constraint::Constraint(Name ref, Name refParam, double factor) - : _ref(ref) - , _refParam(refParam) - , _factor(factor) {} -} // namespace + _constraints[paramName] = new Operator::Constraint("", refEquation, factor); + } + + + Operator::Constraint::Constraint(const string& ref, const string& refParam, double factor) + : _ref (ref) + , _refParam(refParam) + , _factor (factor) + { } + + +} // OpenChams namespace. diff --git a/vlsisapd/src/openChams/src/Parameters.cpp b/vlsisapd/src/openChams/src/Parameters.cpp index e1a4a105..6ed37012 100644 --- a/vlsisapd/src/openChams/src/Parameters.cpp +++ b/vlsisapd/src/openChams/src/Parameters.cpp @@ -18,19 +18,18 @@ #include using namespace std; -#include "vlsisapd/openChams/Name.h" #include "vlsisapd/openChams/Parameters.h" #include "vlsisapd/openChams/OpenChamsException.h" namespace OpenChams { - void Parameters::addParameter ( Name name, const char* value ) + void Parameters::addParameter ( const string& name, const string& value ) { - map::iterator it = _params.find(name); + map::iterator it = _params.find(name); if ( it != _params.end() ) { string error("[ERROR] Cannot addParameter "); - error += name.getString(); + error += name; error += " because it already exists !"; throw OpenChamsException(error); } @@ -38,12 +37,12 @@ namespace OpenChams { } - const string& Parameters::getValue ( Name name ) + const string& Parameters::getValue ( const string& name ) { - map::iterator it = _params.find(name); + map::iterator it = _params.find(name); if (it == _params.end()) { string error("[ERROR] No parameters named "); - error += name.getString(); + error += name; throw OpenChamsException(error); } return (*it).second; diff --git a/vlsisapd/src/openChams/src/PyOpenChams.cpp b/vlsisapd/src/openChams/src/PyOpenChams.cpp index 66090c6e..04fd1bdd 100644 --- a/vlsisapd/src/openChams/src/PyOpenChams.cpp +++ b/vlsisapd/src/openChams/src/PyOpenChams.cpp @@ -4,7 +4,6 @@ using namespace std; #include using namespace boost::python; -#include "vlsisapd/openChams/Name.h" #include "vlsisapd/openChams/Parameters.h" #include "vlsisapd/openChams/Transistor.h" #include "vlsisapd/openChams/Instance.h" @@ -31,30 +30,15 @@ void translator(OpenChamsException const& e) { } BOOST_PYTHON_MODULE(OPENCHAMS) { - // class OpenChams::Name - class_("Name", init()) - .def(init<>()) - // accessors - .def("getString", &Name::getString, return_value_policy()) // return_value_policy because this method return a refenrce on string - .def("__repr__" , &Name::getString, return_value_policy()) // automatic print for Name object - // operators - .def(self == self) - .def(self == std::string()) - .def(self < self) - ; - - implicitly_convertible(); - // map wrapping for OpenChams::Parameters - STL_MAP_WRAPPING(Name, std::string, "ValuesMap") + STL_MAP_WRAPPING(std::string, std::string, "ValuesMap") // class OpenChams::Parameters class_("Parameters", init<>()) // accessors .def("getValue" , &Parameters::getValue, return_value_policy()) .def("isEmpty" , &Parameters::isEmpty ) // modifiers - .def("addParameter", static_cast(&Parameters::addParameter)) - .def("addParameter", static_cast(&Parameters::addParameter)) + .def("addParameter", static_cast(&Parameters::addParameter)) // stl containers .def("getValues" , &Parameters::getValues , return_value_policy()) ; @@ -84,26 +68,26 @@ BOOST_PYTHON_MODULE(OPENCHAMS) { } // class OpenChams::Transistor - class_("Transistor", init()) + class_("Transistor", init()) // properties - .add_property("name" , &Transistor::getName , &Transistor::setName ) - .add_property("gate" , &Transistor::getGate , &Transistor::setGate ) - .add_property("source" , &Transistor::getSource , &Transistor::setSource) - .add_property("drain" , &Transistor::getDrain , &Transistor::setDrain ) - .add_property("bulk" , &Transistor::getBulk , &Transistor::setBulk ) + .add_property("name" , make_function(&Transistor::getName ,return_value_policy()), &Transistor::setName ) + .add_property("gate" , make_function(&Transistor::getGate ,return_value_policy()), &Transistor::setGate ) + .add_property("source" , make_function(&Transistor::getSource,return_value_policy()), &Transistor::setSource) + .add_property("drain" , make_function(&Transistor::getDrain ,return_value_policy()), &Transistor::setDrain ) + .add_property("bulk" , make_function(&Transistor::getBulk ,return_value_policy()), &Transistor::setBulk ) .add_property("parameters", &Transistor::getParameters ) // no setter => params will be readonly // modifiers - .def("addParameter", static_cast(&Transistor::addParameter)) - .def("addParameter", static_cast(&Transistor::addParameter)) + .def("addParameter", static_cast(&Transistor::addParameter)) + .def("addParameter", static_cast(&Transistor::addParameter)) ; // map wrapping and vector_indexing for OpenChams::Instance - STL_MAP_WRAPPING_PTR(Name, Net*, "ConnectorsMap") + STL_MAP_WRAPPING_PTR(std::string, Net*, "ConnectorsMap") // class OpenChams::Instance - class_("Instance", init()) + class_("Instance", init()) // properties - .add_property("name" , &Instance::getName ) - .add_property("model" , &Instance::getModel ) + .add_property("name" , make_function(&Instance::getName ,return_value_policy())) + .add_property("model" , make_function(&Instance::getModel,return_value_policy())) .add_property("order" , &Instance::getOrder ) .add_property("parameters" , &Instance::getParameters ) .add_property("netlist" , make_function(&Instance::getNetlist ,return_value_policy())) //make_function since we need to specify a return value policy @@ -112,8 +96,8 @@ BOOST_PYTHON_MODULE(OPENCHAMS) { // modifiers .def("addConnector" , &Instance::addConnector ) .def("connect" , &Instance::connect ) - .def("addParameter" , static_cast(&Transistor::addParameter)) - .def("addParameter" , static_cast(&Transistor::addParameter)) + .def("addParameter" , static_cast(&Transistor::addParameter)) + .def("addParameter" , static_cast(&Transistor::addParameter)) // stl containers .def("getConnectors" , &Instance::getConnectors , return_internal_reference<>()) ; @@ -123,9 +107,9 @@ BOOST_PYTHON_MODULE(OPENCHAMS) { .def(vector_indexing_suite, true>()) ; // class OpenChams::Device - class_ >("Device", init()) + class_ >("Device", init()) // properties - .add_property("mosType" , &Device::getMosType ) + .add_property("mosType" , make_function(&Device::getMosType,return_value_policy()) ) .add_property("sourceBulkConnected", &Device::isSourceBulkConnected) // accessors .def("hasNoTransistors", &Device::hasNoTransistors) @@ -136,23 +120,23 @@ BOOST_PYTHON_MODULE(OPENCHAMS) { ; // class OpenChams::Port - class_("Port", init()) + class_("Port", init()) // properties - .add_property("type" , &Port::getType ) + .add_property("type" , make_function(&Port::getType,return_value_policy())) .add_property("index" , &Port::getIndex ) .add_property("x" , &Port::getX ) .add_property("y" , &Port::getY ) - .add_property("orientation", &Port::getOrientation) + .add_property("orientation", make_function(&Port::getOrientation,return_value_policy())) ; // class OpenChams::WirePoint class_("WirePoint", init<>()) ; // class OpenChams::InstancePoint - class_ >("InstancePoint", init()) + class_ >("InstancePoint", init()) // properties - .add_property("name", &InstancePoint::getName) - .add_property("plug", &InstancePoint::getPlug) + .add_property("name", make_function(&InstancePoint::getName, return_value_policy())) + .add_property("plug", make_function(&InstancePoint::getPlug, return_value_policy())) ; // class OpenChams::PortPoint class_ >("PortPoint", init()) @@ -178,9 +162,9 @@ BOOST_PYTHON_MODULE(OPENCHAMS) { // accessors .def("hasNoIntermediatePoints", &Wire::hasNoIntermediatePoints) // modifiers - .def("setStartPoint" , static_cast(&Wire::setStartPoint)) + .def("setStartPoint" , static_cast(&Wire::setStartPoint)) .def("setStartPoint" , static_cast(&Wire::setStartPoint)) - .def("setEndPoint" , static_cast(&Wire::setEndPoint)) + .def("setEndPoint" , static_cast(&Wire::setEndPoint)) .def("setEndPoint" , static_cast(&Wire::setEndPoint)) .def("addIntermediatePoint", &Wire::addIntermediatePoint) // stl containers @@ -199,10 +183,10 @@ BOOST_PYTHON_MODULE(OPENCHAMS) { ; { //this scope is used to define Connection as a subclass of Net // class OpenChams::Net - scope netScope = class_("Net", init()) + scope netScope = class_("Net", init()) // properties - .add_property("name" , &Net::getName ) - .add_property("type" , &Net::getType ) + .add_property("name" , make_function(&Net::getName ,return_value_policy())) + .add_property("type" , make_function(&Net::getType ,return_value_policy())) .add_property("external", &Net::isExternal) .add_property("netlist" , make_function(&Net::getNetlist, return_value_policy())) // accessors @@ -220,9 +204,9 @@ BOOST_PYTHON_MODULE(OPENCHAMS) { ; // class OpenChams::Net::Connection - class_("Connection", init()) - .add_property("instanceName" , &Net::Connection::getInstanceName ) - .add_property("connectorName", &Net::Connection::getConnectorName) + class_("Connection", init()) + .add_property("instanceName" , make_function(&Net::Connection::getInstanceName ,return_value_policy())) + .add_property("connectorName", make_function(&Net::Connection::getConnectorName,return_value_policy())) ; } // end netScope @@ -250,7 +234,7 @@ BOOST_PYTHON_MODULE(OPENCHAMS) { ; // map wrapping for OpenChams::Schematic - STL_MAP_WRAPPING_PTR(Name, Schematic::Infos*, "SchematicInstancesMap") + STL_MAP_WRAPPING_PTR(std::string, Schematic::Infos*, "SchematicInstancesMap") { // this scope is used to define Infos as a subclass of Schematic // class OpenChams::Schematic scope schematicScope = class_("Schematic", init()) @@ -263,43 +247,43 @@ BOOST_PYTHON_MODULE(OPENCHAMS) { ; // class OpenChams::Schematic::Infos - class_("Infos", init()) + class_("Infos", init()) .add_property("x" , &Schematic::Infos::getX ) .add_property("y" , &Schematic::Infos::getY ) - .add_property("orientation", &Schematic::Infos::getOrientation) + .add_property("orientation", make_function(&Schematic::Infos::getOrientation,return_value_policy())) ; } // end schematicScope // map wrapping for OpenChams::Operator - STL_MAP_WRAPPING_PTR(Name, Operator::Constraint*, "ConstraintsMap") + STL_MAP_WRAPPING_PTR(std::string, Operator::Constraint*, "ConstraintsMap") { // this scope is used to define Constraint as a subclass of Operator // class OpenChams::Operator - scope operatorScope = class_("Operator", init()) + scope operatorScope = class_("Operator", init()) // properties - .add_property("name" , &Operator::getName ) - .add_property("simulModel", &Operator::getSimulModel) + .add_property("name" , make_function(&Operator::getName , return_value_policy())) + .add_property("simulModel", make_function(&Operator::getSimulModel, return_value_policy())) // accessors .def("hasNoConstraints", &Operator::hasNoConstraints) // modifiers - .def("addConstraint", static_cast(&Operator::addConstraint)) - .def("addConstraint", static_cast(&Operator::addConstraint)) - .def("addConstraint", static_cast(&Operator::addConstraint)) - .def("addConstraint", static_cast(&Operator::addConstraint)) + .def("addConstraint", static_cast(&Operator::addConstraint)) + .def("addConstraint", static_cast(&Operator::addConstraint)) + .def("addConstraint", static_cast(&Operator::addConstraint)) + .def("addConstraint", static_cast(&Operator::addConstraint)) // stl containers .def("getConstraints", &Operator::getConstraints, return_internal_reference<>()) ; // class OpenChams::Operator::Constraint - class_("Constraint", init()) - .add_property("ref" , &Operator::Constraint::getRef ) - .add_property("refParam", &Operator::Constraint::getRefParam) + class_("Constraint", init()) + .add_property("ref" , make_function(&Operator::Constraint::getRef , return_value_policy())) + .add_property("refParam", make_function(&Operator::Constraint::getRefParam, return_value_policy())) .add_property("factor" , &Operator::Constraint::getFactor ) ; } // end operatorScope /* // map wrapping for OpenChams::Sizing - STL_MAP_WRAPPING_PTR(Name, Operator*, "OperatorsMap") + STL_MAP_WRAPPING_PTR(std::string, Operator*, "OperatorsMap") // class OpenChams::Sizing class_("Sizing", init()) // accessors @@ -315,7 +299,7 @@ BOOST_PYTHON_MODULE(OPENCHAMS) { */ // map wrapping for OpenChams::Layout - STL_MAP_WRAPPING(Name, Name, "LayoutInstancesMap") + STL_MAP_WRAPPING(std::string, std::string, "LayoutInstancesMap") // class OpenChams::Layout class_("Layout", init()) // properties @@ -328,10 +312,10 @@ BOOST_PYTHON_MODULE(OPENCHAMS) { .def("getInstances", &Layout::getInstances, return_internal_reference<>()) ; - class_("Circuit", init()) + class_("Circuit", init()) // properties - .add_property("name" , &Circuit::getName ) - .add_property("techno" , &Circuit::getTechno ) + .add_property("name" , make_function(&Circuit::getName ,return_value_policy())) + .add_property("techno" , make_function(&Circuit::getTechno ,return_value_policy())) .add_property("parameters" , &Circuit::getParameters ) .add_property("netlist" , make_function(&Circuit::getNetlist , return_value_policy())) .add_property("schematic" , make_function(&Circuit::getSchematic, return_value_policy())) @@ -344,8 +328,8 @@ BOOST_PYTHON_MODULE(OPENCHAMS) { .def("createSchematic", &Circuit::createSchematic, return_value_policy()) .def("createSizing" , &Circuit::createSizing , return_value_policy()) .def("createLayout" , &Circuit::createLayout , return_value_policy()) - .def("addParameter", static_cast(&Circuit::addParameter)) - .def("addParameter", static_cast(&Circuit::addParameter)) + .def("addParameter", static_cast(&Circuit::addParameter)) + .def("addParameter", static_cast(&Circuit::addParameter)) // others .def("readFromFile", &Circuit::readFromFile, return_value_policy()) .staticmethod("readFromFile") @@ -359,7 +343,7 @@ BOOST_PYTHON_MODULE(OPENCHAMS) { .add_property("top" , make_function(&Node::getTop , return_value_policy()), &Node::setTop ) .add_property("right", make_function(&Node::getRight, return_value_policy()), &Node::setRight) // accessors - .def("getName" , &Node::getName ) + .def("getName" , &Node::getName , return_value_policy()) .def("getPosition", &Node::getPosition) .def("getParent" , &Node::getParent , return_value_policy()) .def("isRoot" , &Node::isRoot ) @@ -374,12 +358,12 @@ BOOST_PYTHON_MODULE(OPENCHAMS) { } // end of node scope // class OpenChams::Bloc - class_ >("Bloc", init >()) + class_ >("Bloc", init >()) ; { // this scope is used to define Align as a subenum of Group // class OpenChams::Group - scope grou = class_ >("Group", init >()) + scope grou = class_ >("Group", init >()) .add_property("rootNode", make_function(&Group::getRootNode, return_value_policy()), &Group::setRootNode) .add_property("isolated", &Group::isIsolated, &Group::setIsolated) .add_property("paired" , &Group::isPaired , &Group::setPaired ) diff --git a/vlsisapd/src/openChams/src/Schematic.cpp b/vlsisapd/src/openChams/src/Schematic.cpp index a042bb25..63ddb6c2 100644 --- a/vlsisapd/src/openChams/src/Schematic.cpp +++ b/vlsisapd/src/openChams/src/Schematic.cpp @@ -1,33 +1,52 @@ -/* - * SchematicInfos.cpp - * openChams - * - * Created by damien dupuis on 22/01/10. - * Copyright 2010 UPMC / LIP6. All rights reserved. - * - */ -using namespace std; +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./Schematic.cpp" | +// +-----------------------------------------------------------------+ + #include "vlsisapd/openChams/Schematic.h" #include "vlsisapd/openChams/OpenChamsException.h" +using namespace std; namespace OpenChams { -Schematic::Schematic(Circuit* circuit): _circuit(circuit) {} + + + Schematic::Schematic (Circuit* circuit ) + : _circuit(circuit) + { } + -void Schematic::addInstance(Name instanceName, double x, double y, Name orient) { - map::iterator it = _instances.find(instanceName); + void Schematic::addInstance ( const string& instanceName + , double x + , double y + , const string& orient ) + { + map::iterator it = _instances.find(instanceName); if (it != _instances.end()) { - string error("[ERROR] Cannot set same instance twice in 'schematic' ("); - error += instanceName.getString(); - error += ")."; - throw OpenChamsException(error); + string error("[ERROR] Cannot set same instance twice in 'schematic' ("); + error += instanceName; + error += ")."; + throw OpenChamsException(error); } _instances[instanceName] = new Schematic::Infos(x, y, orient); -} + } -Schematic::Infos::Infos(double x, double y, Name orient) - : _x(x) - , _y(y) - , _orient(orient) {} -} // namespace + Schematic::Infos::Infos(double x, double y, const string& orient) + : _x (x) + , _y (y) + , _orient(orient) + {} + + +} // OpenChams namespace. diff --git a/vlsisapd/src/openChams/src/Sizing.cpp b/vlsisapd/src/openChams/src/Sizing.cpp index 2bf6b0d6..508fde89 100644 --- a/vlsisapd/src/openChams/src/Sizing.cpp +++ b/vlsisapd/src/openChams/src/Sizing.cpp @@ -1,47 +1,66 @@ -/* - * Sizing.cpp - * openChams - * - * Created by damien dupuis on 08/02/10. - * Copyright 2010 UPMC / LIP6. All rights reserved. - * - */ -#include -using namespace std; +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./Sizing.cpp" | +// +-----------------------------------------------------------------+ + + #include "vlsisapd/openChams/Sizing.h" #include "vlsisapd/openChams/Circuit.h" #include "vlsisapd/openChams/Operator.h" #include "vlsisapd/openChams/Equation.h" #include "vlsisapd/openChams/OpenChamsException.h" +using namespace std; + namespace OpenChams { -Sizing::Sizing(Circuit* circuit): _circuit(circuit) {} + + + Sizing::Sizing ( Circuit* circuit ) + : _circuit(circuit) + { } -Operator* Sizing::addOperator(Name instanceName, Name operatorName, Name simulModel) { - map::iterator it = _operators.find(instanceName); + + Operator* Sizing::addOperator ( const string& instanceName + , const string& operatorName + , const string& simulModel ) + { + map::iterator it = _operators.find(instanceName); if (it != _operators.end()) { - string error("[ERROR] Cannot set same instance twice in 'sizing' ("); - error += instanceName.getString(); - error += ")."; - throw OpenChamsException(error); + string error("[ERROR] Cannot set same instance twice in 'sizing' ("); + error += instanceName; + error += ")."; + throw OpenChamsException(error); } Operator* op = new Operator(operatorName, simulModel); _operators[instanceName] = op; return op; -} + } -void Sizing::addEquation(Name equationName, Equation* equation) { - map::iterator it = _equations.find(equationName); + + void Sizing::addEquation ( const string& equationName, Equation* equation) + { + map::iterator it = _equations.find(equationName); if (it != _equations.end()) { - string error("[ERROR] Cannot set several equations with the same name in 'sizing' ("); - error += equationName.getString(); - error += ")."; - throw OpenChamsException(error); + string error("[ERROR] Cannot set several equations with the same name in 'sizing' ("); + error += equationName; + error += ")."; + throw OpenChamsException(error); } _equations[equationName] = equation; -} + } -} // namespace + +} // OpenChams namespace diff --git a/vlsisapd/src/openChams/src/Transistor.cpp b/vlsisapd/src/openChams/src/Transistor.cpp index a439334e..beb78276 100644 --- a/vlsisapd/src/openChams/src/Transistor.cpp +++ b/vlsisapd/src/openChams/src/Transistor.cpp @@ -1,11 +1,19 @@ -/* - * Transistor.cpp - * openChams - * - * Created by damien dupuis on 01/03/10. - * Copyright 2010 UPMC / LIP6. All rights reserved. - * - */ + +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./Transistor.cpp" | +// +-----------------------------------------------------------------+ + #include using namespace std; @@ -15,47 +23,49 @@ using namespace std; #include "vlsisapd/openChams/Net.h" #include "vlsisapd/openChams/OpenChamsException.h" + namespace OpenChams { - Transistor::Transistor(Name name, Instance* instance) - : _name(name) - , _gate("") - , _source("") - , _drain("") - , _bulk("") - , _instance(instance) {} - - void Transistor::setGate(Name gate) { - if (checkConnector(gate)) - _gate = gate; - } - - void Transistor::setSource(Name source) { - if (checkConnector(source)) - _source = source; - } - void Transistor::setDrain(Name drain) { - if (checkConnector(drain)) - _drain = drain; - } + + Transistor::Transistor(const std::string& name, Instance* instance) + : _name (name) + , _gate ("") + , _source ("") + , _drain ("") + , _bulk ("") + , _instance(instance) + { } + + + void Transistor::setGate(const std::string& gate) + { if (checkConnector(gate)) _gate = gate; } + + + void Transistor::setSource(const std::string& source) + { if (checkConnector(source)) _source = source; } + + void Transistor::setDrain(const std::string& drain) + { if (checkConnector(drain)) _drain = drain; } + - void Transistor::setBulk(Name bulk) { - if (checkConnector(bulk)) - _bulk = bulk; - } - bool Transistor::checkConnector(Name name) { - map::const_iterator it = _instance->getConnectors().find(name); - if (it != _instance->getConnectors().end()) {// si le connecteur existe bien - return true; - } else { - string error("[ERROR] Instance "); - error += _instance->getName().getString(); - error += " has no connector named "; - error += name.getString(); - error += "."; - throw OpenChamsException(error); - } - } -} + void Transistor::setBulk(const std::string& bulk) + { if (checkConnector(bulk)) _bulk = bulk; } + bool Transistor::checkConnector(const std::string& name) + { + map::const_iterator it = _instance->getConnectors().find(name); + if (it != _instance->getConnectors().end()) {// si le connecteur existe bien + return true; + } else { + string error("[ERROR] Instance "); + error += _instance->getName(); + error += " has no connector named "; + error += name; + error += "."; + throw OpenChamsException(error); + } + } + + +} // OpenChams namespace. diff --git a/vlsisapd/src/openChams/src/Wire.cpp b/vlsisapd/src/openChams/src/Wire.cpp index e79c320a..591e9914 100644 --- a/vlsisapd/src/openChams/src/Wire.cpp +++ b/vlsisapd/src/openChams/src/Wire.cpp @@ -1,57 +1,76 @@ -/* - * Wire.cpp - * openChams - * - * Created by damien dupuis on 08/02/11. - * Copyright 2011 UPMC / LIP6. All rights reserved. - * - */ -using namespace std; +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2011-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Module : "./Wire.cpp" | +// +-----------------------------------------------------------------+ + #include "vlsisapd/openChams/Wire.h" #include "vlsisapd/openChams/OpenChamsException.h" +using namespace std; namespace OpenChams { -void Wire::setStartPoint(Name name, Name plug) { - if (_start) - throw OpenChamsException("[ERROR] Wire::setStartPoint: cannot set start point since it has already been set."); + + void Wire::setStartPoint(const string& name, const string& plug) + { + if (_start) + throw OpenChamsException("[ERROR] Wire::setStartPoint: cannot set start point since it has already been set."); + _start = new InstancePoint(name, plug); -} + } -void Wire::setStartPoint(unsigned idx) { + + void Wire::setStartPoint(unsigned idx) + { if (_start) - throw OpenChamsException("[ERROR] Wire::setStartPoint: cannot set start point since it has already been set."); + throw OpenChamsException("[ERROR] Wire::setStartPoint: cannot set start point since it has already been set."); _start = new PortPoint(idx); -} + } -void Wire::setEndPoint(Name name, Name plug) { + + void Wire::setEndPoint(const string& name, const string& plug) + { if (!_start) - throw OpenChamsException("[ERROR] Wire::setEndPoint: cannot set end point since start point has not been set."); + throw OpenChamsException("[ERROR] Wire::setEndPoint: cannot set end point since start point has not been set."); if (_end) - throw OpenChamsException("[ERROR] Wire::setEndPoint: cannot set end point since it has already been set."); + throw OpenChamsException("[ERROR] Wire::setEndPoint: cannot set end point since it has already been set."); _end = new InstancePoint(name, plug); -} + } -void Wire::setEndPoint(unsigned idx) { + + void Wire::setEndPoint(unsigned idx) + { if (!_start) - throw OpenChamsException("[ERROR] Wire::setEndPoint: cannot set end point since start point has not been set."); + throw OpenChamsException("[ERROR] Wire::setEndPoint: cannot set end point since start point has not been set."); if (_end) - throw OpenChamsException("[ERROR] Wire::setEndPoint: cannot set end point since it has already been set."); + throw OpenChamsException("[ERROR] Wire::setEndPoint: cannot set end point since it has already been set."); _end = new PortPoint(idx); -} + } -void Wire::addIntermediatePoint(double x, double y) { + + void Wire::addIntermediatePoint(double x, double y) + { if (!_start) - throw OpenChamsException("[ERROR] Wire::addIntermediatePoint: cannot add point since start point has not been set."); + throw OpenChamsException("[ERROR] Wire::addIntermediatePoint: cannot add point since start point has not been set."); if (_end) - throw OpenChamsException("[ERROR] Wire::addIntermediatePoint: cannot add point since end point has already been set."); - + throw OpenChamsException("[ERROR] Wire::addIntermediatePoint: cannot add point since end point has already been set."); + _inters.push_back(new IntermediatePoint(x, y)); -} -} // namespace + } + +} // OpenChams namespace. diff --git a/vlsisapd/src/openChams/src/vlsisapd/openChams/Circuit.h b/vlsisapd/src/openChams/src/vlsisapd/openChams/Circuit.h index efa45e48..7b9d9c3b 100644 --- a/vlsisapd/src/openChams/src/vlsisapd/openChams/Circuit.h +++ b/vlsisapd/src/openChams/src/vlsisapd/openChams/Circuit.h @@ -25,7 +25,6 @@ #include #include -#include "vlsisapd/openChams/Name.h" #include "vlsisapd/openChams/Parameters.h" #include "vlsisapd/openChams/SimulModel.h" @@ -45,17 +44,17 @@ namespace OpenChams { class Circuit { public: - Circuit ( Name, Name techno ); + Circuit ( const std::string&, const std::string& techno ); // Accessors. - inline Name getName (); - inline Name getTechno (); - inline const std::string& getValue ( Name ); + inline const std::string& getName (); + inline const std::string& getTechno (); + inline const std::string& getValue ( const std::string& ); inline Netlist* getNetlist (); inline Schematic* getSchematic (); inline Sizing* getSizing (); inline Layout* getLayout (); - inline void addParameter ( Name, const char* ); - inline void addParameter ( Name, const std::string& ); + inline void addParameter ( const std::string&, const char* ); + inline void addParameter ( const std::string&, const std::string& ); inline Parameters getParameters (); inline void addSubCircuitPath ( std::string ); inline std::vector& getSubCircuitPaths (); @@ -76,9 +75,9 @@ namespace OpenChams { private: // Internal methods (XML parser). - Name readParameter ( xmlNode*, const xmlChar*& ); - Name readParameterEq ( xmlNode*, std::string& ); - Name readConnector ( xmlNode* ); + std::string readParameter ( xmlNode*, const xmlChar*& ); + std::string readParameterEq ( xmlNode*, std::string& ); + std::string readConnector ( xmlNode* ); void readSubCircuitsPaths ( xmlNode* ); void readCircuitParameters ( xmlNode* ); void readSimulModels ( xmlNode* ); @@ -118,9 +117,9 @@ namespace OpenChams { void check_lowercase ( std::string& str, std::vector& compares, std::string message ); private: - Name _name; + const std::string& _name; std::string _absolutePath; - Name _techno; + const std::string& _techno; Parameters _params; Netlist* _netlist; Schematic* _schematic; @@ -131,15 +130,15 @@ namespace OpenChams { }; - inline Name Circuit::getName () { return _name; } - inline Name Circuit::getTechno () { return _techno; } - inline const std::string& Circuit::getValue (Name name) { return _params.getValue(name); } + inline const std::string& Circuit::getName () { return _name; } + inline const std::string& Circuit::getTechno () { return _techno; } + inline const std::string& Circuit::getValue (const std::string& name) { return _params.getValue(name); } inline Netlist* Circuit::getNetlist () { return _netlist; } inline Schematic* Circuit::getSchematic () { return _schematic; } inline Sizing* Circuit::getSizing () { return _sizing; } inline Layout* Circuit::getLayout () { return _layout; } - inline void Circuit::addParameter (Name name, const char* value) { _params.addParameter(name, value); } - inline void Circuit::addParameter (Name name, const std::string& value) { _params.addParameter(name, value); } + inline void Circuit::addParameter (const std::string& name, const char* value) { _params.addParameter(name, value); } + inline void Circuit::addParameter (const std::string& name, const std::string& value) { _params.addParameter(name, value); } inline Parameters Circuit::getParameters () { return _params; } inline void Circuit::addSubCircuitPath (std::string path) { _subCircuitsPaths.push_back(path); } inline std::vector& Circuit::getSubCircuitPaths () { return _subCircuitsPaths; } diff --git a/vlsisapd/src/openChams/src/vlsisapd/openChams/Device.h b/vlsisapd/src/openChams/src/vlsisapd/openChams/Device.h index 37604c06..1db4cd13 100644 --- a/vlsisapd/src/openChams/src/vlsisapd/openChams/Device.h +++ b/vlsisapd/src/openChams/src/vlsisapd/openChams/Device.h @@ -1,11 +1,19 @@ -/* - * Device.h - * openChams - * - * Created by damien dupuis on 22/11/10. - * Copyright 2010 UPMC / LIP6. All rights reserved. - * - */ + +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./vlsisapd/openChams/Instance.h" | +// +-----------------------------------------------------------------+ + #ifndef __OPENCHAMS_DEVICE_H__ #define __OPENCHAMS_DEVICE_H__ @@ -13,37 +21,43 @@ #include #include -#include "vlsisapd/openChams/Name.h" #include "vlsisapd/openChams/Instance.h" #include "vlsisapd/openChams/Parameters.h" + namespace OpenChams { -class Netlist; -class Transistor; -class Device : public Instance { + + class Netlist; + class Transistor; + + + class Device : public Instance { public: - Device(Name name, Name model, unsigned, Name mosType, bool, Netlist*); - - virtual ~Device() {}; - - inline Name getMosType(); - inline bool isSourceBulkConnected(); - // pour parcourir les transistors - inline bool hasNoTransistors(); - inline const std::vector& getTransistors(); - - Transistor* addTransistor(Name); + Device ( const std::string& name + , const std::string& model + , unsigned order + , const std::string& mosType + , bool sourceBulkConnected + , Netlist* ); + virtual ~Device (); + inline const std::string& getMosType (); + inline bool isSourceBulkConnected (); + // Pour parcourir les transistors + inline bool hasNoTransistors (); + inline const std::vector& getTransistors (); + Transistor* addTransistor (const std::string&); private: - Name _mosType; - bool _sourceBulkConnected; - std::vector _trans; -}; + const std::string _mosType; + bool _sourceBulkConnected; + std::vector _trans; + }; -inline Name Device::getMosType() { return _mosType; }; -inline bool Device::isSourceBulkConnected() { return _sourceBulkConnected; }; -inline bool Device::hasNoTransistors() { return (_trans.size() == 0)? true : false; }; -inline const std::vector& Device::getTransistors() { return _trans; }; + + inline const std::string& Device::getMosType () { return _mosType; }; + inline bool Device::isSourceBulkConnected() { return _sourceBulkConnected; }; + inline bool Device::hasNoTransistors () { return (_trans.size() == 0)? true : false; }; + inline const std::vector& Device::getTransistors () { return _trans; }; } // namespace #endif diff --git a/vlsisapd/src/openChams/src/vlsisapd/openChams/Instance.h b/vlsisapd/src/openChams/src/vlsisapd/openChams/Instance.h index ca540b68..7141681f 100644 --- a/vlsisapd/src/openChams/src/vlsisapd/openChams/Instance.h +++ b/vlsisapd/src/openChams/src/vlsisapd/openChams/Instance.h @@ -22,7 +22,6 @@ #include #include -#include "vlsisapd/openChams/Name.h" #include "vlsisapd/openChams/Parameters.h" @@ -33,41 +32,42 @@ namespace OpenChams { class Instance { public: - Instance (Name name, Name model, unsigned, Netlist*); + Instance (const std::string& name, const std::string& model, unsigned, Netlist*); virtual ~Instance (); - void addConnector (Name); - void connect (Name connectorName, Name netName); + void addConnector (const std::string&); + void connect (const std::string& connectorName, const std::string& netName); - inline void addParameter (Name, const char* ); - inline void addParameter (Name, const std::string& ); - inline Name getName () const; - inline Name getModel (); + inline void addParameter (const std::string&, const char* ); + inline void addParameter (const std::string&, const std::string& ); + inline const std::string& getName () const; + inline const std::string& getModel () const; inline unsigned getOrder (); inline Netlist* getNetlist (); inline Parameters getParameters (); inline bool hasNoConnectors (); - inline const std::map& getConnectors (); + inline const std::map& + getConnectors (); private: - Name _name; - Name _model; - unsigned _order; - Netlist* _netlist; - Parameters _params; - std::map _netMap; + std::string _name; + std::string _model; + unsigned _order; + Netlist* _netlist; + Parameters _params; + std::map _netMap; }; - inline void Instance::addParameter (Name name, const char* value) { _params.addParameter(name,value); }; - inline void Instance::addParameter (Name name, const std::string& value) { _params.addParameter(name,value); }; - inline Name Instance::getName () const { return _name; }; - inline Name Instance::getModel () { return _model; }; - inline unsigned Instance::getOrder () { return _order; }; - inline Netlist* Instance::getNetlist () { return _netlist; }; - inline Parameters Instance::getParameters () { return _params; }; - inline bool Instance::hasNoConnectors () { return _netMap.empty(); }; - inline const std::map& Instance::getConnectors () { return _netMap; }; + inline void Instance::addParameter (const std::string& name, const char* value) { _params.addParameter(name,value); }; + inline void Instance::addParameter (const std::string& name, const std::string& value) { _params.addParameter(name,value); }; + inline const std::string& Instance::getName () const { return _name; }; + inline const std::string& Instance::getModel () const { return _model; }; + inline unsigned Instance::getOrder () { return _order; }; + inline Netlist* Instance::getNetlist () { return _netlist; }; + inline Parameters Instance::getParameters () { return _params; }; + inline bool Instance::hasNoConnectors () { return _netMap.empty(); }; + inline const std::map& Instance::getConnectors () { return _netMap; }; } // OpenChams namespace. diff --git a/vlsisapd/src/openChams/src/vlsisapd/openChams/Layout.h b/vlsisapd/src/openChams/src/vlsisapd/openChams/Layout.h index e4602e0a..501d1859 100644 --- a/vlsisapd/src/openChams/src/vlsisapd/openChams/Layout.h +++ b/vlsisapd/src/openChams/src/vlsisapd/openChams/Layout.h @@ -1,46 +1,55 @@ -/* - * Layout.h - * openChams - * - * Created by damien dupuis on 31/08/10. - * Copyright 2008-2010 UPMC / LIP6. All rights reserved. - * - */ + +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./vlsisapd/openChams/Layout.h" | +// +-----------------------------------------------------------------+ + #ifndef __OPENCHAMS_LAYOUT_H__ #define __OPENCHAMS_LAYOUT_H__ #include +#include + namespace OpenChams { -class Name; -class Circuit; -class Node; -class Layout { + class Circuit; + class Node; + + + class Layout { public: - Layout(Circuit*); - - void addInstance(Name name, Name style); - - inline bool hasNoInstance(); - inline const std::map& getInstances(); - - inline Node* getHBTreeRoot(); - inline void setHBTreeRoot(Node*); - + Layout (Circuit*); + void addInstance (const std::string& name, const std::string& style); + inline bool hasNoInstance (); + inline Node* getHBTreeRoot (); + inline void setHBTreeRoot (Node*); + inline const std::map& getInstances(); private: - Circuit* _circuit; - Node* _hbTreeRoot; - std::map _instances; // device name <-> style (name) -}; + Circuit* _circuit; + Node* _hbTreeRoot; + std::map _instances; // device name <-> style (name) + }; -inline bool Layout::hasNoInstance() { return (_instances.size() == 0) ? true : false; }; -inline const std::map& Layout::getInstances() { return _instances; }; -inline Node* Layout::getHBTreeRoot() { return _hbTreeRoot; } -inline void Layout::setHBTreeRoot(Node* root) { _hbTreeRoot = root; } + inline bool Layout::hasNoInstance () { return _instances.empty(); }; + inline Node* Layout::getHBTreeRoot () { return _hbTreeRoot; } + inline void Layout::setHBTreeRoot (Node* root) { _hbTreeRoot = root; } + inline const std::map& Layout::getInstances() { return _instances; } + } // namespace + #endif diff --git a/vlsisapd/src/openChams/src/vlsisapd/openChams/Name.h b/vlsisapd/src/openChams/src/vlsisapd/openChams/Name.h deleted file mode 100644 index e2874269..00000000 --- a/vlsisapd/src/openChams/src/vlsisapd/openChams/Name.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Name.h - * openChams - * - * Created by damien dupuis on 18/12/09. - * Copyright 2009 UPMC / LIP6. All rights reserved. - * - */ - -#ifndef __OPENCHAMS_NAME_H__ -#define __OPENCHAMS_NAME_H__ - -#include -#include - -#include "vlsisapd/openChams/OpenChamsException.h" - -namespace OpenChams { -class Name { - public: - Name(); - Name(std::string); - Name(const char*); - - bool operator==(const Name&) const; - bool operator==(const std::string&) const; - bool operator<(const Name&) const; - - inline const std::string& getString() const; - - private: - unsigned long _id; - const std::string *_str; - - static std::map _dict; - static unsigned long _globalId; -}; - -inline const std::string& Name::getString() const{ - if (!_str) { - throw OpenChamsException("[ERROR] Name object has no string"); - } - return *_str; -} - -} // namespace -#endif - diff --git a/vlsisapd/src/openChams/src/vlsisapd/openChams/Net.h b/vlsisapd/src/openChams/src/vlsisapd/openChams/Net.h index 9e38514c..1d1125c5 100644 --- a/vlsisapd/src/openChams/src/vlsisapd/openChams/Net.h +++ b/vlsisapd/src/openChams/src/vlsisapd/openChams/Net.h @@ -1,85 +1,88 @@ -/* - * Net.h - * openChams - * - * Created by damien dupuis on 12/01/10. - * Copyright 2010 UPMC / LIP6. All rights reserved. - * - */ + +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./vlsisapd/openChams/Net.h" | +// +-----------------------------------------------------------------+ + #ifndef __OPENCHAMS_NET_H__ #define __OPENCHAMS_NET_H__ #include +#include -#include "vlsisapd/openChams/Name.h" namespace OpenChams { -class Netlist; -class Port; -class Wire; -class Net { + + class Netlist; + class Port; + class Wire; + + class Net { public: - class Connection { + class Connection { public: - Connection(Name instanceName, Name connectorName); - - inline Name getInstanceName() const; - inline Name getConnectorName() const; - + Connection (const std::string& instanceName, const std::string& connectorName); + inline const std::string& getInstanceName () const; + inline const std::string& getConnectorName() const; private: - Name _instanceName; - Name _connectorName; - }; + const std::string& _instanceName; + const std::string& _connectorName; + }; public: - Net(Name netName, Name typeName, bool, Netlist*); - - void connectTo(Name instanceName, Name connectorName); - - inline Name getName() const; - inline Name getType(); - inline bool isExternal(); - inline Netlist* getNetlist(); - inline bool hasNoConnections(); - //inline vector >::iterator getFirstConnectionIt(); - //inline vector >::iterator getLastConnectionIt(); - inline const std::vector& getConnections(); - + Net (const std::string& netName, const std::string& typeName, bool, Netlist*); + void connectTo (const std::string& instanceName, const std::string& connectorName); + inline const std::string& getName () const; + inline const std::string& getType (); + inline bool isExternal (); + inline Netlist* getNetlist (); + inline bool hasNoConnections (); + inline const std::vector& getConnections(); // schematic relative methods - Port* addPort(Name type, unsigned idx, double x, double y, Name orient); - Wire* addWire(); - inline bool hasNoPorts(); - inline const std::vector& getPorts(); - inline bool hasNoWires(); - inline const std::vector& getWires(); + Port* addPort (const std::string& type, unsigned idx, double x, double y, const std::string& orient); + Wire* addWire (); + inline bool hasNoPorts (); + inline const std::vector& getPorts (); + inline bool hasNoWires (); + inline const std::vector& getWires (); private: - Name _name; - Name _typeName; - bool _isExternal; - Netlist* _netlist; - std::vector _connections; // - // schematic relative members - std::vector _ports; - std::vector _wires; -}; - -inline Name Net::getName() const { return _name; } -inline Name Net::getType() { return _typeName; } -inline bool Net::isExternal() { return _isExternal; } -inline Netlist* Net::getNetlist() { return _netlist; } -inline bool Net::hasNoConnections() { return (_connections.size() == 0)? true : false; } -//inline vector >::iterator Net::getFirstConnectionIt() { return _connections.begin();}; -//inline vector >::iterator Net::getLastConnectionIt() { return _connections.end();}; -inline const std::vector& Net::getConnections() { return _connections; } -inline bool Net::hasNoPorts() { return (_ports.size() == 0)? true : false; } -inline const std::vector& Net::getPorts() { return _ports; } -inline bool Net::hasNoWires() { return (_wires.size() == 0)? true : false; } -inline const std::vector& Net::getWires() { return _wires; } + const std::string& _name; + const std::string& _typeName; + bool _isExternal; + Netlist* _netlist; + std::vector _connections; // + // schematic relative members + std::vector _ports; + std::vector _wires; + }; -inline Name Net::Connection::getInstanceName() const { return _instanceName; }; -inline Name Net::Connection::getConnectorName() const { return _connectorName; }; + +inline const std::string& Net::getName () const { return _name; } +inline const std::string& Net::getType () { return _typeName; } +inline bool Net::isExternal () { return _isExternal; } +inline Netlist* Net::getNetlist () { return _netlist; } +inline bool Net::hasNoConnections() { return (_connections.size() == 0)? true : false; } +inline const std::vector& Net::getConnections() { return _connections; } +inline bool Net::hasNoPorts () { return (_ports.size() == 0)? true : false; } +inline const std::vector& Net::getPorts () { return _ports; } +inline bool Net::hasNoWires () { return (_wires.size() == 0)? true : false; } +inline const std::vector& Net::getWires () { return _wires; } + + +inline const std::string& Net::Connection::getInstanceName () const { return _instanceName; }; +inline const std::string& Net::Connection::getConnectorName() const { return _connectorName; }; } // namespace #endif diff --git a/vlsisapd/src/openChams/src/vlsisapd/openChams/Netlist.h b/vlsisapd/src/openChams/src/vlsisapd/openChams/Netlist.h index b37cfaad..5b180b88 100644 --- a/vlsisapd/src/openChams/src/vlsisapd/openChams/Netlist.h +++ b/vlsisapd/src/openChams/src/vlsisapd/openChams/Netlist.h @@ -1,11 +1,19 @@ -/* - * NetList.h - * openChams - * - * Created by damien dupuis on 12/01/10. - * Copyright 2010 UPMC / LIP6. All rights reserved. - * - */ + +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./vlsisapd/openChams/Netlist.h" | +// +-----------------------------------------------------------------+ + #ifndef __OPENCHAMS_NETLIST_H__ #define __OPENCHAMS_NETLIST_H__ @@ -13,41 +21,41 @@ #include namespace OpenChams { -class Name; -class Instance; -class Device; -class Net; -class Circuit; -class Netlist { + class Instance; + class Device; + class Net; + class Circuit; + + + class Netlist { public: - Netlist(Circuit*); - - Instance* addInstance(Name name, Name model, unsigned); - Device* addDevice (Name name, Name model, unsigned, Name mosType, bool); - Net* addNet (Name name, Name type , bool); - - Instance* getInstance(Name); - Net* getNet(Name); - - inline bool hasNoInstances(); - inline bool hasNoNets(); - inline const std::vector& getInstances(); - inline const std::vector& getNets(); - inline Circuit* getCircuit(); - + Netlist (Circuit*); + Instance* addInstance (const std::string& name, const std::string& model, unsigned); + Device* addDevice (const std::string& name, const std::string& model, unsigned, const std::string& mosType, bool); + Net* addNet (const std::string& name, const std::string& type , bool); + Instance* getInstance (const std::string&); + Net* getNet (const std::string&); + inline bool hasNoInstances (); + inline bool hasNoNets (); + inline const std::vector& getInstances (); + inline const std::vector& getNets (); + inline Circuit* getCircuit (); private: - Circuit* _circuit; - std::vector _instances; - std::vector _nets; -}; - -inline bool Netlist::hasNoInstances() { return (_instances.size() == 0)? true : false; } -inline bool Netlist::hasNoNets() { return (_nets.size() == 0)? true : false; } -inline const std::vector& Netlist::getInstances() { return _instances; } -inline const std::vector& Netlist::getNets() { return _nets; } -inline Circuit* Netlist::getCircuit() { return _circuit; } - -} // namespace + Circuit* _circuit; + std::vector _instances; + std::vector _nets; + }; + + + inline bool Netlist::hasNoInstances() { return _instances.empty(); } + inline bool Netlist::hasNoNets () { return _nets.empty(); } + inline const std::vector& Netlist::getInstances () { return _instances; } + inline const std::vector& Netlist::getNets () { return _nets; } + inline Circuit* Netlist::getCircuit () { return _circuit; } + + +} // OpenChams namespace. + #endif diff --git a/vlsisapd/src/openChams/src/vlsisapd/openChams/Node.h b/vlsisapd/src/openChams/src/vlsisapd/openChams/Node.h index bbedcc61..5d0e8bd9 100644 --- a/vlsisapd/src/openChams/src/vlsisapd/openChams/Node.h +++ b/vlsisapd/src/openChams/src/vlsisapd/openChams/Node.h @@ -1,100 +1,101 @@ -/* - * Node.h - * openChams - * - * Created by damien dupuis on 23/08/11. - * Copyright 2010-2011 UPMC / LIP6. All rights reserved. - * - */ + +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2011-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./vlsisapd/openChams/Node.h" | +// +-----------------------------------------------------------------+ + #ifndef __OPENCHAMS_NODE_H__ #define __OPENCHAMS_NODE_H__ -#include "vlsisapd/openChams/Name.h" +#include + namespace OpenChams { -class Node { - public: - enum Position { NONE = 0, - RIGHT = 1, - TOP = 2 - }; - protected: - Node(Name nodeName, Position pos, Node* parent); - virtual ~Node() {}; - + + class Node { + public: + enum Position { NONE=0, RIGHT=1, TOP=2 }; public: - inline Name getName() const; - inline Position getPosition() const; - inline Node* getParent(); - inline Node* getRight(); - inline Node* getTop(); - inline bool isRoot(); - - inline void setRight(Node*); - inline void setTop(Node*); - + inline const std::string& getName () const; + inline Position getPosition () const; + inline Node* getParent (); + inline Node* getRight (); + inline Node* getTop (); + inline bool isRoot (); + inline void setRight (Node*); + inline void setTop (Node*); + protected: + Node (const std::string& nodeName, Position pos, Node* parent); + virtual ~Node () {}; private: - Name _name; - Position _position; - Node* _parent; - Node* _right; - Node* _top; -}; - -inline Name Node::getName() const { return _name; } -inline Node::Position Node::getPosition() const { return _position; } -inline Node* Node::getParent() { return _parent; } -inline Node* Node::getRight() { return _right; } -inline Node* Node::getTop() { return _top; } -inline bool Node::isRoot() { return _parent == NULL; } - -inline void Node::setRight(Node* right) { _right = right; } -inline void Node::setTop(Node* top) { _top = top; } + std::string _name; + Position _position; + Node* _parent; + Node* _right; + Node* _top; + }; -class Bloc : public Node { + inline const std::string& Node::getName () const { return _name; } + inline Node::Position Node::getPosition() const { return _position; } + inline Node* Node::getParent () { return _parent; } + inline Node* Node::getRight () { return _right; } + inline Node* Node::getTop () { return _top; } + inline bool Node::isRoot () { return _parent == NULL; } + inline void Node::setRight (Node* right) { _right = right; } + inline void Node::setTop (Node* top) { _top = top; } + + + class Bloc : public Node { public: - Bloc(Name blocName, Position pos=Node::NONE, Node* parent=NULL); -}; + Bloc(const std::string& blocName, Position pos=Node::NONE, Node* parent=NULL); + }; -class Group : public Node { + + class Group : public Node { public: - enum Align { NONE = 0 - , VERTICAL = 1 - , HORIZONTAL = 2 - }; - - Group(Name groupName, Position pos=Node::NONE, Node* parent=NULL); - - inline void setRootNode(Node*); - inline void setIsolated(bool); - inline void setPaired(bool); - inline void setAlign(Align); - - inline Node* getRootNode(); - inline bool isIsolated(); - inline bool isPaired(); - inline Align getAlign(); - + enum Align { NONE=0 , VERTICAL=1 , HORIZONTAL=2 }; + public: + Group (const std::string& groupName, Position pos=Node::NONE, Node* parent=NULL); + inline void setRootNode (Node*); + inline void setIsolated (bool); + inline void setPaired (bool); + inline void setAlign (Align); + inline Node* getRootNode (); + inline bool isIsolated (); + inline bool isPaired (); + inline Align getAlign (); private: - Node* _root; - bool _isolated; - bool _paired; - Align _align; -}; + Node* _root; + bool _isolated; + bool _paired; + Align _align; + }; -inline void Group::setRootNode(Node* root) { _root = root; } -inline void Group::setIsolated(bool isolated) { _isolated = isolated; } -inline void Group::setPaired(bool paired) { _paired = paired; } -inline void Group::setAlign(Group::Align align) { _align = align; } -inline Node* Group::getRootNode() { return _root; } -inline bool Group::isIsolated() { return _isolated; } -inline bool Group::isPaired() { return _paired; } -inline Group::Align Group::getAlign() { return _align; } + inline void Group::setRootNode(Node* root) { _root = root; } + inline void Group::setIsolated(bool isolated) { _isolated = isolated; } + inline void Group::setPaired (bool paired) { _paired = paired; } + inline void Group::setAlign (Group::Align align) { _align = align; } + inline Node* Group::getRootNode() { return _root; } + inline bool Group::isIsolated () { return _isolated; } + inline bool Group::isPaired () { return _paired; } + inline Group::Align Group::getAlign () { return _align; } + + +} // OpenChams namespace. -} // namespace #endif diff --git a/vlsisapd/src/openChams/src/vlsisapd/openChams/Operator.h b/vlsisapd/src/openChams/src/vlsisapd/openChams/Operator.h index 6750283b..76a788d7 100644 --- a/vlsisapd/src/openChams/src/vlsisapd/openChams/Operator.h +++ b/vlsisapd/src/openChams/src/vlsisapd/openChams/Operator.h @@ -1,64 +1,74 @@ -/* - * Operator.h - * openChams - * - * Created by damien dupuis on 08/02/10. - * Copyright 2010 UPMC / LIP6. All rights reserved. - * - */ + +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./vlsisapd/openChams/Operator.h" | +// +-----------------------------------------------------------------+ + #ifndef __OPENCHAMS_OPERATOR_H__ #define __OPENCHAMS_OPERATOR_H__ #include -#include "vlsisapd/openChams/Name.h" namespace OpenChams { -class Operator { + + + class Operator { + public: - class Constraint { + class Constraint { public: - Constraint(Name ref, Name refParam, double factor); - - inline Name getRef(); - inline Name getRefParam(); - inline double getFactor(); - + Constraint ( const std::string& ref + , const std::string& refParam + , double factor ); + inline const std::string& getRef (); + inline const std::string& getRefParam (); + inline double getFactor (); private: - Name _ref; - Name _refParam; - double _factor; - }; + std::string _ref; + std::string _refParam; + double _factor; + }; public: - Operator(Name operatorName, Name simulModel); - - void addConstraint(Name paramName, Name ref, Name refParam ); - void addConstraint(Name paramName, Name ref, Name refParam, double factor); - void addConstraint(Name paramName, Name refEquation ); - void addConstraint(Name paramName, Name refEquation, double factor); - - inline Name getName(); - inline Name getSimulModel(); - inline bool hasNoConstraints(); - inline const std::map& getConstraints(); - + Operator (const std::string& operatorName, const std::string& simulModel); + void addConstraint (const std::string& paramName, const std::string& ref, const std::string& refParam); + void addConstraint (const std::string& paramName, const std::string& ref, const std::string& refParam, double factor); + void addConstraint (const std::string& paramName, const std::string& refEquation); + void addConstraint (const std::string& paramName, const std::string& refEquation, double factor); + inline const std::string& getName (); + inline const std::string& getSimulModel (); + inline bool hasNoConstraints (); + inline const std::map& getConstraints(); private: - Name _name; - Name _simulModel; - std::map _constraints; -}; + std::string _name; + std::string _simulModel; + std::map _constraints; + }; - inline Name Operator::getName() { return _name; }; - inline Name Operator::getSimulModel() { return _simulModel; }; - inline bool Operator::hasNoConstraints() { return (_constraints.size() == 0) ? true : false; }; - inline const std::map& Operator::getConstraints() { return _constraints; }; - inline Name Operator::Constraint::getRef() { return _ref; }; - inline Name Operator::Constraint::getRefParam() { return _refParam; }; - inline double Operator::Constraint::getFactor() { return _factor; }; + inline const std::string& Operator::getName () { return _name; }; + inline const std::string& Operator::getSimulModel () { return _simulModel; }; + inline bool Operator::hasNoConstraints () { return _constraints.empty(); }; + inline const std::map& Operator::getConstraints() { return _constraints; }; + + inline const std::string& Operator::Constraint::getRef () { return _ref; }; + inline const std::string& Operator::Constraint::getRefParam () { return _refParam; }; + inline double Operator::Constraint::getFactor () { return _factor; }; + } // namespace + #endif diff --git a/vlsisapd/src/openChams/src/vlsisapd/openChams/Parameters.h b/vlsisapd/src/openChams/src/vlsisapd/openChams/Parameters.h index 61a151a9..4f96a87d 100644 --- a/vlsisapd/src/openChams/src/vlsisapd/openChams/Parameters.h +++ b/vlsisapd/src/openChams/src/vlsisapd/openChams/Parameters.h @@ -22,26 +22,24 @@ #include namespace OpenChams { - class Name; + class Parameters { public: - inline Parameters (); - inline bool isEmpty (); - const std::string& getValue (Name); - inline const std::map& getValues (); - inline void addParameter (Name, const std::string&); - void addParameter (Name, const char*); + inline Parameters (); + inline bool isEmpty (); + const std::string& getValue (const std::string&); + inline const std::map& getValues (); + void addParameter (const std::string&, const std::string&); private: - std::map _params; + std::map _params; }; - inline Parameters::Parameters () { } - inline bool Parameters::isEmpty () { return (_params.size() == 0); } - inline const std::map& Parameters::getValues () { return _params; }; - inline void Parameters::addParameter (Name name, const std::string& value) { addParameter(name,value.c_str()); } + inline Parameters::Parameters () { } + inline bool Parameters::isEmpty () { return (_params.size() == 0); } + inline const std::map& Parameters::getValues () { return _params; }; } // OpenChams namespace. diff --git a/vlsisapd/src/openChams/src/vlsisapd/openChams/Port.h b/vlsisapd/src/openChams/src/vlsisapd/openChams/Port.h index 476be060..53d00fe3 100644 --- a/vlsisapd/src/openChams/src/vlsisapd/openChams/Port.h +++ b/vlsisapd/src/openChams/src/vlsisapd/openChams/Port.h @@ -1,43 +1,68 @@ -/* - * Port.h - * openChams - * - * Created by damien dupuis on 08/02/11. - * Copyright 2011 UPMC / LIP6. All rights reserved. - * - */ + +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2011-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./vlsisapd/openChams/Port.h" | +// +-----------------------------------------------------------------+ + #ifndef __OPENCHAMS_PORT_H__ #define __OPENCHAMS_PORT_H__ -#include "vlsisapd/openChams/Name.h" namespace OpenChams { -class Port { - public: - Port(Name type, unsigned idx , double x, double y, Name orient): _type(type), _idx(idx), _x(x), _y(y), _orient(orient) {} - ~Port() {} - - inline Name getType() const; - inline unsigned getIndex() const; - inline double getX() const; - inline double getY() const; - inline Name getOrientation() const; + + class Port { + public: + inline Port ( const std::string& type + , unsigned idx + , double x + , double y + , const std::string& orient ); + inline ~Port (); + inline const std::string& getType () const; + inline unsigned getIndex () const; + inline double getX () const; + inline double getY () const; + inline const std::string& getOrientation() const; private: - Name _type; - unsigned _idx; - double _x; - double _y; - Name _orient; + std::string _type; + unsigned _idx; + double _x; + double _y; + std::string _orient; }; -inline Name Port::getType() const { return _type; } -inline unsigned Port::getIndex() const { return _idx; } -inline double Port::getX() const { return _x; } -inline double Port::getY() const { return _y; } -inline Name Port::getOrientation() const { return _orient; } + + inline Port::Port (const std::string& type + , unsigned idx + , double x + , double y + , const std::string& orient) + : _type(type), _idx(idx), _x(x), _y(y), _orient(orient) + { } + + inline Port::~Port () + { } + + inline const std::string& Port::getType () const { return _type; } + inline unsigned Port::getIndex () const { return _idx; } + inline double Port::getX () const { return _x; } + inline double Port::getY () const { return _y; } + inline const std::string& Port::getOrientation() const { return _orient; } -} // namespace + +} // OpenChams namespace. + #endif diff --git a/vlsisapd/src/openChams/src/vlsisapd/openChams/Schematic.h b/vlsisapd/src/openChams/src/vlsisapd/openChams/Schematic.h index 7ee8fc03..56e61e16 100644 --- a/vlsisapd/src/openChams/src/vlsisapd/openChams/Schematic.h +++ b/vlsisapd/src/openChams/src/vlsisapd/openChams/Schematic.h @@ -1,57 +1,67 @@ -/* - * Schematic.h - * openChams - * - * Created by damien dupuis on 22/01/10. - * Copyright 2010 UPMC / LIP6. All rights reserved. - * - */ + +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./vlsisapd/openChams/Schematic.h" | +// +-----------------------------------------------------------------+ + #ifndef __OPENCHAMS_SCHEMATIC_H__ #define __OPENCHAMS_SCHEMATIC_H__ #include - -#include "vlsisapd/openChams/Name.h" +#include namespace OpenChams { -class Circuit; -class Schematic { + class Circuit; + + + class Schematic { + public: - class Infos { + class Infos { public: - Infos(double x, double y, Name orient); - - inline double getX(); - inline double getY(); - inline Name getOrientation(); - + Infos (double x, double y, const std::string& orient); + inline double getX (); + inline double getY (); + inline const std::string& getOrientation(); private: - double _x; - double _y; - Name _orient; - }; + double _x; + double _y; + std::string _orient; + }; + public: - Schematic(Circuit*); - - void addInstance(Name instanceName, double x, double y, Name orient ); - - inline bool hasNoInstances(); - inline const std::map& getInstances(); - + Schematic ( Circuit* ); + void addInstance ( const std::string& instanceName + , double x + , double y + , const std::string& orient ); + inline bool hasNoInstances (); + inline const std::map& getInstances(); private: - Circuit* _circuit; - std::map _instances; + Circuit* _circuit; + std::map _instances; }; -inline bool Schematic::hasNoInstances() { return (_instances.size() == 0) ? true : false; }; -inline const std::map& Schematic::getInstances() { return _instances; }; +inline bool Schematic::hasNoInstances() { return _instances.empty(); }; +inline const std::map& Schematic::getInstances () { return _instances; }; -inline double Schematic::Infos::getX() { return _x; }; -inline double Schematic::Infos::getY() { return _y; }; -inline Name Schematic::Infos::getOrientation() { return _orient; }; +inline double Schematic::Infos::getX () { return _x; }; +inline double Schematic::Infos::getY () { return _y; }; +inline const std::string& Schematic::Infos::getOrientation() { return _orient; }; -} // namespace -#endif +} // OpenChams namespace. + +#endif diff --git a/vlsisapd/src/openChams/src/vlsisapd/openChams/SimulModel.h b/vlsisapd/src/openChams/src/vlsisapd/openChams/SimulModel.h index 0e1cb104..17ce9381 100644 --- a/vlsisapd/src/openChams/src/vlsisapd/openChams/SimulModel.h +++ b/vlsisapd/src/openChams/src/vlsisapd/openChams/SimulModel.h @@ -10,7 +10,8 @@ #ifndef __OPENCHAMS_SIMULMODEL_H__ #define __OPENCHAMS_SIMULMODEL_H__ -#include "vlsisapd/openChams/Name.h" +#include + namespace OpenChams { class SimulModel { diff --git a/vlsisapd/src/openChams/src/vlsisapd/openChams/Sizing.h b/vlsisapd/src/openChams/src/vlsisapd/openChams/Sizing.h index eba5d2ec..1bcc5e85 100644 --- a/vlsisapd/src/openChams/src/vlsisapd/openChams/Sizing.h +++ b/vlsisapd/src/openChams/src/vlsisapd/openChams/Sizing.h @@ -1,52 +1,64 @@ -/* - * Sizing.h - * openChams - * - * Created by damien dupuis on 08/02/10. - * Copyright 2008-2010 UPMC / LIP6. All rights reserved. - * - */ + +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./vlsisapd/openChams/Sizing.h" | +// +-----------------------------------------------------------------+ + #ifndef __OPENCHAMS_SIZING_H__ #define __OPENCHAMS_SIZING_H__ #include +#include namespace OpenChams { - class Name; + class Circuit; class Operator; class Equation; - // class HighLevelCstr; - // class NRCCstr; - // class DDP; +//class HighLevelCstr; +//class NRCCstr; +//class DDP; + class Sizing { - public: - Sizing(Circuit*); - - Operator* addOperator(Name instanceName, Name operatorName, Name simulModel); - - // void addEquation(Name equationName, HighLevelCstr*); - // void addEquation(Name equationName, NRCCstr*); - // void addEquation(Name equationName, DDP*); - void addEquation(Name equationName, Equation*); - - inline bool hasNoOperators(); - inline bool hasNoEquations(); - inline const std::map& getOperators(); - inline const std::map& getEquations(); - - private: - Circuit* _circuit; - std::map _operators; // instanceName <-> operator - std::map _equations; // equationName <-> equation (string) + public: + Sizing ( Circuit* ); + Operator* addOperator ( const std::string& instanceName + , const std::string& operatorName + , const std::string& simulModel); + // void addEquation ( const std::string& equationName, HighLevelCstr* ); + // void addEquation ( const std::string& equationName, NRCCstr* ); + // void addEquation ( const std::string& equationName, DDP* ); + void addEquation ( const std::string& equationName, Equation* ); + inline bool hasNoOperators (); + inline bool hasNoEquations (); + inline const std::map& getOperators(); + inline const std::map& getEquations(); + private: + Circuit* _circuit; + std::map _operators; // instanceName <-> operator + std::map _equations; // equationName <-> equation (string) }; - - inline bool Sizing::hasNoOperators() { return (_operators.size() == 0) ? true : false; }; - inline bool Sizing::hasNoEquations() { return (_equations.size() == 0) ? true : false; }; - inline const std::map& Sizing::getOperators() { return _operators; }; - inline const std::map& Sizing::getEquations() { return _equations; }; -} // namespace + + + inline bool Sizing::hasNoOperators() { return _operators.empty(); }; + inline bool Sizing::hasNoEquations() { return _equations.empty(); }; + inline const std::map& Sizing::getOperators() { return _operators; }; + inline const std::map& Sizing::getEquations() { return _equations; }; + + +} // OpenChams namespace + #endif diff --git a/vlsisapd/src/openChams/src/vlsisapd/openChams/Transistor.h b/vlsisapd/src/openChams/src/vlsisapd/openChams/Transistor.h index 2a1f8c46..d11f63c3 100644 --- a/vlsisapd/src/openChams/src/vlsisapd/openChams/Transistor.h +++ b/vlsisapd/src/openChams/src/vlsisapd/openChams/Transistor.h @@ -11,7 +11,7 @@ // | Author : Damien Dupuis | // | E-mail : Jean-Paul.Chaput@lip6.fr | // | =============================================================== | -// | C++ Header : "./vlsisapd/openChams/Instance.h" | +// | C++ Header : "./vlsisapd/openChams/Transistor.h" | // +-----------------------------------------------------------------+ @@ -20,7 +20,6 @@ #include -#include "vlsisapd/openChams/Name.h" #include "vlsisapd/openChams/Parameters.h" @@ -32,42 +31,42 @@ namespace OpenChams { class Transistor { public: - Transistor (Name, Instance*); - inline void addParameter (Name, const char*); - inline void addParameter (Name, const std::string&); - inline Parameters getParameters (); - inline void setName (Name); - inline Name getName (); - inline Name getGate (); - inline Name getSource (); - inline Name getDrain (); - inline Name getBulk (); - void setGate (Name); - void setSource (Name); - void setDrain (Name); - void setBulk (Name); + Transistor (const std::string&, Instance*); + inline void addParameter (const std::string&, const char*); + inline void addParameter (const std::string&, const std::string&); + inline Parameters getParameters (); + inline void setName (const std::string&); + inline const std::string& getName (); + inline const std::string& getGate (); + inline const std::string& getSource (); + inline const std::string& getDrain (); + inline const std::string& getBulk (); + void setGate (const std::string&); + void setSource (const std::string&); + void setDrain (const std::string&); + void setBulk (const std::string&); + private: + bool checkConnector (const std::string&); private: - bool checkConnector (Name); - private: - Name _name; - Name _gate; // le nom du connecteur de _instance auquel la gate est reliée - Name _source; // le nom du connecteur de _instance auquel la source est reliée - Name _drain; // le nom du connecteur de _instance auquel le drain est relié - Name _bulk; // le nom du connecteur de _instance auquel le bulk est relié - Instance* _instance; - Parameters _params; + std::string _name; + std::string _gate; // le nom du connecteur de _instance auquel la gate est reliée + std::string _source; // le nom du connecteur de _instance auquel la source est reliée + std::string _drain; // le nom du connecteur de _instance auquel le drain est relié + std::string _bulk; // le nom du connecteur de _instance auquel le bulk est relié + Instance* _instance; + Parameters _params; }; - inline void Transistor::addParameter (Name name, const char* value) { _params.addParameter(name,value); }; - inline void Transistor::addParameter (Name name, const std::string& value) { _params.addParameter(name,value); }; - inline Parameters Transistor::getParameters () { return _params; }; - inline void Transistor::setName (Name name) { _name = name; }; - inline Name Transistor::getName () { return _name; }; - inline Name Transistor::getGate () { return _gate; }; - inline Name Transistor::getSource () { return _source; }; - inline Name Transistor::getDrain () { return _drain; }; - inline Name Transistor::getBulk () { return _bulk; }; + inline void Transistor::addParameter (const std::string& name, const char* value) { _params.addParameter(name,value); }; + inline void Transistor::addParameter (const std::string& name, const std::string& value) { _params.addParameter(name,value); }; + inline Parameters Transistor::getParameters () { return _params; }; + inline void Transistor::setName (const std::string& name) { _name = name; }; + inline const std::string& Transistor::getName () { return _name; }; + inline const std::string& Transistor::getGate () { return _gate; }; + inline const std::string& Transistor::getSource () { return _source; }; + inline const std::string& Transistor::getDrain () { return _drain; }; + inline const std::string& Transistor::getBulk () { return _bulk; }; } // OpenChams namespace. diff --git a/vlsisapd/src/openChams/src/vlsisapd/openChams/Wire.h b/vlsisapd/src/openChams/src/vlsisapd/openChams/Wire.h index 7ed3e570..dd7d84aa 100644 --- a/vlsisapd/src/openChams/src/vlsisapd/openChams/Wire.h +++ b/vlsisapd/src/openChams/src/vlsisapd/openChams/Wire.h @@ -1,87 +1,124 @@ -/* - * Wire.h - * openChams - * - * Created by damien dupuis on 08/02/11. - * Copyright 2011 UPMC / LIP6. All rights reserved. - * - */ + +// -*- C++ -*- +// +// This file is part of the VLSI SAPD Software. +// Copyright (c) UPMC/LIP6 2011-2012, All Rights Reserved +// +// +-----------------------------------------------------------------+ +// | V L S I S A P D | +// | OpenChams Circuit Data Base | +// | | +// | Author : Damien Dupuis | +// | E-mail : Jean-Paul.Chaput@lip6.fr | +// | =============================================================== | +// | C++ Header : "./vlsisapd/openChams/Wire.h" | +// +-----------------------------------------------------------------+ + #ifndef __OPENCHAMS_WIRE_H__ #define __OPENCHAMS_WIRE_H__ +#include #include -#include "vlsisapd/openChams/Name.h" namespace OpenChams { -class WirePoint { - public: - WirePoint() {} - virtual ~WirePoint() {}; -}; -class InstancePoint: public WirePoint { + + class WirePoint { + public: + WirePoint() {} + virtual ~WirePoint() {}; + }; + + + class InstancePoint: public WirePoint { + public: + inline InstancePoint (const std::string& name, const std::string& plug); + inline virtual ~InstancePoint (); + inline const std::string& getName (); + inline const std::string& getPlug (); private: - Name _name; - Name _plug; + std::string _name; + std::string _plug; + }; + + class PortPoint: public WirePoint { public: - InstancePoint(Name name, Name plug): _name(name), _plug(plug) {} - virtual ~InstancePoint() {} - - inline Name getName() { return _name; } - inline Name getPlug() { return _plug; } -}; - -class PortPoint: public WirePoint { + inline PortPoint (unsigned idx); + inline virtual ~PortPoint (); + inline unsigned getIndex (); private: - unsigned _idx; + unsigned _idx; + }; + + + class IntermediatePoint: public WirePoint { public: - PortPoint(unsigned idx): _idx(idx) {} - virtual ~PortPoint() {} - - inline unsigned getIndex() { return _idx; } -}; - -class IntermediatePoint: public WirePoint { + inline IntermediatePoint (double x, double y); + inline virtual ~IntermediatePoint (); + inline double getX (); + inline double getY (); private: - double _x; - double _y; + double _x; + double _y; + }; - public: - IntermediatePoint(double x, double y): _x(x), _y(y) {} - virtual ~IntermediatePoint() {} - - inline double getX() { return _x; } - inline double getY() { return _y; } -}; - -class Wire { - private: - WirePoint* _start; - WirePoint* _end; - std::vector _inters; + class Wire { public: - Wire(): _start(NULL), _end(NULL), _inters() {} - ~Wire() {} - + inline Wire (); + inline ~Wire (); // Accessors - inline WirePoint* getStartPoint() { return _start; } - inline WirePoint* getEndPoint() { return _end; } - inline bool hasNoIntermediatePoints() { return (_inters.size() == 0)? true : false; } - inline const std::vector& getIntermediatePoints() { return _inters; } - + inline WirePoint* getStartPoint (); + inline WirePoint* getEndPoint (); + inline bool hasNoIntermediatePoints(); + inline const std::vector& getIntermediatePoints(); // Modifiers - void setStartPoint(Name name, Name plug); - void setStartPoint(unsigned idx); - void setEndPoint(Name name, Name plug); - void setEndPoint(unsigned idx); - void addIntermediatePoint(double x, double y); -}; + void setStartPoint (const std::string& name, const std::string& plug); + void setStartPoint (unsigned idx); + void setEndPoint (const std::string& name, const std::string& plug); + void setEndPoint (unsigned idx); + void addIntermediatePoint (double x, double y); + private: + WirePoint* _start; + WirePoint* _end; + std::vector _inters; + }; + + +// Inlines of InstancePoint. + inline InstancePoint::InstancePoint (const std::string& name, const std::string& plug) : _name(name), _plug(plug) {} + inline InstancePoint::~InstancePoint () {} + inline const std::string& InstancePoint::getName () { return _name; } + inline const std::string& InstancePoint::getPlug () { return _plug; } + + +// Inlines of PortPoint. + inline PortPoint::PortPoint (unsigned idx): _idx(idx) {} + inline PortPoint::~PortPoint () {} + inline unsigned PortPoint::getIndex () { return _idx; } + + +// Inlines of IntermediatePoint. + inline IntermediatePoint::IntermediatePoint (double x, double y): _x(x), _y(y) {} + inline IntermediatePoint::~IntermediatePoint() {} + inline double IntermediatePoint::getX () { return _x; } + inline double IntermediatePoint::getY () { return _y; } + + +// Inlines of Wire. + inline Wire::Wire () : _start(NULL), _end(NULL), _inters() {} + inline Wire::~Wire () {} + inline WirePoint* Wire::getStartPoint () { return _start; } + inline WirePoint* Wire::getEndPoint () { return _end; } + inline bool Wire::hasNoIntermediatePoints() { return _inters.empty(); } + inline const std::vector& Wire::getIntermediatePoints() { return _inters; } + } // namespace + #endif