* All Tools:

- A complete sweep of cleanup to suppress allmost all compiler warnings.

  * ./vlsisapd/openchams:
    - Change: Completly remove Name as std::string are shared. Also impact
        amsCore (OpenChamsParser/OpenChamsDriver).

  * ./vlsisapd/configuration:
    - Bug: Python.h must be included first (see Isobar comment).
    - Change: New "readFromFile()" Configuration method.
This commit is contained in:
Jean-Paul Chaput 2012-11-16 12:47:32 +00:00
parent c18e875143
commit df2eaec70f
35 changed files with 1464 additions and 1260 deletions

View File

@ -1,6 +1,10 @@
ADD_SUBDIRECTORY(cif) ADD_SUBDIRECTORY(cif)
ADD_SUBDIRECTORY(agds) ADD_SUBDIRECTORY(agds)
ADD_SUBDIRECTORY(dtr) if( IS_DIRECTORY dtr )
ADD_SUBDIRECTORY(openChams) ADD_SUBDIRECTORY(dtr)
endif( IS_DIRECTORY dtr )
if( IS_DIRECTORY openChams )
ADD_SUBDIRECTORY(openChams)
endif( IS_DIRECTORY openChams )
ADD_SUBDIRECTORY(liberty) ADD_SUBDIRECTORY(liberty)
ADD_SUBDIRECTORY(spice) ADD_SUBDIRECTORY(spice)

View File

@ -2,26 +2,22 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the VSLSI Stand-Alone Software. // 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
// //
// =================================================================== // +-----------------------------------------------------------------+
// // | V L S I Stand - Alone Parsers / Drivers |
// $Id$
//
// x-----------------------------------------------------------------x
// | C O R I O L I S |
// | C o n f i g u r a t i o n D a t a - B a s e | // | 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 | // | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr | // | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Module : "./ConfEditorMain.cpp" | // | C++ Module : "./ConfEditorMain.cpp" |
// x-----------------------------------------------------------------x // +-----------------------------------------------------------------+
#include <Python.h>
#include <cstdio> #include <cstdio>
#include <libxml/xmlreader.h> #include <libxml/xmlreader.h>
#include <Python.h>
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
namespace boptions = boost::program_options; namespace boptions = boost::program_options;

View File

@ -2,20 +2,16 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the VSLSI Stand-Alone Software. // 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$
// //
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
// | 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 | // | 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 | // | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@lip6.fr | // | 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<reference_existing_object>()) .def("getParameter" , cfgGetParameter2 , return_value_policy<reference_existing_object>())
.def("addParameter" , cfgAddParameter2 , return_value_policy<reference_existing_object>()) .def("addParameter" , cfgAddParameter2 , return_value_policy<reference_existing_object>())
.def("addParameter" , cfgAddParameter3 , return_value_policy<reference_existing_object>()) .def("addParameter" , cfgAddParameter3 , return_value_policy<reference_existing_object>())
.def("readFromFile" , &Configuration::readFromFile )
.def("pushDefaultPriority", &Configuration::pushDefaultPriority) .def("pushDefaultPriority", &Configuration::pushDefaultPriority)
.def("popDefaultPriority" , &Configuration::popDefaultPriority ) .def("popDefaultPriority" , &Configuration::popDefaultPriority )
.def("getDefaultPriority" , &Configuration::getDefaultPriority ) .def("getDefaultPriority" , &Configuration::getDefaultPriority )

View File

@ -5,7 +5,6 @@ SET ( hpps vlsisapd/openChams/Circuit.h
vlsisapd/openChams/Instance.h vlsisapd/openChams/Instance.h
vlsisapd/openChams/Device.h vlsisapd/openChams/Device.h
vlsisapd/openChams/Net.h vlsisapd/openChams/Net.h
vlsisapd/openChams/Name.h
vlsisapd/openChams/Operator.h vlsisapd/openChams/Operator.h
vlsisapd/openChams/Parameters.h vlsisapd/openChams/Parameters.h
vlsisapd/openChams/Schematic.h vlsisapd/openChams/Schematic.h
@ -28,7 +27,6 @@ SET ( cpps Circuit.cpp
Instance.cpp Instance.cpp
Device.cpp Device.cpp
Net.cpp Net.cpp
Name.cpp
Operator.cpp Operator.cpp
Parameters.cpp Parameters.cpp
Schematic.cpp Schematic.cpp

View File

@ -1,11 +1,18 @@
/*
* Circuit.cpp // -*- C++ -*-
* openChams //
* // This file is part of the VLSI SAPD Software.
* Created by damien dupuis on 18/12/09. // Copyright (c) UPMC/LIP6 2009-2012, All Rights Reserved
* Copyright 2009 UPMC / LIP6. 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 <iostream> #include <iostream>
#include <fstream> #include <fstream>
@ -37,6 +44,7 @@ using namespace std;
#include "vlsisapd/openChams/DDP.h" #include "vlsisapd/openChams/DDP.h"
#include "vlsisapd/openChams/DesignerCstrOC.h" #include "vlsisapd/openChams/DesignerCstrOC.h"
namespace OpenChams { namespace OpenChams {
@ -145,13 +153,14 @@ namespace OpenChams {
static bool readSizingDone = false; static bool readSizingDone = false;
static bool readLayoutDone = false; static bool readLayoutDone = false;
Circuit::Circuit(Name name, Name techno) : _name(name) Circuit::Circuit(const std::string& name, const std::string& techno)
, _absolutePath("") : _name (name)
, _techno(techno) , _absolutePath("")
, _netlist(NULL) , _techno (techno)
, _schematic(NULL) , _netlist (NULL)
, _sizing(NULL) , _schematic (NULL)
, _layout(NULL) , _sizing (NULL)
, _layout (NULL)
{ {
readSubCircuitsPathsDone = false; readSubCircuitsPathsDone = false;
readCircuitParametersDone = false; readCircuitParametersDone = false;
@ -164,47 +173,53 @@ namespace OpenChams {
readLayoutDone = false; readLayoutDone = false;
} }
// COMPARISON FUNCTION // // COMPARISON FUNCTION //
bool ConnectionsSort(const Net::Connection* c1, const Net::Connection* c2) { bool ConnectionsSort(const Net::Connection* c1, const Net::Connection* c2)
return c1->getInstanceName() < c2->getInstanceName(); { 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) { bool InstanceNameSort(const Instance* i1, const Instance* i2)
return n1->getName() < n2->getName(); { return i1->getName() < i2->getName(); }
}
bool NetNameSort(const Net* n1, const Net* n2)
{ return n1->getName() < n2->getName(); }
// USEFUL // // USEFUL //
void Circuit::check_uppercase(string& str, vector<string>& compares, string message) { void Circuit::check_uppercase(string& str, vector<string>& compares, string message)
{
transform(str.begin(), str.end(), str.begin(), ::toupper); transform(str.begin(), str.end(), str.begin(), ::toupper);
bool equal = false; bool equal = false;
for (size_t i = 0 ; i < compares.size() ; i++) { for (size_t i = 0 ; i < compares.size() ; i++) {
if (str == compares[i]) { if (str == compares[i]) {
equal = true; equal = true;
} }
} }
if (!equal) { if (!equal) {
throw OpenChamsException(message); throw OpenChamsException(message);
} }
} }
void Circuit::check_lowercase(string& str, vector<string>& compares, string message) {
void Circuit::check_lowercase(string& str, vector<string>& compares, string message)
{
transform(str.begin(), str.end(), str.begin(), ::tolower); transform(str.begin(), str.end(), str.begin(), ::tolower);
bool equal = false; bool equal = false;
for (size_t i = 0 ; i < compares.size() ; i++) { for (size_t i = 0 ; i < compares.size() ; i++) {
if (str == compares[i]) { if (str == compares[i]) {
equal = true; equal = true;
} }
} }
if (!equal) { if (!equal) {
throw OpenChamsException(message); 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); SimulModel* sim = new SimulModel(id, base, version, filePath);
map<unsigned, SimulModel*>::iterator it = _simulModels.find(id); map<unsigned, SimulModel*>::iterator it = _simulModels.find(id);
if (it != _simulModels.end()) if (it != _simulModels.end())
@ -212,30 +227,30 @@ namespace OpenChams {
_simulModels[id] = sim; _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"); xmlChar* paramNameC = xmlGetProp(node, (xmlChar*)"name");
value = xmlGetProp(node, (xmlChar*)"value"); value = xmlGetProp(node, (xmlChar*)"value");
if (paramNameC and value) { if (!paramNameC or !value)
Name name((const char*)paramNameC);
return name;
} else {
throw OpenChamsException("[ERROR] 'parameter' node must have 'name' and 'value' properties."); throw OpenChamsException("[ERROR] 'parameter' node must have 'name' and 'value' properties.");
}
} return string((const char*)paramNameC);
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("");
}
} }
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 // // CIRCUIT //
void Circuit::readSubCircuitsPaths(xmlNode* node) { void Circuit::readSubCircuitsPaths(xmlNode* node)
{
if (readSubCircuitsPathsDone) { if (readSubCircuitsPathsDone) {
cerr << "[WARNING] Only one 'subCircuitsPaths' node is allowed in circuit, others will be ignored." << endl; cerr << "[WARNING] Only one 'subCircuitsPaths' node is allowed in circuit, others will be ignored." << endl;
return; return;
@ -274,8 +289,8 @@ namespace OpenChams {
if (paramNode->type == XML_ELEMENT_NODE) { if (paramNode->type == XML_ELEMENT_NODE) {
if (xmlStrEqual(paramNode->name, (xmlChar*)"parameter")) { if (xmlStrEqual(paramNode->name, (xmlChar*)"parameter")) {
const xmlChar* value = NULL; const xmlChar* value = NULL;
Name paramName = readParameter(paramNode, value); string paramName = readParameter(paramNode, value);
if (paramName == Name("")) return; // error if (paramName.empty()) return; // error
addParameter(paramName, (const char*)value); addParameter(paramName, (const char*)value);
} else { } else {
cerr << "[WARNING] Only 'parameter' and 'parameterEq' nodes are allowed under 'parameters' node." << endl; 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"); xmlChar* iSBCC = xmlGetProp(node, (xmlChar*)"sourceBulkConnected");
Instance* inst = NULL; Instance* inst = NULL;
if (iNameC && iModelC && iOrderC && iMOSC && iSBCC) { // this is a device if (iNameC && iModelC && iOrderC && iMOSC && iSBCC) { // this is a device
Name instanceName((const char*)iNameC); const std::string& instanceName((const char*)iNameC);
Name modelName((const char*)iModelC); const std::string& modelName((const char*)iModelC);
unsigned order = stringAs<unsigned>(iOrderC); unsigned order = stringAs<unsigned>(iOrderC);
string mosStr((const char*)iMOSC); string mosStr((const char*)iMOSC);
string mosComp[2] = {"NMOS", "PMOS"}; string mosComp[2] = {"NMOS", "PMOS"};
@ -412,10 +427,10 @@ namespace OpenChams {
vector<string> sbcComps(sbcComp, sbcComp+4); vector<string> sbcComps(sbcComp, sbcComp+4);
check_lowercase(sourceBulkStr, sbcComps, "[ERROR] In 'instance', 'sourceBulkConnected' property must be 'true', 'false', 'on' or 'off'."); check_lowercase(sourceBulkStr, sbcComps, "[ERROR] In 'instance', 'sourceBulkConnected' property must be 'true', 'false', 'on' or 'off'.");
bool sourceBulkConnected = ((sourceBulkStr == "true") || (sourceBulkStr == "on")) ? true : false; 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 } else if (iNameC && iModelC && iOrderC && !iMOSC && !iSBCC) { // this is a subcircuit
Name instanceName((const char*)iNameC); const std::string& instanceName((const char*)iNameC);
Name modelName((const char*)iModelC); const std::string& modelName((const char*)iModelC);
unsigned order = stringAs<unsigned>(iOrderC); unsigned order = stringAs<unsigned>(iOrderC);
inst = netlist->addInstance(instanceName, modelName, order); inst = netlist->addInstance(instanceName, modelName, order);
} else { } else {
@ -448,8 +463,8 @@ namespace OpenChams {
for (xmlNode* node = child; node; node = node->next) { for (xmlNode* node = child; node; node = node->next) {
if (node->type == XML_ELEMENT_NODE) { if (node->type == XML_ELEMENT_NODE) {
if (xmlStrEqual(node->name, (xmlChar*)"connector")) { if (xmlStrEqual(node->name, (xmlChar*)"connector")) {
Name connectorName = readConnector(node); string connectorName = readConnector(node);
if (connectorName == Name("")) return; // error if (connectorName.empty()) return; // error
inst->addConnector(connectorName); inst->addConnector(connectorName);
} }
} }
@ -462,8 +477,8 @@ namespace OpenChams {
if (node->type == XML_ELEMENT_NODE) { if (node->type == XML_ELEMENT_NODE) {
if (xmlStrEqual(node->name, (xmlChar*)"parameter")) { if (xmlStrEqual(node->name, (xmlChar*)"parameter")) {
const xmlChar* value = NULL; const xmlChar* value = NULL;
Name paramName = readParameter(node, value); string paramName = readParameter(node, value);
if (paramName == Name("")) return; // error if (paramName.empty()) return; // error
inst->addParameter(paramName, (const char*)value); inst->addParameter(paramName, (const char*)value);
} else { } else {
cerr << "[WARNING] Only 'parameter' and 'parameterEq' nodes are allowed under 'instance' node." << endl; 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"); xmlChar* tNameC = xmlGetProp(node, (xmlChar*)"name");
Transistor* trans = NULL; Transistor* trans = NULL;
if (tNameC) { if (tNameC) {
Name tName((const char*)tNameC); const std::string& tName((const char*)tNameC);
trans = dev->addTransistor(tName); trans = dev->addTransistor(tName);
} else { } else {
throw OpenChamsException("[ERROR] 'transistor' node must have 'name' property."); throw OpenChamsException("[ERROR] 'transistor' node must have 'name' property.");
@ -518,10 +533,10 @@ namespace OpenChams {
xmlChar* drainC = xmlGetProp(node, (xmlChar*)"drain"); xmlChar* drainC = xmlGetProp(node, (xmlChar*)"drain");
xmlChar* bulkC = xmlGetProp(node, (xmlChar*)"bulk"); xmlChar* bulkC = xmlGetProp(node, (xmlChar*)"bulk");
if (gateC && sourceC && drainC && bulkC) { if (gateC && sourceC && drainC && bulkC) {
Name gateN ((const char*)gateC); const std::string& gateN ((const char*)gateC);
Name sourceN((const char*)sourceC); const std::string& sourceN((const char*)sourceC);
Name drainN ((const char*)drainC); const std::string& drainN ((const char*)drainC);
Name bulkN ((const char*)bulkC); const std::string& bulkN ((const char*)bulkC);
trans->setGate(gateN); trans->setGate(gateN);
trans->setSource(sourceN); trans->setSource(sourceN);
trans->setDrain(drainN); trans->setDrain(drainN);
@ -557,7 +572,7 @@ namespace OpenChams {
xmlChar* nExternC = xmlGetProp(node, (xmlChar*)"isExternal"); xmlChar* nExternC = xmlGetProp(node, (xmlChar*)"isExternal");
Net* net = NULL; Net* net = NULL;
if (nNameC && nTypeC && nExternC) { if (nNameC && nTypeC && nExternC) {
Name netName((const char*)nNameC); const std::string& netName((const char*)nNameC);
string typeStr((const char*)nTypeC); string typeStr((const char*)nTypeC);
string typeComp[3] = {"power", "ground", "logical"}; string typeComp[3] = {"power", "ground", "logical"};
vector<string> typeComps(typeComp, typeComp+3); vector<string> typeComps(typeComp, typeComp+3);
@ -567,7 +582,7 @@ namespace OpenChams {
vector<string> extComps(extComp, extComp+4); vector<string> extComps(extComp, extComp+4);
check_lowercase(externStr, extComps, "[ERROR] In 'net', 'isExternal' must be 'true', 'false', 'on' or 'off'."); check_lowercase(externStr, extComps, "[ERROR] In 'net', 'isExternal' must be 'true', 'false', 'on' or 'off'.");
bool isExternal = ((externStr == "true") || (externStr == "on")) ? true : false; bool isExternal = ((externStr == "true") || (externStr == "on")) ? true : false;
net = netlist->addNet(netName, Name(typeStr), isExternal); net = netlist->addNet(netName, typeStr, isExternal);
} else { } else {
throw OpenChamsException("[ERROR] 'net' node must have 'name', 'type' and 'isExternal' properties."); throw OpenChamsException("[ERROR] 'net' node must have 'name', 'type' and 'isExternal' properties.");
//return net; //return net;
@ -591,14 +606,14 @@ namespace OpenChams {
xmlChar* instanceNameC = xmlGetProp(node, (xmlChar*)"instance"); xmlChar* instanceNameC = xmlGetProp(node, (xmlChar*)"instance");
xmlChar* connectorNameC = xmlGetProp(node, (xmlChar*)"name"); xmlChar* connectorNameC = xmlGetProp(node, (xmlChar*)"name");
if (instanceNameC && connectorNameC) { if (instanceNameC && connectorNameC) {
Name iName((const char*)instanceNameC); const std::string& iName((const char*)instanceNameC);
Name cName((const char*)connectorNameC); const std::string& cName((const char*)connectorNameC);
Instance* inst = net->getNetlist()->getInstance(iName); Instance* inst = net->getNetlist()->getInstance(iName);
if (!inst) { if (!inst) {
string error("[ERROR] no instance named \""); string error("[ERROR] no instance named \"");
error += iName.getString(); error += iName;
error += "\" in connector of net \""; error += "\" in connector of net \"";
error += net->getName().getString(); error += net->getName();
error += "\"."; error += "\".";
throw OpenChamsException(error); throw OpenChamsException(error);
//return; //return;
@ -640,14 +655,14 @@ namespace OpenChams {
xmlChar* yC = xmlGetProp(node, (xmlChar*)"y"); xmlChar* yC = xmlGetProp(node, (xmlChar*)"y");
xmlChar* orientC = xmlGetProp(node, (xmlChar*)"orient"); xmlChar* orientC = xmlGetProp(node, (xmlChar*)"orient");
if (nameC && xC && yC && orientC) { if (nameC && xC && yC && orientC) {
Name iName((const char*)nameC); const std::string& iName((const char*)nameC);
double x = stringAs<double>((const char*)xC); double x = stringAs<double>((const char*)xC);
double y = stringAs<double>((const char*)yC); double y = stringAs<double>((const char*)yC);
string orientStr((const char*)orientC); string orientStr((const char*)orientC);
string orientComp[8] = {"ID", "R1", "R2", "R3", "MX", "XR", "MY", "YR"}; string orientComp[8] = {"ID", "R1", "R2", "R3", "MX", "XR", "MY", "YR"};
vector<string> orientComps (orientComp, orientComp+8); vector<string> orientComps (orientComp, orientComp+8);
check_uppercase(orientStr, orientComps, "[ERROR] In 'schematic'.'instance', 'orient' must be 'ID', 'R1', 'R2', 'R3', 'MX', 'XR', 'MY' or 'YR'."); 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 { } else {
throw OpenChamsException("[ERROR] 'instance' node in 'schematic' must have 'name', 'x', 'y' and 'orient' properties."); 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) { void Circuit::readNetSchematic(xmlNode* node, Circuit* circuit) {
xmlChar* nameC = xmlGetProp(node, (xmlChar*)"name"); xmlChar* nameC = xmlGetProp(node, (xmlChar*)"name");
if (nameC) { if (nameC) {
Name nName((const char*)nameC); const std::string& nName((const char*)nameC);
Net* net = circuit->getNetlist()->getNet(nName); Net* net = circuit->getNetlist()->getNet(nName);
if (!net) { if (!net) {
string error ("[ERROR] In 'schematic' section cannot specify wires for 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."; error += " since it has not been defined in netlist section.";
throw OpenChamsException(error); throw OpenChamsException(error);
} }
@ -688,7 +703,7 @@ namespace OpenChams {
xmlChar* yC = xmlGetProp(node, (xmlChar*)"y"); xmlChar* yC = xmlGetProp(node, (xmlChar*)"y");
xmlChar* orientC = xmlGetProp(node, (xmlChar*)"orient"); xmlChar* orientC = xmlGetProp(node, (xmlChar*)"orient");
if (typeC && idxC && xC && yC && orientC) { if (typeC && idxC && xC && yC && orientC) {
Name pType((const char*)typeC); const std::string& pType((const char*)typeC);
unsigned idx = stringAs<unsigned>(idxC); unsigned idx = stringAs<unsigned>(idxC);
double x = stringAs<double>(xC); double x = stringAs<double>(xC);
double y = stringAs<double>(yC); double y = stringAs<double>(yC);
@ -696,7 +711,7 @@ namespace OpenChams {
string orientComp[8] = {"ID", "R1", "R2", "R3", "MX", "XR", "MY", "YR"}; string orientComp[8] = {"ID", "R1", "R2", "R3", "MX", "XR", "MY", "YR"};
vector<string> orientComps (orientComp, orientComp+8); vector<string> orientComps (orientComp, orientComp+8);
check_uppercase(orientStr, orientComps, "[ERROR] In 'schematic'.'port', 'orient' must be 'ID', 'R1', 'R2', 'R3', 'MX', 'XR', 'MY' or 'YR'."); 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 { } else {
throw OpenChamsException("[ERROR] 'schematic'.'port' must have 'type', 'idx', 'x', 'y' and 'orient' properties."); 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* plugC = xmlGetProp(node, (xmlChar*)"plug");
xmlChar* idxC = xmlGetProp(node, (xmlChar*)"idx"); xmlChar* idxC = xmlGetProp(node, (xmlChar*)"idx");
if (nameC && plugC) { if (nameC && plugC) {
Name name((const char*)nameC); const std::string& name((const char*)nameC);
Name plug((const char*)plugC); const std::string& plug((const char*)plugC);
if (!wire->getStartPoint()) { if (!wire->getStartPoint()) {
wire->setStartPoint(name, plug); wire->setStartPoint(name, plug);
} else if (!wire->getEndPoint()) { } else if (!wire->getEndPoint()) {
@ -781,11 +796,11 @@ namespace OpenChams {
xmlChar* operatorC = xmlGetProp(node, (xmlChar*)"operator"); xmlChar* operatorC = xmlGetProp(node, (xmlChar*)"operator");
xmlChar* simulModC = xmlGetProp(node, (xmlChar*)"simulModel"); xmlChar* simulModC = xmlGetProp(node, (xmlChar*)"simulModel");
if (nameC && operatorC && simulModC) { if (nameC && operatorC && simulModC) {
Name iName ((const char*)nameC); const std::string& iName ((const char*)nameC);
string opStr ((const char*)operatorC); string opStr ((const char*)operatorC);
transform(opStr.begin(), opStr.end(), opStr.begin(), ::toupper); transform(opStr.begin(), opStr.end(), opStr.begin(), ::toupper);
Name opName (opStr); const std::string& opName (opStr);
Name simulMod((const char*)simulModC); const std::string& simulMod((const char*)simulModC);
Operator* op = sizing->addOperator(iName, opName, simulMod); Operator* op = sizing->addOperator(iName, opName, simulMod);
xmlNode* child = node->children; xmlNode* child = node->children;
for (xmlNode* node = child; node; node = node->next) { for (xmlNode* node = child; node; node = node->next) {
@ -813,17 +828,17 @@ namespace OpenChams {
xmlChar* refEqC = xmlGetProp(node, (xmlChar*)"refEquation"); xmlChar* refEqC = xmlGetProp(node, (xmlChar*)"refEquation");
xmlChar* factorC = xmlGetProp(node, (xmlChar*)"factor"); xmlChar* factorC = xmlGetProp(node, (xmlChar*)"factor");
if (paramC && refC && refParamC) { if (paramC && refC && refParamC) {
Name param ((const char*)paramC); const std::string& param ((const char*)paramC);
Name ref ((const char*)refC); const std::string& ref ((const char*)refC);
Name refParam ((const char*)refParamC); const std::string& refParam ((const char*)refParamC);
double factor = 1.0; double factor = 1.0;
if (factorC) { if (factorC) {
factor = stringAs<double>(factorC); factor = stringAs<double>(factorC);
} }
op->addConstraint(param, ref, refParam, factor); op->addConstraint(param, ref, refParam, factor);
} else if (paramC && refEqC) { } else if (paramC && refEqC) {
Name param ((const char*)paramC); const std::string& param ((const char*)paramC);
Name refEq ((const char*)refEqC); const std::string& refEq ((const char*)refEqC);
double factor = 1.0; double factor = 1.0;
if (factorC) { if (factorC) {
factor = stringAs<double>(factorC); factor = stringAs<double>(factorC);
@ -860,7 +875,7 @@ namespace OpenChams {
xmlChar* nameC = xmlGetProp(eqNode, (xmlChar*)"name"); xmlChar* nameC = xmlGetProp(eqNode, (xmlChar*)"name");
xmlChar* equationC = xmlGetProp(eqNode, (xmlChar*)"equation"); xmlChar* equationC = xmlGetProp(eqNode, (xmlChar*)"equation");
if (nameC && equationC) { if (nameC && equationC) {
Name eName ((const char*)nameC); const std::string& eName ((const char*)nameC);
string eqStr ((const char*)equationC); string eqStr ((const char*)equationC);
HighLevelCstr* equation = new HighLevelCstr(); HighLevelCstr* equation = new HighLevelCstr();
equation->addEquation(eqStr); equation->addEquation(eqStr);
@ -880,7 +895,7 @@ namespace OpenChams {
xmlChar* nameC = xmlGetProp(eqNode, (xmlChar*)"name"); xmlChar* nameC = xmlGetProp(eqNode, (xmlChar*)"name");
xmlChar* equationC = xmlGetProp(eqNode, (xmlChar*)"equation"); xmlChar* equationC = xmlGetProp(eqNode, (xmlChar*)"equation");
if (nameC && equationC) { if (nameC && equationC) {
Name eName ((const char*)nameC); const std::string& eName ((const char*)nameC);
string eqStr ((const char*)equationC); string eqStr ((const char*)equationC);
DesignerCstrOC* equation = new DesignerCstrOC(); DesignerCstrOC* equation = new DesignerCstrOC();
equation->addEquation(eqStr); equation->addEquation(eqStr);
@ -903,7 +918,7 @@ namespace OpenChams {
xmlChar* paramC = xmlGetProp(eqNode, (xmlChar*)"param"); xmlChar* paramC = xmlGetProp(eqNode, (xmlChar*)"param");
xmlChar* equationC = xmlGetProp(eqNode, (xmlChar*)"equation"); xmlChar* equationC = xmlGetProp(eqNode, (xmlChar*)"equation");
if (nameC && equationC && paramC) { if (nameC && equationC && paramC) {
Name eName ((const char*)nameC); const std::string& eName ((const char*)nameC);
string eqStr ((const char*)equationC); string eqStr ((const char*)equationC);
string paramStr ((const char*)paramC); string paramStr ((const char*)paramC);
NRCCstr* equation = new NRCCstr(paramStr); NRCCstr* equation = new NRCCstr(paramStr);
@ -926,7 +941,7 @@ namespace OpenChams {
if (eqNode->type == XML_ELEMENT_NODE && xmlStrEqual(eqNode->name, (xmlChar*)"ddp_i")) { if (eqNode->type == XML_ELEMENT_NODE && xmlStrEqual(eqNode->name, (xmlChar*)"ddp_i")) {
xmlChar* nameC = xmlGetProp(eqNode, (xmlChar*)"name"); xmlChar* nameC = xmlGetProp(eqNode, (xmlChar*)"name");
if (nameC) { if (nameC) {
Name eName ((const char*)nameC); const std::string& eName ((const char*)nameC);
DDP* equation = new DDP(); DDP* equation = new DDP();
for(xmlNode* eqNode2 = eqNode->children ; eqNode2 ; eqNode2 = eqNode2->next) { for(xmlNode* eqNode2 = eqNode->children ; eqNode2 ; eqNode2 = eqNode2->next) {
if (eqNode2->type == XML_ELEMENT_NODE && xmlStrEqual(eqNode2->name, (xmlChar*)"ddp_eq")) { 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* nameC = xmlGetProp(node, (xmlChar*)"name");
xmlChar* styleC = xmlGetProp(node, (xmlChar*)"style"); xmlChar* styleC = xmlGetProp(node, (xmlChar*)"style");
if (nameC && styleC) { if (nameC && styleC) {
Name iName ((const char*)nameC); const std::string& iName ((const char*)nameC);
Name styleName ((const char*)styleC); const std::string& styleName ((const char*)styleC);
layout->addInstance(iName, styleName); layout->addInstance(iName, styleName);
} else { } else {
throw OpenChamsException("[ERROR] 'instance' node in 'layout' must have 'name' and 'style' properties."); throw OpenChamsException("[ERROR] 'instance' node in 'layout' must have 'name' and 'style' properties.");
@ -1007,7 +1022,7 @@ namespace OpenChams {
if (!nameC) if (!nameC)
throw OpenChamsException("[ERROR] 'bloc' and 'group' nodes in 'hbtree' must have at least a 'name' property."); throw OpenChamsException("[ERROR] 'bloc' and 'group' nodes in 'hbtree' must have at least a 'name' property.");
Node* nodeOC = NULL; Node* nodeOC = NULL;
Name name ((const char*)nameC); const std::string& name ((const char*)nameC);
Node::Position pos = Node::NONE; Node::Position pos = Node::NONE;
if (posiC) { if (posiC) {
string posStr ((const char*)posiC); string posStr ((const char*)posiC);
@ -1097,8 +1112,8 @@ namespace OpenChams {
xmlChar* technoNameC = xmlGetProp(rootElement, (xmlChar*)"techno"); xmlChar* technoNameC = xmlGetProp(rootElement, (xmlChar*)"techno");
if (circuitNameC && technoNameC) { if (circuitNameC && technoNameC) {
Name circuitName ((const char*)circuitNameC); const std::string& circuitName ((const char*)circuitNameC);
Name technoName ((const char*)technoNameC); const std::string& technoName ((const char*)technoNameC);
cir = new Circuit(circuitName, technoName); cir = new Circuit(circuitName, technoName);
} else { } else {
throw OpenChamsException("[ERROR] 'circuit' node must have 'name' and 'techno' properties."); throw OpenChamsException("[ERROR] 'circuit' node must have 'name' and 'techno' properties.");
@ -1208,7 +1223,7 @@ namespace OpenChams {
Bloc* bloc = dynamic_cast<Bloc*>(node); Bloc* bloc = dynamic_cast<Bloc*>(node);
if (bloc) { if (bloc) {
file << "<bloc name=\"" << bloc->getName().getString() << "\""; file << "<bloc name=\"" << bloc->getName() << "\"";
if (pos != "") if (pos != "")
file << " position=\"" << pos << "\""; file << " position=\"" << pos << "\"";
if (bloc->getTop() == NULL && bloc->getRight() == NULL) if (bloc->getTop() == NULL && bloc->getRight() == NULL)
@ -1236,7 +1251,7 @@ namespace OpenChams {
default: default:
break; break;
} }
file << "<group name=\"" << group->getName().getString() << "\""; file << "<group name=\"" << group->getName() << "\"";
if (pos != "") file << " position=\"" << pos << "\""; if (pos != "") file << " position=\"" << pos << "\"";
if (align != "") file << " align=\"" << align << "\""; if (align != "") file << " align=\"" << align << "\"";
if (group->isIsolated()) file << " isolated=\"true\""; if (group->isIsolated()) file << " isolated=\"true\"";
@ -1279,7 +1294,7 @@ namespace OpenChams {
} }
file << "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" << endl file << "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" << endl
<< "<circuit name=\"" << _name.getString() << "\" techno=\"" << _techno.getString() << "\">" << endl; << "<circuit name=\"" << _name << "\" techno=\"" << _techno << "\">" << endl;
if (_subCircuitsPaths.size() != 0) { if (_subCircuitsPaths.size() != 0) {
file << " <subCircuitsPaths>" << endl; file << " <subCircuitsPaths>" << endl;
for (size_t i = 0 ; i < _subCircuitsPaths.size() ; i++ ) { for (size_t i = 0 ; i < _subCircuitsPaths.size() ; i++ ) {
@ -1289,8 +1304,8 @@ namespace OpenChams {
} }
if (!_params.isEmpty()) { if (!_params.isEmpty()) {
file << " <parameters>" << endl; file << " <parameters>" << endl;
for (map<Name,string>::const_iterator it = _params.getValues().begin() ; it != _params.getValues().end() ; ++it) { for (map<string,string>::const_iterator it = _params.getValues().begin() ; it != _params.getValues().end() ; ++it) {
file << " <parameter name=\"" << (*it).first.getString() << "\" value=\"" << (*it).second << "\"/>" << endl; file << " <parameter name=\"" << (*it).first << "\" value=\"" << (*it).second << "\"/>" << endl;
} }
cerr << "_params.getValues().size() = " << _params.getValues().size() << endl; cerr << "_params.getValues().size() = " << _params.getValues().size() << endl;
file << " </parameters>" << endl; file << " </parameters>" << endl;
@ -1304,34 +1319,34 @@ namespace OpenChams {
Device* dev = dynamic_cast<Device*>(inst); Device* dev = dynamic_cast<Device*>(inst);
if (inst->hasNoConnectors()) { if (inst->hasNoConnectors()) {
string error("[ERROR] Cannot writeToFile since instance ("); string error("[ERROR] Cannot writeToFile since instance (");
error += inst->getName().getString(); error += inst->getName();
error += ") has no connectors !"; error += ") has no connectors !";
throw OpenChamsException(error); throw OpenChamsException(error);
//return false; //return false;
} }
if (dev && dev->hasNoTransistors()) { if (dev && dev->hasNoTransistors()) {
string error("[ERROR] Cannot writeToFile since device instance ("); string error("[ERROR] Cannot writeToFile since device instance (");
error += dev->getName().getString(); error += dev->getName();
error += ") has no transistors !"; error += ") has no transistors !";
throw OpenChamsException(error); throw OpenChamsException(error);
} }
if (dev) { if (dev) {
string sourceBulkStr = (dev->isSourceBulkConnected()) ? "True" : "False"; string sourceBulkStr = (dev->isSourceBulkConnected()) ? "True" : "False";
file << " <instance name=\"" << dev->getName().getString() << "\" model=\"" << dev->getModel().getString() << "\" mostype=\"" << dev->getMosType().getString() << "\" sourceBulkConnected=\"" << sourceBulkStr << "\" order=\"" << dev->getOrder() << "\">" << endl; file << " <instance name=\"" << dev->getName() << "\" model=\"" << dev->getModel() << "\" mostype=\"" << dev->getMosType() << "\" sourceBulkConnected=\"" << sourceBulkStr << "\" order=\"" << dev->getOrder() << "\">" << endl;
} else { } else {
file << " <instance name=\"" << inst->getName().getString() << "\" model=\"" << inst->getModel().getString() << "\" order=\"" << inst->getOrder() << "\">" << endl; file << " <instance name=\"" << inst->getName() << "\" model=\"" << inst->getModel() << "\" order=\"" << inst->getOrder() << "\">" << endl;
} }
file << " <connectors>" << endl; file << " <connectors>" << endl;
for (map<Name, Net*>::const_iterator it = inst->getConnectors().begin() ; it != inst->getConnectors().end() ; ++it) { for (map<string, Net*>::const_iterator it = inst->getConnectors().begin() ; it != inst->getConnectors().end() ; ++it) {
file << " <connector name=\"" << (*it).first.getString() << "\"/>" << endl; file << " <connector name=\"" << (*it).first << "\"/>" << endl;
} }
file << " </connectors>" << endl; file << " </connectors>" << endl;
if (dev) { if (dev) {
file << " <transistors>" << endl; file << " <transistors>" << endl;
for (vector<Transistor*>::const_iterator it = dev->getTransistors().begin() ; it != dev->getTransistors().end() ; ++it ) { for (vector<Transistor*>::const_iterator it = dev->getTransistors().begin() ; it != dev->getTransistors().end() ; ++it ) {
Transistor* tr = (*it); Transistor* tr = (*it);
file << " <transistor name=\"" << tr->getName().getString() << "\">" << endl file << " <transistor name=\"" << tr->getName() << "\">" << endl
<< " <connection gate=\"" << tr->getGate().getString() << "\" source=\"" << tr->getSource().getString() << "\" drain=\"" << tr->getDrain().getString() << "\" bulk=\"" << tr->getBulk().getString() << "\"/>" << endl << " <connection gate=\"" << tr->getGate() << "\" source=\"" << tr->getSource() << "\" drain=\"" << tr->getDrain() << "\" bulk=\"" << tr->getBulk() << "\"/>" << endl
<< " </transistor>" << endl; << " </transistor>" << endl;
} }
file << " </transistors>" << endl; file << " </transistors>" << endl;
@ -1339,8 +1354,8 @@ namespace OpenChams {
if (!inst->getParameters().isEmpty()) { if (!inst->getParameters().isEmpty()) {
Parameters params = inst->getParameters(); Parameters params = inst->getParameters();
file << " <parameters>" << endl; file << " <parameters>" << endl;
for (map<Name,string>::const_iterator it = params.getValues().begin() ; it != params.getValues().end() ; ++it) { for (map<string,string>::const_iterator it = params.getValues().begin() ; it != params.getValues().end() ; ++it) {
file << " <parameter name=\"" << (*it).first.getString() << "\" value=\"" << (*it).second << "\"/>" << endl; file << " <parameter name=\"" << (*it).first << "\" value=\"" << (*it).second << "\"/>" << endl;
} }
file << " </parameters>" << endl; file << " </parameters>" << endl;
} }
@ -1355,7 +1370,7 @@ namespace OpenChams {
Net* net = (*it); Net* net = (*it);
if (net->hasNoConnections()) { if (net->hasNoConnections()) {
string error("[ERROR] Cannot writeToFile since net ("); string error("[ERROR] Cannot writeToFile since net (");
error += net->getName().getString(); error += net->getName();
error += ") has no connectors !"; error += ") has no connectors !";
throw OpenChamsException(error); throw OpenChamsException(error);
//return false; //return false;
@ -1363,11 +1378,11 @@ namespace OpenChams {
if (!net->hasNoPorts() || !net->hasNoWires()) if (!net->hasNoPorts() || !net->hasNoWires())
schematicNets = true; schematicNets = true;
string externStr = (net->isExternal()) ? "True" : "False"; string externStr = (net->isExternal()) ? "True" : "False";
file << " <net name=\"" << net->getName().getString() << "\" type=\"" << net->getType().getString() << "\" isExternal=\"" << externStr << "\">" << endl; file << " <net name=\"" << net->getName() << "\" type=\"" << net->getType() << "\" isExternal=\"" << externStr << "\">" << endl;
vector<Net::Connection*> connections = net->getConnections(); vector<Net::Connection*> connections = net->getConnections();
sort(connections.begin(), connections.end(), ConnectionsSort); sort(connections.begin(), connections.end(), ConnectionsSort);
for (vector<Net::Connection*>::iterator it = connections.begin() ; it != connections.end() ; ++it) { for (vector<Net::Connection*>::iterator it = connections.begin() ; it != connections.end() ; ++it) {
file << " <connector instance=\"" << (*it)->getInstanceName().getString() << "\" name=\"" << (*it)->getConnectorName().getString() << "\"/>" << endl; file << " <connector instance=\"" << (*it)->getInstanceName() << "\" name=\"" << (*it)->getConnectorName() << "\"/>" << endl;
} }
file << " </net>" << endl; file << " </net>" << endl;
} }
@ -1375,21 +1390,21 @@ namespace OpenChams {
file << " </netlist>" << endl; file << " </netlist>" << endl;
if (_schematic && !_schematic->hasNoInstances()) { if (_schematic && !_schematic->hasNoInstances()) {
file << " <schematic>" << endl; file << " <schematic>" << endl;
for (map<Name, Schematic::Infos*>::const_iterator it = _schematic->getInstances().begin() ; it != _schematic->getInstances().end(); ++it ) { for (map<string, Schematic::Infos*>::const_iterator it = _schematic->getInstances().begin() ; it != _schematic->getInstances().end(); ++it ) {
Schematic::Infos* infos = (*it).second; Schematic::Infos* infos = (*it).second;
file << " <instance name=\"" << ((*it).first).getString() << "\" x=\"" << infos->getX() << "\" y=\"" << infos->getY() << "\" orient=\"" << infos->getOrientation().getString() << "\"/>" << endl; file << " <instance name=\"" << ((*it).first) << "\" x=\"" << infos->getX() << "\" y=\"" << infos->getY() << "\" orient=\"" << infos->getOrientation() << "\"/>" << endl;
} }
if (schematicNets) { if (schematicNets) {
for (size_t i = 0 ; i < nets.size() ; i++) { for (size_t i = 0 ; i < nets.size() ; i++) {
Net* net = nets[i]; Net* net = nets[i];
if (net->hasNoPorts() && net->hasNoWires()) if (net->hasNoPorts() && net->hasNoWires())
continue; continue;
file << " <net name=\"" << net->getName().getString() << "\">" << endl; file << " <net name=\"" << net->getName() << "\">" << endl;
for (size_t j = 0 ; j < net->getPorts().size() ; j++) { for (size_t j = 0 ; j < net->getPorts().size() ; j++) {
Port* port = net->getPorts()[j]; Port* port = net->getPorts()[j];
if (!port) if (!port)
continue; continue;
file << " <port type=\"" << port->getType().getString() << "\" idx=\"" << port->getIndex() << "\" x=\"" << port->getX() << "\" y=\"" << port->getY() << "\" orient=\"" << port->getOrientation().getString() << "\"/>" << endl; file << " <port type=\"" << port->getType() << "\" idx=\"" << port->getIndex() << "\" x=\"" << port->getX() << "\" y=\"" << port->getY() << "\" orient=\"" << port->getOrientation() << "\"/>" << endl;
} }
for (size_t j = 0 ; j < net->getWires().size() ; j++) { for (size_t j = 0 ; j < net->getWires().size() ; j++) {
Wire* wire = net->getWires()[j]; Wire* wire = net->getWires()[j];
@ -1399,7 +1414,7 @@ namespace OpenChams {
// start point // start point
if (dynamic_cast<InstancePoint*>(start)) { if (dynamic_cast<InstancePoint*>(start)) {
InstancePoint* iP = static_cast<InstancePoint*>(start); InstancePoint* iP = static_cast<InstancePoint*>(start);
file << " <connector name=\"" << iP->getName().getString() << "\" plug=\"" << iP->getPlug().getString() << "\"/>" << endl; file << " <connector name=\"" << iP->getName() << "\" plug=\"" << iP->getPlug() << "\"/>" << endl;
} else if (dynamic_cast<PortPoint*>(start)) { } else if (dynamic_cast<PortPoint*>(start)) {
PortPoint* pP = static_cast<PortPoint*>(start); PortPoint* pP = static_cast<PortPoint*>(start);
file << " <connector idx=\"" << pP->getIndex() << "\"/>" << endl; file << " <connector idx=\"" << pP->getIndex() << "\"/>" << endl;
@ -1414,7 +1429,7 @@ namespace OpenChams {
// end point // end point
if (dynamic_cast<InstancePoint*>(end)) { if (dynamic_cast<InstancePoint*>(end)) {
InstancePoint* iP = static_cast<InstancePoint*>(end); InstancePoint* iP = static_cast<InstancePoint*>(end);
file << " <connector name=\"" << iP->getName().getString() << "\" plug=\"" << iP->getPlug().getString() << "\"/>" << endl; file << " <connector name=\"" << iP->getName() << "\" plug=\"" << iP->getPlug() << "\"/>" << endl;
} else if (dynamic_cast<PortPoint*>(end)) { } else if (dynamic_cast<PortPoint*>(end)) {
PortPoint* pP = static_cast<PortPoint*>(end); PortPoint* pP = static_cast<PortPoint*>(end);
file << " <connector idx=\"" << pP->getIndex() << "\"/>" << endl; file << " <connector idx=\"" << pP->getIndex() << "\"/>" << endl;
@ -1434,19 +1449,19 @@ namespace OpenChams {
file << " <sizing>" << endl; file << " <sizing>" << endl;
if (_sizing && !_sizing->hasNoOperators()) { if (_sizing && !_sizing->hasNoOperators()) {
// file << " <sizing>" << endl; // file << " <sizing>" << endl;
for (map<Name, Operator*>::const_iterator it = _sizing->getOperators().begin() ; it != _sizing->getOperators().end() ; ++it) { for (map<string, Operator*>::const_iterator it = _sizing->getOperators().begin() ; it != _sizing->getOperators().end() ; ++it) {
Operator* op = (*it).second; Operator* op = (*it).second;
string opName = op->getName().getString(); string opName = op->getName();
transform(opName.begin(), opName.end(), opName.begin(), ::toupper); transform(opName.begin(), opName.end(), opName.begin(), ::toupper);
file << " <instance name=\"" << ((*it).first).getString() << "\" operator=\"" << opName << "\" simulModel=\"" << op->getSimulModel().getString() << "\">" << endl; file << " <instance name=\"" << ((*it).first) << "\" operator=\"" << opName << "\" simulModel=\"" << op->getSimulModel() << "\">" << endl;
if (!op->hasNoConstraints()) { if (!op->hasNoConstraints()) {
for (map<Name, Operator::Constraint*>::const_iterator cit = op->getConstraints().begin() ; cit != op->getConstraints().end() ; ++cit) { for (map<string, Operator::Constraint*>::const_iterator cit = op->getConstraints().begin() ; cit != op->getConstraints().end() ; ++cit) {
Operator::Constraint* cn = (*cit).second; Operator::Constraint* cn = (*cit).second;
Name ref = cn->getRef(); const std::string& ref = cn->getRef();
if (ref == Name("")) { if (ref.empty()) {
file << " <constraint param=\"" << ((*cit).first).getString() << "\" refEquation=\"" << cn->getRefParam().getString() << "\" factor=\"" << cn->getFactor() << "\"/>" << endl; file << " <constraint param=\"" << ((*cit).first) << "\" refEquation=\"" << cn->getRefParam() << "\" factor=\"" << cn->getFactor() << "\"/>" << endl;
} else { } else {
file << " <constraint param=\"" << ((*cit).first).getString() << "\" ref=\"" << cn->getRef().getString() << "\" refParam=\"" << cn->getRefParam().getString() << "\" factor=\"" << cn->getFactor() << "\"/>" << endl; file << " <constraint param=\"" << ((*cit).first) << "\" ref=\"" << cn->getRef() << "\" refParam=\"" << cn->getRefParam() << "\" factor=\"" << cn->getFactor() << "\"/>" << endl;
} }
} }
} }
@ -1456,35 +1471,35 @@ namespace OpenChams {
// EQUATIONS // EQUATIONS
if (_sizing && !_sizing->hasNoEquations()) { if (_sizing && !_sizing->hasNoEquations()) {
file << " <equations>" << endl; file << " <equations>" << endl;
// for (map<Name, string>::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) // for (map<string, string>::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it)
// file << " <eq name=\"" << ((*it).first).getString() << "\" equation=\"" << (*it).second << "\"/>" << endl; // file << " <eq name=\"" << ((*it).first) << "\" equation=\"" << (*it).second << "\"/>" << endl;
file << " <cstr_designer>" << endl; file << " <cstr_designer>" << endl;
for(map<Name, Equation*>::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) { for(map<string, Equation*>::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) {
if(dynamic_cast<DesignerCstrOC*>((*it).second)) if(dynamic_cast<DesignerCstrOC*>((*it).second))
file << " <cstr_dsg name=\"" << ((*it).first).getString() << "\" equation=\"" << (*it).second->getEquationStr()[0] << "\"/>" << endl; file << " <cstr_dsg name=\"" << ((*it).first) << "\" equation=\"" << (*it).second->getEquationStr()[0] << "\"/>" << endl;
} }
file << " </cstr_designer>" << endl; file << " </cstr_designer>" << endl;
file << " <cstr_circuit_level>" << endl; file << " <cstr_circuit_level>" << endl;
for(map<Name, Equation*>::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) { for(map<string, Equation*>::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) {
if(dynamic_cast<HighLevelCstr*>((*it).second)) if(dynamic_cast<HighLevelCstr*>((*it).second))
file << " <cstr_cl name=\"" << ((*it).first).getString() << "\" equation=\"" << (*it).second->getEquationStr()[0] << "\"/>" << endl; file << " <cstr_cl name=\"" << ((*it).first) << "\" equation=\"" << (*it).second->getEquationStr()[0] << "\"/>" << endl;
} }
file << " </cstr_circuit_level>" << endl; file << " </cstr_circuit_level>" << endl;
file << " <nrc_cstr>" << endl; file << " <nrc_cstr>" << endl;
for(map<Name, Equation*>::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) { for(map<string, Equation*>::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) {
if(dynamic_cast<NRCCstr*>((*it).second)) { if(dynamic_cast<NRCCstr*>((*it).second)) {
NRCCstr* nrcCstr = (NRCCstr*)((*it).second); NRCCstr* nrcCstr = (NRCCstr*)((*it).second);
file << " <nrc name=\"" << ((*it).first).getString() << "\" param=\"" << nrcCstr->getVoltage() << "\" equation=\"" << (*it).second->getEquationStr()[0] << "\"/>" << endl; file << " <nrc name=\"" << ((*it).first) << "\" param=\"" << nrcCstr->getVoltage() << "\" equation=\"" << (*it).second->getEquationStr()[0] << "\"/>" << endl;
} }
} }
file << " </nrc_cstr>" << endl; file << " </nrc_cstr>" << endl;
file << " <ddps>" << endl; file << " <ddps>" << endl;
for(map<Name, Equation*>::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) { for(map<string, Equation*>::const_iterator it = _sizing->getEquations().begin() ; it != _sizing->getEquations().end() ; ++it) {
if(dynamic_cast<DDP*>((*it).second)) { if(dynamic_cast<DDP*>((*it).second)) {
file << " <ddp_i name=\"" << ((*it).first).getString() << "\">" << endl; file << " <ddp_i name=\"" << ((*it).first) << "\">" << endl;
for(map<int, string>::const_iterator it2 = (*it).second->getEquationStr().begin(); it2!=(*it).second->getEquationStr().end(); ++it2) for(map<int, string>::const_iterator it2 = (*it).second->getEquationStr().begin(); it2!=(*it).second->getEquationStr().end(); ++it2)
file << " <ddp_eq equation=\"" << (*it2).second << "\"/>" << endl; file << " <ddp_eq equation=\"" << (*it2).second << "\"/>" << endl;
file << " </ddp_i>" << endl; file << " </ddp_i>" << endl;
@ -1502,8 +1517,8 @@ namespace OpenChams {
if (_layout) { if (_layout) {
file << " <layout>" << endl; file << " <layout>" << endl;
if (!_layout->hasNoInstance()) { if (!_layout->hasNoInstance()) {
for (map<Name, Name>::const_iterator it = _layout->getInstances().begin() ; it != _layout->getInstances().end() ; ++it) { for (map<string, string>::const_iterator it = _layout->getInstances().begin() ; it != _layout->getInstances().end() ; ++it) {
file << " <instance name=\"" << ((*it).first).getString() << "\" style=\"" << ((*it).second).getString() << "\"/>" << endl; file << " <instance name=\"" << ((*it).first) << "\" style=\"" << ((*it).second) << "\"/>" << endl;
} }
} }
if (Node* root = _layout->getHBTreeRoot()) { if (Node* root = _layout->getHBTreeRoot()) {

View File

@ -1,11 +1,19 @@
/*
* Device.cpp // -*- C++ -*-
* openChams //
* // This file is part of the VLSI SAPD Software.
* Created by damien dupuis on 22/11/10. // Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved
* Copyright 2010 UPMC / LIP6. 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 <iostream> #include <iostream>
using namespace std; using namespace std;
@ -16,19 +24,35 @@ using namespace std;
#include "vlsisapd/openChams/OpenChamsException.h" #include "vlsisapd/openChams/OpenChamsException.h"
namespace OpenChams { 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); Transistor* tr = new Transistor(name, this);
if (!tr) if (!tr)
throw OpenChamsException("[ERROR] Cannot create transistor."); throw OpenChamsException("[ERROR] Cannot create transistor.");
_trans.push_back(tr); _trans.push_back(tr);
return tr; return tr;
} }
}
} // OpenChams namespace

View File

@ -1,11 +1,19 @@
/*
* Instance.cpp // -*- C++ -*-
* openChams //
* // This file is part of the VLSI SAPD Software.
* Created by damien dupuis on 12/01/10. // Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved
* Copyright 2010 UPMC / LIP6. 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 <iostream> #include <iostream>
using namespace std; using namespace std;
@ -15,56 +23,64 @@ using namespace std;
#include "vlsisapd/openChams/Net.h" #include "vlsisapd/openChams/Net.h"
#include "vlsisapd/openChams/OpenChamsException.h" #include "vlsisapd/openChams/OpenChamsException.h"
namespace OpenChams { 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) : _name(name)
, _model(model) , _model(model)
, _order(order) , _order(order)
, _netlist(netlist) , _netlist(netlist)
, _params() , _params()
, _netMap() {} , _netMap()
{ }
Instance::~Instance () Instance::~Instance ()
{ } { }
void Instance::addConnector(Name 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<Name, Net*>::iterator it = _netMap.find(name); // si name n'est pas déjà présent dans la map on ajoute name, NULL (pas de net)
map<string, Net*>::iterator it = _netMap.find(name);
if (it == _netMap.end()) { if (it == _netMap.end()) {
_netMap[name] = NULL; _netMap[name] = NULL;
} }
else { else {
string error("[ERROR] The same instance cannot have several connectors with same name ("); string error("[ERROR] The same instance cannot have several connectors with same name (");
error += name.getString(); error += name;
error += ")."; error += ").";
throw OpenChamsException(error); throw OpenChamsException(error);
} }
} }
void Instance::connect(Name connectorName, Name netName) {
// si connectorName n'est pas déjà présent dans la map : void Instance::connect(const string& connectorName, const string& netName)
// on cherche le net associé a netName dans la netlist (getNet(Name)) {
// on ajoute cName, net a la map // si connectorName n'est pas déjà présent dans la map :
map<Name, Net*>::iterator it = _netMap.find(connectorName); // on cherche le net associé a netName dans la netlist (getNet(const string&))
// on ajoute cName, net a la map
map<string, Net*>::iterator it = _netMap.find(connectorName);
if (it != _netMap.end()) { if (it != _netMap.end()) {
Net* net = _netlist->getNet(netName); Net* net = _netlist->getNet(netName);
if (!net) { if (!net) {
string error("[ERROR] While connecting instance : net ("); string error("[ERROR] While connecting instance : net (");
error += netName.getString(); error += netName;
error += ") does not exist.";
throw OpenChamsException(error);
}
else
_netMap[connectorName] = net;
}
else {
string error("[ERROR] While connecting instance : connector (");
error += connectorName.getString();
error += ") does not exist."; error += ") does not exist.";
throw OpenChamsException(error); 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.

View File

@ -1,32 +1,47 @@
/*
* Layout.cpp
* openChams
*
* Created by damien dupuis on 31/08/10.
* Copyright 2008-2011 UPMC / LIP6. All rights reserved.
*
*/
#include <string> // -*- C++ -*-
using namespace std; //
// 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/Layout.h"
#include "vlsisapd/openChams/Circuit.h" #include "vlsisapd/openChams/Circuit.h"
#include "vlsisapd/openChams/OpenChamsException.h" #include "vlsisapd/openChams/OpenChamsException.h"
using namespace std;
namespace OpenChams { namespace OpenChams {
Layout::Layout(Circuit* circuit): _circuit(circuit), _hbTreeRoot(NULL), _instances() {}
void Layout::addInstance(Name name, Name style) { Layout::Layout ( Circuit* circuit )
map<Name, Name>::iterator it = _instances.find(name); : _circuit (circuit)
, _hbTreeRoot(NULL)
, _instances ()
{ }
void Layout::addInstance ( const string& name, const string& style )
{
map<std::string, std::string>::iterator it = _instances.find(name);
if (it != _instances.end()) { if (it != _instances.end()) {
string error("[ERROR] Cannot set several instances with the same name in 'layout' ("); string error("[ERROR] Cannot set several instances with the same name in 'layout' (");
error += name.getString(); error += name;
error += ")."; error += ").";
throw OpenChamsException(error); throw OpenChamsException(error);
} }
_instances[name] = style; _instances[name] = style;
} }
} // namespace
} // OpenChams namespace.

View File

@ -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<string, unsigned long> Name::_dict;
Name::Name() : _str(NULL) {
map<string, unsigned long>::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<string, unsigned long>::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<string, unsigned long>::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

View File

@ -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/Net.h"
#include "vlsisapd/openChams/Instance.h" #include "vlsisapd/openChams/Instance.h"
@ -16,47 +22,63 @@ using namespace std;
#include "vlsisapd/openChams/Wire.h" #include "vlsisapd/openChams/Wire.h"
#include "vlsisapd/openChams/OpenChamsException.h" #include "vlsisapd/openChams/OpenChamsException.h"
using namespace std;
namespace OpenChams { namespace OpenChams {
Net::Net(Name netName, Name typeName, bool isExternal, Netlist* netlist)
: _name(netName)
, _typeName(typeName) Net::Net(const std::string& netName, const std::string& typeName, bool isExternal, Netlist* netlist)
, _isExternal(isExternal) : _name (netName)
, _netlist(netlist) , _typeName (typeName)
, _isExternal (isExternal)
, _netlist (netlist)
, _connections() , _connections()
, _ports() , _ports ()
, _wires() , _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)); _connections.push_back(new Net::Connection(instanceName, connectorName));
Instance* inst = _netlist->getInstance(instanceName); Instance* inst = _netlist->getInstance(instanceName);
if (!inst) { if (!inst) {
string error ("[ERROR] While connecting net "); string error ("[ERROR] While connecting net ");
error += _name.getString(); error += _name;
error += " to instance "; error += " to instance ";
error += instanceName.getString(); error += instanceName;
error += ": instance does not exist in netlist !"; error += ": instance does not exist in netlist !";
throw OpenChamsException(error); throw OpenChamsException(error);
} else { } 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) while (_ports.size() <= idx)
_ports.push_back(NULL); _ports.push_back(NULL);
if (_ports[idx]) 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); _ports[idx] = new Port(type, idx, x, y, orient);
return _ports[idx]; return _ports[idx];
} }
Wire* Net::addWire() {
Wire* Net::addWire() {
Wire* w = new Wire(); Wire* w = new Wire();
_wires.push_back(w); _wires.push_back(w);
return 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.

View File

@ -1,11 +1,19 @@
/*
* Netlist.cpp // -*- C++ -*-
* openChams //
* // This file is part of the VLSI SAPD Software.
* Created by damien dupuis on 12/01/10. // Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved
* Copyright 2010 UPMC / LIP6. 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 <iostream> #include <iostream>
#include <algorithm> #include <algorithm>
@ -18,77 +26,93 @@ using namespace std;
#include "vlsisapd/openChams/Circuit.h" #include "vlsisapd/openChams/Circuit.h"
#include "vlsisapd/openChams/OpenChamsException.h" #include "vlsisapd/openChams/OpenChamsException.h"
namespace OpenChams { 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<Instance*>::iterator it = _instances.begin() ; it != _instances.end() ; ++it) { for (vector<Instance*>::iterator it = _instances.begin() ; it != _instances.end() ; ++it) {
if ((*it)->getName() == name) { if ((*it)->getName() == name) {
string error("[ERROR] Cannot define two instances with the same name in netlist ("); string error("[ERROR] Cannot define two instances with the same name in netlist (");
error += name.getString(); error += name;
error += ")."; error += ").";
throw OpenChamsException(error); throw OpenChamsException(error);
} }
} }
Instance* inst = new Instance(name, model, order, this); Instance* inst = new Instance(name, model, order, this);
if (!inst) if (!inst)
throw OpenChamsException("[ERROR] Cannot create instance."); throw OpenChamsException("[ERROR] Cannot create instance.");
_instances.push_back(inst); _instances.push_back(inst);
return 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<Instance*>::iterator it = _instances.begin() ; it != _instances.end() ; ++it) { for (vector<Instance*>::iterator it = _instances.begin() ; it != _instances.end() ; ++it) {
if ((*it)->getName() == name) { if ((*it)->getName() == name) {
string error("[ERROR] Cannot define two instances with the same name in netlist ("); string error("[ERROR] Cannot define two instances with the same name in netlist (");
error += name.getString(); error += name;
error += ")."; error += ").";
throw OpenChamsException(error); throw OpenChamsException(error);
} }
} }
Device* dev = new Device(name, model, order, mosType, sourceBulkConnected, this); Device* dev = new Device(name, model, order, mosType, sourceBulkConnected, this);
if (!dev) if (!dev)
throw OpenChamsException("[ERROR] Cannot create device."); throw OpenChamsException("[ERROR] Cannot create device.");
_instances.push_back(dev); _instances.push_back(dev);
return 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<Net*>::iterator it = _nets.begin() ; it != _nets.end() ; ++it ) { for (vector<Net*>::iterator it = _nets.begin() ; it != _nets.end() ; ++it ) {
if ((*it)->getName() == name) { if ((*it)->getName() == name) {
string error("[ERROR] Cannot define two nets with the same name in netlist ("); string error("[ERROR] Cannot define two nets with the same name in netlist (");
error += name.getString(); error += name;
error += ")."; error += ").";
throw OpenChamsException(error); throw OpenChamsException(error);
} }
} }
Net* net = new Net(name, type, external, this); Net* net = new Net(name, type, external, this);
if (!net) if (!net)
throw OpenChamsException("[ERROR] Cannot create net."); throw OpenChamsException("[ERROR] Cannot create net.");
_nets.push_back(net); _nets.push_back(net);
return net; return net;
} }
Instance* Netlist::getInstance(Name instanceName) {
for (size_t i = 0 ; i < _instances.size() ; ++i) { Instance* Netlist::getInstance(const std::string& instanceName)
if (_instances[i]->getName() == instanceName) { {
return _instances[i]; for (size_t i = 0 ; i < _instances.size() ; ++i) {
} if (_instances[i]->getName() == instanceName) {
} return _instances[i];
return NULL; }
} }
return NULL;
Net* Netlist::getNet(Name netName) { }
for (size_t i = 0; i < _nets.size(); ++i) {
if (_nets[i]->getName() == netName) {
return _nets[i]; Net* Netlist::getNet(const std::string& netName) {
} for (size_t i = 0; i < _nets.size(); ++i) {
} if (_nets[i]->getName() == netName) {
return NULL; return _nets[i];
} }
} // namespace }
return NULL;
}
} // OpenChams namespace.

View File

@ -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" #include "vlsisapd/openChams/Node.h"
using namespace std;
namespace OpenChams { 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) , _position(pos)
, _parent(parent) , _parent (parent)
, _right(NULL) , _right (NULL)
, _top(NULL) , _top (NULL)
{} { }
Bloc::Bloc(Name blocName, Position pos, Node* parent)
: Node(blocName, pos, parent)
{}
Group::Group(Name groupName, Position pos, Node* parent) Bloc::Bloc(const string& blocName, Position pos, Node* parent)
: Node(groupName, pos, parent) : Node(blocName,pos,parent)
, _isolated(false) { }
, _paired(false)
, _align(Group::NONE)
{}
} // namespace
Group::Group(const string& groupName, Position pos, Node* parent)
: Node(groupName,pos,parent)
, _isolated(false)
, _paired(false)
, _align(Group::NONE)
{ }
} // OpenChams namespace.

View File

@ -1,11 +1,19 @@
/*
* Operator.cpp // -*- C++ -*-
* openChams //
* // This file is part of the VLSI SAPD Software.
* Created by damien dupuis on 08/02/10. // Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved
* Copyright 2010 UPMC / LIP6. 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 <string> #include <string>
using namespace std; using namespace std;
@ -13,44 +21,56 @@ using namespace std;
#include "vlsisapd/openChams/Operator.h" #include "vlsisapd/openChams/Operator.h"
#include "vlsisapd/openChams/OpenChamsException.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) { namespace OpenChams {
map<Name, Constraint*>::iterator it = _constraints.find(paramName);
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<string, Constraint*>::iterator it = _constraints.find(paramName);
if (it != _constraints.end()) { if (it != _constraints.end()) {
string error("[ERROR] Cannot set two constraints for the same parameter ("); string error("[ERROR] Cannot set two constraints for the same parameter (");
error += paramName.getString(); error += paramName;
error += ")."; error += ").";
throw OpenChamsException(error); throw OpenChamsException(error);
} }
_constraints[paramName] = new Operator::Constraint(ref, refParam, factor); _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<Name, Constraint*>::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<string, Constraint*>::iterator it = _constraints.find(paramName);
if (it != _constraints.end()) { if (it != _constraints.end()) {
string error("[ERROR] Cannot set two constraints for the same parameter ("); string error("[ERROR] Cannot set two constraints for the same parameter (");
error += paramName.getString(); error += paramName;
error += ")."; error += ").";
throw OpenChamsException(error); throw OpenChamsException(error);
} }
_constraints[paramName] = new Operator::Constraint(Name(""), refEquation, factor); _constraints[paramName] = new Operator::Constraint("", refEquation, factor);
} }
Operator::Constraint::Constraint(Name ref, Name refParam, double factor)
: _ref(ref) Operator::Constraint::Constraint(const string& ref, const string& refParam, double factor)
, _refParam(refParam) : _ref (ref)
, _factor(factor) {} , _refParam(refParam)
} // namespace , _factor (factor)
{ }
} // OpenChams namespace.

View File

@ -18,19 +18,18 @@
#include <iostream> #include <iostream>
using namespace std; using namespace std;
#include "vlsisapd/openChams/Name.h"
#include "vlsisapd/openChams/Parameters.h" #include "vlsisapd/openChams/Parameters.h"
#include "vlsisapd/openChams/OpenChamsException.h" #include "vlsisapd/openChams/OpenChamsException.h"
namespace OpenChams { namespace OpenChams {
void Parameters::addParameter ( Name name, const char* value ) void Parameters::addParameter ( const string& name, const string& value )
{ {
map<Name,string>::iterator it = _params.find(name); map<string,string>::iterator it = _params.find(name);
if ( it != _params.end() ) { if ( it != _params.end() ) {
string error("[ERROR] Cannot addParameter "); string error("[ERROR] Cannot addParameter ");
error += name.getString(); error += name;
error += " because it already exists !"; error += " because it already exists !";
throw OpenChamsException(error); throw OpenChamsException(error);
} }
@ -38,12 +37,12 @@ namespace OpenChams {
} }
const string& Parameters::getValue ( Name name ) const string& Parameters::getValue ( const string& name )
{ {
map<Name,string>::iterator it = _params.find(name); map<string,string>::iterator it = _params.find(name);
if (it == _params.end()) { if (it == _params.end()) {
string error("[ERROR] No parameters named "); string error("[ERROR] No parameters named ");
error += name.getString(); error += name;
throw OpenChamsException(error); throw OpenChamsException(error);
} }
return (*it).second; return (*it).second;

View File

@ -4,7 +4,6 @@ using namespace std;
#include <boost/python/suite/indexing/vector_indexing_suite.hpp> #include <boost/python/suite/indexing/vector_indexing_suite.hpp>
using namespace boost::python; using namespace boost::python;
#include "vlsisapd/openChams/Name.h"
#include "vlsisapd/openChams/Parameters.h" #include "vlsisapd/openChams/Parameters.h"
#include "vlsisapd/openChams/Transistor.h" #include "vlsisapd/openChams/Transistor.h"
#include "vlsisapd/openChams/Instance.h" #include "vlsisapd/openChams/Instance.h"
@ -31,30 +30,15 @@ void translator(OpenChamsException const& e) {
} }
BOOST_PYTHON_MODULE(OPENCHAMS) { BOOST_PYTHON_MODULE(OPENCHAMS) {
// class OpenChams::Name
class_<Name>("Name", init<std::string>())
.def(init<>())
// accessors
.def("getString", &Name::getString, return_value_policy<copy_const_reference>()) // return_value_policy because this method return a refenrce on string
.def("__repr__" , &Name::getString, return_value_policy<copy_const_reference>()) // automatic print for Name object
// operators
.def(self == self)
.def(self == std::string())
.def(self < self)
;
implicitly_convertible<std::string, Name>();
// map wrapping for OpenChams::Parameters // map wrapping for OpenChams::Parameters
STL_MAP_WRAPPING(Name, std::string, "ValuesMap") STL_MAP_WRAPPING(std::string, std::string, "ValuesMap")
// class OpenChams::Parameters // class OpenChams::Parameters
class_<Parameters>("Parameters", init<>()) class_<Parameters>("Parameters", init<>())
// accessors // accessors
.def("getValue" , &Parameters::getValue, return_value_policy<copy_const_reference>()) .def("getValue" , &Parameters::getValue, return_value_policy<copy_const_reference>())
.def("isEmpty" , &Parameters::isEmpty ) .def("isEmpty" , &Parameters::isEmpty )
// modifiers // modifiers
.def("addParameter", static_cast<void(Parameters::*)(Name, const char*)>(&Parameters::addParameter)) .def("addParameter", static_cast<void(Parameters::*)(const std::string&, const std::string&)>(&Parameters::addParameter))
.def("addParameter", static_cast<void(Parameters::*)(Name, const std::string&)>(&Parameters::addParameter))
// stl containers // stl containers
.def("getValues" , &Parameters::getValues , return_value_policy<copy_const_reference>()) .def("getValues" , &Parameters::getValues , return_value_policy<copy_const_reference>())
; ;
@ -84,26 +68,26 @@ BOOST_PYTHON_MODULE(OPENCHAMS) {
} }
// class OpenChams::Transistor // class OpenChams::Transistor
class_<Transistor, Transistor*>("Transistor", init<Name, Instance*>()) class_<Transistor, Transistor*>("Transistor", init<const std::string&, Instance*>())
// properties // properties
.add_property("name" , &Transistor::getName , &Transistor::setName ) .add_property("name" , make_function(&Transistor::getName ,return_value_policy<copy_const_reference>()), &Transistor::setName )
.add_property("gate" , &Transistor::getGate , &Transistor::setGate ) .add_property("gate" , make_function(&Transistor::getGate ,return_value_policy<copy_const_reference>()), &Transistor::setGate )
.add_property("source" , &Transistor::getSource , &Transistor::setSource) .add_property("source" , make_function(&Transistor::getSource,return_value_policy<copy_const_reference>()), &Transistor::setSource)
.add_property("drain" , &Transistor::getDrain , &Transistor::setDrain ) .add_property("drain" , make_function(&Transistor::getDrain ,return_value_policy<copy_const_reference>()), &Transistor::setDrain )
.add_property("bulk" , &Transistor::getBulk , &Transistor::setBulk ) .add_property("bulk" , make_function(&Transistor::getBulk ,return_value_policy<copy_const_reference>()), &Transistor::setBulk )
.add_property("parameters", &Transistor::getParameters ) // no setter => params will be readonly .add_property("parameters", &Transistor::getParameters ) // no setter => params will be readonly
// modifiers // modifiers
.def("addParameter", static_cast<void(Transistor::*)(Name, const char*)>(&Transistor::addParameter)) .def("addParameter", static_cast<void(Transistor::*)(const std::string&, const char*)>(&Transistor::addParameter))
.def("addParameter", static_cast<void(Transistor::*)(Name, const std::string&)>(&Transistor::addParameter)) .def("addParameter", static_cast<void(Transistor::*)(const std::string&, const std::string&)>(&Transistor::addParameter))
; ;
// map wrapping and vector_indexing for OpenChams::Instance // 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 OpenChams::Instance
class_<Instance, Instance*>("Instance", init<Name, Name, unsigned, Netlist*>()) class_<Instance, Instance*>("Instance", init<const std::string&, const std::string&, unsigned, Netlist*>())
// properties // properties
.add_property("name" , &Instance::getName ) .add_property("name" , make_function(&Instance::getName ,return_value_policy<copy_const_reference>()))
.add_property("model" , &Instance::getModel ) .add_property("model" , make_function(&Instance::getModel,return_value_policy<copy_const_reference>()))
.add_property("order" , &Instance::getOrder ) .add_property("order" , &Instance::getOrder )
.add_property("parameters" , &Instance::getParameters ) .add_property("parameters" , &Instance::getParameters )
.add_property("netlist" , make_function(&Instance::getNetlist ,return_value_policy<reference_existing_object>())) //make_function since we need to specify a return value policy .add_property("netlist" , make_function(&Instance::getNetlist ,return_value_policy<reference_existing_object>())) //make_function since we need to specify a return value policy
@ -112,8 +96,8 @@ BOOST_PYTHON_MODULE(OPENCHAMS) {
// modifiers // modifiers
.def("addConnector" , &Instance::addConnector ) .def("addConnector" , &Instance::addConnector )
.def("connect" , &Instance::connect ) .def("connect" , &Instance::connect )
.def("addParameter" , static_cast<void(Transistor::*)(Name, const char*)>(&Transistor::addParameter)) .def("addParameter" , static_cast<void(Transistor::*)(const std::string&, const char*)>(&Transistor::addParameter))
.def("addParameter" , static_cast<void(Transistor::*)(Name, const std::string&)>(&Transistor::addParameter)) .def("addParameter" , static_cast<void(Transistor::*)(const std::string&, const std::string&)>(&Transistor::addParameter))
// stl containers // stl containers
.def("getConnectors" , &Instance::getConnectors , return_internal_reference<>()) .def("getConnectors" , &Instance::getConnectors , return_internal_reference<>())
; ;
@ -123,9 +107,9 @@ BOOST_PYTHON_MODULE(OPENCHAMS) {
.def(vector_indexing_suite<std::vector<Transistor*>, true>()) .def(vector_indexing_suite<std::vector<Transistor*>, true>())
; ;
// class OpenChams::Device // class OpenChams::Device
class_<Device, bases<Instance> >("Device", init<Name, Name, unsigned, Name, bool, Netlist*>()) class_<Device, bases<Instance> >("Device", init<const std::string&, const std::string&, unsigned, const std::string&, bool, Netlist*>())
// properties // properties
.add_property("mosType" , &Device::getMosType ) .add_property("mosType" , make_function(&Device::getMosType,return_value_policy<copy_const_reference>()) )
.add_property("sourceBulkConnected", &Device::isSourceBulkConnected) .add_property("sourceBulkConnected", &Device::isSourceBulkConnected)
// accessors // accessors
.def("hasNoTransistors", &Device::hasNoTransistors) .def("hasNoTransistors", &Device::hasNoTransistors)
@ -136,23 +120,23 @@ BOOST_PYTHON_MODULE(OPENCHAMS) {
; ;
// class OpenChams::Port // class OpenChams::Port
class_<Port, Port*>("Port", init<Name, unsigned, double, double, Name>()) class_<Port, Port*>("Port", init<const std::string&, unsigned, double, double, const std::string&>())
// properties // properties
.add_property("type" , &Port::getType ) .add_property("type" , make_function(&Port::getType,return_value_policy<copy_const_reference>()))
.add_property("index" , &Port::getIndex ) .add_property("index" , &Port::getIndex )
.add_property("x" , &Port::getX ) .add_property("x" , &Port::getX )
.add_property("y" , &Port::getY ) .add_property("y" , &Port::getY )
.add_property("orientation", &Port::getOrientation) .add_property("orientation", make_function(&Port::getOrientation,return_value_policy<copy_const_reference>()))
; ;
// class OpenChams::WirePoint // class OpenChams::WirePoint
class_<WirePoint, WirePoint*>("WirePoint", init<>()) class_<WirePoint, WirePoint*>("WirePoint", init<>())
; ;
// class OpenChams::InstancePoint // class OpenChams::InstancePoint
class_<InstancePoint, bases<WirePoint> >("InstancePoint", init<Name, Name>()) class_<InstancePoint, bases<WirePoint> >("InstancePoint", init<const std::string&, const std::string&>())
// properties // properties
.add_property("name", &InstancePoint::getName) .add_property("name", make_function(&InstancePoint::getName, return_value_policy<copy_const_reference>()))
.add_property("plug", &InstancePoint::getPlug) .add_property("plug", make_function(&InstancePoint::getPlug, return_value_policy<copy_const_reference>()))
; ;
// class OpenChams::PortPoint // class OpenChams::PortPoint
class_<PortPoint, bases<WirePoint> >("PortPoint", init<unsigned>()) class_<PortPoint, bases<WirePoint> >("PortPoint", init<unsigned>())
@ -178,9 +162,9 @@ BOOST_PYTHON_MODULE(OPENCHAMS) {
// accessors // accessors
.def("hasNoIntermediatePoints", &Wire::hasNoIntermediatePoints) .def("hasNoIntermediatePoints", &Wire::hasNoIntermediatePoints)
// modifiers // modifiers
.def("setStartPoint" , static_cast<void(Wire::*)(Name, Name)>(&Wire::setStartPoint)) .def("setStartPoint" , static_cast<void(Wire::*)(const std::string&, const std::string&)>(&Wire::setStartPoint))
.def("setStartPoint" , static_cast<void(Wire::*)(unsigned )>(&Wire::setStartPoint)) .def("setStartPoint" , static_cast<void(Wire::*)(unsigned )>(&Wire::setStartPoint))
.def("setEndPoint" , static_cast<void(Wire::*)(Name, Name)>(&Wire::setEndPoint)) .def("setEndPoint" , static_cast<void(Wire::*)(const std::string&, const std::string&)>(&Wire::setEndPoint))
.def("setEndPoint" , static_cast<void(Wire::*)(unsigned )>(&Wire::setEndPoint)) .def("setEndPoint" , static_cast<void(Wire::*)(unsigned )>(&Wire::setEndPoint))
.def("addIntermediatePoint", &Wire::addIntermediatePoint) .def("addIntermediatePoint", &Wire::addIntermediatePoint)
// stl containers // stl containers
@ -199,10 +183,10 @@ BOOST_PYTHON_MODULE(OPENCHAMS) {
; ;
{ //this scope is used to define Connection as a subclass of Net { //this scope is used to define Connection as a subclass of Net
// class OpenChams::Net // class OpenChams::Net
scope netScope = class_<Net, Net*>("Net", init<Name, Name, bool, Netlist*>()) scope netScope = class_<Net, Net*>("Net", init<const std::string&, const std::string&, bool, Netlist*>())
// properties // properties
.add_property("name" , &Net::getName ) .add_property("name" , make_function(&Net::getName ,return_value_policy<copy_const_reference>()))
.add_property("type" , &Net::getType ) .add_property("type" , make_function(&Net::getType ,return_value_policy<copy_const_reference>()))
.add_property("external", &Net::isExternal) .add_property("external", &Net::isExternal)
.add_property("netlist" , make_function(&Net::getNetlist, return_value_policy<reference_existing_object>())) .add_property("netlist" , make_function(&Net::getNetlist, return_value_policy<reference_existing_object>()))
// accessors // accessors
@ -220,9 +204,9 @@ BOOST_PYTHON_MODULE(OPENCHAMS) {
; ;
// class OpenChams::Net::Connection // class OpenChams::Net::Connection
class_<Net::Connection, Net::Connection*>("Connection", init<Name, Name>()) class_<Net::Connection, Net::Connection*>("Connection", init<const std::string&, const std::string&>())
.add_property("instanceName" , &Net::Connection::getInstanceName ) .add_property("instanceName" , make_function(&Net::Connection::getInstanceName ,return_value_policy<copy_const_reference>()))
.add_property("connectorName", &Net::Connection::getConnectorName) .add_property("connectorName", make_function(&Net::Connection::getConnectorName,return_value_policy<copy_const_reference>()))
; ;
} // end netScope } // end netScope
@ -250,7 +234,7 @@ BOOST_PYTHON_MODULE(OPENCHAMS) {
; ;
// map wrapping for OpenChams::Schematic // 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 { // this scope is used to define Infos as a subclass of Schematic
// class OpenChams::Schematic // class OpenChams::Schematic
scope schematicScope = class_<Schematic, Schematic*>("Schematic", init<Circuit*>()) scope schematicScope = class_<Schematic, Schematic*>("Schematic", init<Circuit*>())
@ -263,43 +247,43 @@ BOOST_PYTHON_MODULE(OPENCHAMS) {
; ;
// class OpenChams::Schematic::Infos // class OpenChams::Schematic::Infos
class_<Schematic::Infos, Schematic::Infos*>("Infos", init<double, double, Name>()) class_<Schematic::Infos, Schematic::Infos*>("Infos", init<double, double, const std::string&>())
.add_property("x" , &Schematic::Infos::getX ) .add_property("x" , &Schematic::Infos::getX )
.add_property("y" , &Schematic::Infos::getY ) .add_property("y" , &Schematic::Infos::getY )
.add_property("orientation", &Schematic::Infos::getOrientation) .add_property("orientation", make_function(&Schematic::Infos::getOrientation,return_value_policy<copy_const_reference>()))
; ;
} // end schematicScope } // end schematicScope
// map wrapping for OpenChams::Operator // 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 { // this scope is used to define Constraint as a subclass of Operator
// class OpenChams::Operator // class OpenChams::Operator
scope operatorScope = class_<Operator, Operator*>("Operator", init<Name, Name>()) scope operatorScope = class_<Operator, Operator*>("Operator", init<const std::string&, const std::string&>())
// properties // properties
.add_property("name" , &Operator::getName ) .add_property("name" , make_function(&Operator::getName , return_value_policy<copy_const_reference>()))
.add_property("simulModel", &Operator::getSimulModel) .add_property("simulModel", make_function(&Operator::getSimulModel, return_value_policy<copy_const_reference>()))
// accessors // accessors
.def("hasNoConstraints", &Operator::hasNoConstraints) .def("hasNoConstraints", &Operator::hasNoConstraints)
// modifiers // modifiers
.def("addConstraint", static_cast<void(Operator::*)(Name, Name )>(&Operator::addConstraint)) .def("addConstraint", static_cast<void(Operator::*)(const std::string&, const std::string& )>(&Operator::addConstraint))
.def("addConstraint", static_cast<void(Operator::*)(Name, Name, double )>(&Operator::addConstraint)) .def("addConstraint", static_cast<void(Operator::*)(const std::string&, const std::string&, double )>(&Operator::addConstraint))
.def("addConstraint", static_cast<void(Operator::*)(Name, Name, Name )>(&Operator::addConstraint)) .def("addConstraint", static_cast<void(Operator::*)(const std::string&, const std::string&, const std::string& )>(&Operator::addConstraint))
.def("addConstraint", static_cast<void(Operator::*)(Name, Name, Name, double)>(&Operator::addConstraint)) .def("addConstraint", static_cast<void(Operator::*)(const std::string&, const std::string&, const std::string&, double)>(&Operator::addConstraint))
// stl containers // stl containers
.def("getConstraints", &Operator::getConstraints, return_internal_reference<>()) .def("getConstraints", &Operator::getConstraints, return_internal_reference<>())
; ;
// class OpenChams::Operator::Constraint // class OpenChams::Operator::Constraint
class_<Operator::Constraint, Operator::Constraint*>("Constraint", init<Name, Name, double>()) class_<Operator::Constraint, Operator::Constraint*>("Constraint", init<const std::string&, const std::string&, double>())
.add_property("ref" , &Operator::Constraint::getRef ) .add_property("ref" , make_function(&Operator::Constraint::getRef , return_value_policy<copy_const_reference>()))
.add_property("refParam", &Operator::Constraint::getRefParam) .add_property("refParam", make_function(&Operator::Constraint::getRefParam, return_value_policy<copy_const_reference>()))
.add_property("factor" , &Operator::Constraint::getFactor ) .add_property("factor" , &Operator::Constraint::getFactor )
; ;
} // end operatorScope } // end operatorScope
/* /*
// map wrapping for OpenChams::Sizing // map wrapping for OpenChams::Sizing
STL_MAP_WRAPPING_PTR(Name, Operator*, "OperatorsMap") STL_MAP_WRAPPING_PTR(std::string, Operator*, "OperatorsMap")
// class OpenChams::Sizing // class OpenChams::Sizing
class_<Sizing, Sizing*>("Sizing", init<Circuit*>()) class_<Sizing, Sizing*>("Sizing", init<Circuit*>())
// accessors // accessors
@ -315,7 +299,7 @@ BOOST_PYTHON_MODULE(OPENCHAMS) {
*/ */
// map wrapping for OpenChams::Layout // map wrapping for OpenChams::Layout
STL_MAP_WRAPPING(Name, Name, "LayoutInstancesMap") STL_MAP_WRAPPING(std::string, std::string, "LayoutInstancesMap")
// class OpenChams::Layout // class OpenChams::Layout
class_<Layout, Layout*>("Layout", init<Circuit*>()) class_<Layout, Layout*>("Layout", init<Circuit*>())
// properties // properties
@ -328,10 +312,10 @@ BOOST_PYTHON_MODULE(OPENCHAMS) {
.def("getInstances", &Layout::getInstances, return_internal_reference<>()) .def("getInstances", &Layout::getInstances, return_internal_reference<>())
; ;
class_<Circuit, Circuit*>("Circuit", init<Name, Name>()) class_<Circuit, Circuit*>("Circuit", init<const std::string&, const std::string&>())
// properties // properties
.add_property("name" , &Circuit::getName ) .add_property("name" , make_function(&Circuit::getName ,return_value_policy<copy_const_reference>()))
.add_property("techno" , &Circuit::getTechno ) .add_property("techno" , make_function(&Circuit::getTechno ,return_value_policy<copy_const_reference>()))
.add_property("parameters" , &Circuit::getParameters ) .add_property("parameters" , &Circuit::getParameters )
.add_property("netlist" , make_function(&Circuit::getNetlist , return_value_policy<reference_existing_object>())) .add_property("netlist" , make_function(&Circuit::getNetlist , return_value_policy<reference_existing_object>()))
.add_property("schematic" , make_function(&Circuit::getSchematic, return_value_policy<reference_existing_object>())) .add_property("schematic" , make_function(&Circuit::getSchematic, return_value_policy<reference_existing_object>()))
@ -344,8 +328,8 @@ BOOST_PYTHON_MODULE(OPENCHAMS) {
.def("createSchematic", &Circuit::createSchematic, return_value_policy<reference_existing_object>()) .def("createSchematic", &Circuit::createSchematic, return_value_policy<reference_existing_object>())
.def("createSizing" , &Circuit::createSizing , return_value_policy<reference_existing_object>()) .def("createSizing" , &Circuit::createSizing , return_value_policy<reference_existing_object>())
.def("createLayout" , &Circuit::createLayout , return_value_policy<reference_existing_object>()) .def("createLayout" , &Circuit::createLayout , return_value_policy<reference_existing_object>())
.def("addParameter", static_cast<void(Circuit::*)(Name, const char*)>(&Circuit::addParameter)) .def("addParameter", static_cast<void(Circuit::*)(const std::string&, const char*)>(&Circuit::addParameter))
.def("addParameter", static_cast<void(Circuit::*)(Name, const std::string&)>(&Circuit::addParameter)) .def("addParameter", static_cast<void(Circuit::*)(const std::string&, const std::string&)>(&Circuit::addParameter))
// others // others
.def("readFromFile", &Circuit::readFromFile, return_value_policy<manage_new_object>()) .def("readFromFile", &Circuit::readFromFile, return_value_policy<manage_new_object>())
.staticmethod("readFromFile") .staticmethod("readFromFile")
@ -359,7 +343,7 @@ BOOST_PYTHON_MODULE(OPENCHAMS) {
.add_property("top" , make_function(&Node::getTop , return_value_policy<reference_existing_object>()), &Node::setTop ) .add_property("top" , make_function(&Node::getTop , return_value_policy<reference_existing_object>()), &Node::setTop )
.add_property("right", make_function(&Node::getRight, return_value_policy<reference_existing_object>()), &Node::setRight) .add_property("right", make_function(&Node::getRight, return_value_policy<reference_existing_object>()), &Node::setRight)
// accessors // accessors
.def("getName" , &Node::getName ) .def("getName" , &Node::getName , return_value_policy<copy_const_reference>())
.def("getPosition", &Node::getPosition) .def("getPosition", &Node::getPosition)
.def("getParent" , &Node::getParent , return_value_policy<reference_existing_object>()) .def("getParent" , &Node::getParent , return_value_policy<reference_existing_object>())
.def("isRoot" , &Node::isRoot ) .def("isRoot" , &Node::isRoot )
@ -374,12 +358,12 @@ BOOST_PYTHON_MODULE(OPENCHAMS) {
} // end of node scope } // end of node scope
// class OpenChams::Bloc // class OpenChams::Bloc
class_<Bloc, bases<Node> >("Bloc", init<Name, optional<Node::Position, Node*> >()) class_<Bloc, bases<Node> >("Bloc", init<const std::string&, optional<Node::Position, Node*> >())
; ;
{ // this scope is used to define Align as a subenum of Group { // this scope is used to define Align as a subenum of Group
// class OpenChams::Group // class OpenChams::Group
scope grou = class_<Group, bases<Node> >("Group", init<Name, optional<Node::Position, Node*> >()) scope grou = class_<Group, bases<Node> >("Group", init<const std::string&, optional<Node::Position, Node*> >())
.add_property("rootNode", make_function(&Group::getRootNode, return_value_policy<reference_existing_object>()), &Group::setRootNode) .add_property("rootNode", make_function(&Group::getRootNode, return_value_policy<reference_existing_object>()), &Group::setRootNode)
.add_property("isolated", &Group::isIsolated, &Group::setIsolated) .add_property("isolated", &Group::isIsolated, &Group::setIsolated)
.add_property("paired" , &Group::isPaired , &Group::setPaired ) .add_property("paired" , &Group::isPaired , &Group::setPaired )

View File

@ -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/Schematic.h"
#include "vlsisapd/openChams/OpenChamsException.h" #include "vlsisapd/openChams/OpenChamsException.h"
using namespace std;
namespace OpenChams { 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) { void Schematic::addInstance ( const string& instanceName
map<Name, Schematic::Infos*>::iterator it = _instances.find(instanceName); , double x
, double y
, const string& orient )
{
map<string, Schematic::Infos*>::iterator it = _instances.find(instanceName);
if (it != _instances.end()) { if (it != _instances.end()) {
string error("[ERROR] Cannot set same instance twice in 'schematic' ("); string error("[ERROR] Cannot set same instance twice in 'schematic' (");
error += instanceName.getString(); error += instanceName;
error += ")."; error += ").";
throw OpenChamsException(error); throw OpenChamsException(error);
} }
_instances[instanceName] = new Schematic::Infos(x, y, orient); _instances[instanceName] = new Schematic::Infos(x, y, orient);
} }
Schematic::Infos::Infos(double x, double y, Name orient) Schematic::Infos::Infos(double x, double y, const string& orient)
: _x(x) : _x (x)
, _y(y) , _y (y)
, _orient(orient) {} , _orient(orient)
} // namespace {}
} // OpenChams namespace.

View File

@ -1,47 +1,66 @@
/*
* Sizing.cpp
* openChams
*
* Created by damien dupuis on 08/02/10.
* Copyright 2010 UPMC / LIP6. All rights reserved.
*
*/
#include <string> // -*- C++ -*-
using namespace std; //
// 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/Sizing.h"
#include "vlsisapd/openChams/Circuit.h" #include "vlsisapd/openChams/Circuit.h"
#include "vlsisapd/openChams/Operator.h" #include "vlsisapd/openChams/Operator.h"
#include "vlsisapd/openChams/Equation.h" #include "vlsisapd/openChams/Equation.h"
#include "vlsisapd/openChams/OpenChamsException.h" #include "vlsisapd/openChams/OpenChamsException.h"
using namespace std;
namespace OpenChams { namespace OpenChams {
Sizing::Sizing(Circuit* circuit): _circuit(circuit) {}
Sizing::Sizing ( Circuit* circuit )
: _circuit(circuit)
{ }
Operator* Sizing::addOperator(Name instanceName, Name operatorName, Name simulModel) {
map<Name, Operator*>::iterator it = _operators.find(instanceName); Operator* Sizing::addOperator ( const string& instanceName
, const string& operatorName
, const string& simulModel )
{
map<string, Operator*>::iterator it = _operators.find(instanceName);
if (it != _operators.end()) { if (it != _operators.end()) {
string error("[ERROR] Cannot set same instance twice in 'sizing' ("); string error("[ERROR] Cannot set same instance twice in 'sizing' (");
error += instanceName.getString(); error += instanceName;
error += ")."; error += ").";
throw OpenChamsException(error); throw OpenChamsException(error);
} }
Operator* op = new Operator(operatorName, simulModel); Operator* op = new Operator(operatorName, simulModel);
_operators[instanceName] = op; _operators[instanceName] = op;
return op; return op;
} }
void Sizing::addEquation(Name equationName, Equation* equation) {
map<Name, Equation*>::iterator it = _equations.find(equationName); void Sizing::addEquation ( const string& equationName, Equation* equation)
{
map<string, Equation*>::iterator it = _equations.find(equationName);
if (it != _equations.end()) { if (it != _equations.end()) {
string error("[ERROR] Cannot set several equations with the same name in 'sizing' ("); string error("[ERROR] Cannot set several equations with the same name in 'sizing' (");
error += equationName.getString(); error += equationName;
error += ")."; error += ").";
throw OpenChamsException(error); throw OpenChamsException(error);
} }
_equations[equationName] = equation; _equations[equationName] = equation;
} }
} // namespace
} // OpenChams namespace

View File

@ -1,11 +1,19 @@
/*
* Transistor.cpp // -*- C++ -*-
* openChams //
* // This file is part of the VLSI SAPD Software.
* Created by damien dupuis on 01/03/10. // Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved
* Copyright 2010 UPMC / LIP6. 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 <iostream> #include <iostream>
using namespace std; using namespace std;
@ -15,47 +23,49 @@ using namespace std;
#include "vlsisapd/openChams/Net.h" #include "vlsisapd/openChams/Net.h"
#include "vlsisapd/openChams/OpenChamsException.h" #include "vlsisapd/openChams/OpenChamsException.h"
namespace OpenChams { 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)) Transistor::Transistor(const std::string& name, Instance* instance)
_drain = drain; : _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) { void Transistor::setBulk(const std::string& bulk)
if (checkConnector(bulk)) { if (checkConnector(bulk)) _bulk = bulk; }
_bulk = bulk;
}
bool Transistor::checkConnector(Name name) {
map<Name, Net*>::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);
}
}
}
bool Transistor::checkConnector(const std::string& name)
{
map<string, Net*>::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.

View File

@ -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/Wire.h"
#include "vlsisapd/openChams/OpenChamsException.h" #include "vlsisapd/openChams/OpenChamsException.h"
using namespace std;
namespace OpenChams { 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); _start = new InstancePoint(name, plug);
} }
void Wire::setStartPoint(unsigned idx) {
void Wire::setStartPoint(unsigned idx)
{
if (_start) 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); _start = new PortPoint(idx);
} }
void Wire::setEndPoint(Name name, Name plug) {
void Wire::setEndPoint(const string& name, const string& plug)
{
if (!_start) 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) 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); _end = new InstancePoint(name, plug);
} }
void Wire::setEndPoint(unsigned idx) {
void Wire::setEndPoint(unsigned idx)
{
if (!_start) 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) 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); _end = new PortPoint(idx);
} }
void Wire::addIntermediatePoint(double x, double y) {
void Wire::addIntermediatePoint(double x, double y)
{
if (!_start) 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) 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)); _inters.push_back(new IntermediatePoint(x, y));
} }
} // namespace
} // OpenChams namespace.

View File

@ -25,7 +25,6 @@
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/tree.h> #include <libxml/tree.h>
#include "vlsisapd/openChams/Name.h"
#include "vlsisapd/openChams/Parameters.h" #include "vlsisapd/openChams/Parameters.h"
#include "vlsisapd/openChams/SimulModel.h" #include "vlsisapd/openChams/SimulModel.h"
@ -45,17 +44,17 @@ namespace OpenChams {
class Circuit { class Circuit {
public: public:
Circuit ( Name, Name techno ); Circuit ( const std::string&, const std::string& techno );
// Accessors. // Accessors.
inline Name getName (); inline const std::string& getName ();
inline Name getTechno (); inline const std::string& getTechno ();
inline const std::string& getValue ( Name ); inline const std::string& getValue ( const std::string& );
inline Netlist* getNetlist (); inline Netlist* getNetlist ();
inline Schematic* getSchematic (); inline Schematic* getSchematic ();
inline Sizing* getSizing (); inline Sizing* getSizing ();
inline Layout* getLayout (); inline Layout* getLayout ();
inline void addParameter ( Name, const char* ); inline void addParameter ( const std::string&, const char* );
inline void addParameter ( Name, const std::string& ); inline void addParameter ( const std::string&, const std::string& );
inline Parameters getParameters (); inline Parameters getParameters ();
inline void addSubCircuitPath ( std::string ); inline void addSubCircuitPath ( std::string );
inline std::vector<std::string>& getSubCircuitPaths (); inline std::vector<std::string>& getSubCircuitPaths ();
@ -76,9 +75,9 @@ namespace OpenChams {
private: private:
// Internal methods (XML parser). // Internal methods (XML parser).
Name readParameter ( xmlNode*, const xmlChar*& ); std::string readParameter ( xmlNode*, const xmlChar*& );
Name readParameterEq ( xmlNode*, std::string& ); std::string readParameterEq ( xmlNode*, std::string& );
Name readConnector ( xmlNode* ); std::string readConnector ( xmlNode* );
void readSubCircuitsPaths ( xmlNode* ); void readSubCircuitsPaths ( xmlNode* );
void readCircuitParameters ( xmlNode* ); void readCircuitParameters ( xmlNode* );
void readSimulModels ( xmlNode* ); void readSimulModels ( xmlNode* );
@ -118,9 +117,9 @@ namespace OpenChams {
void check_lowercase ( std::string& str, std::vector<std::string>& compares, std::string message ); void check_lowercase ( std::string& str, std::vector<std::string>& compares, std::string message );
private: private:
Name _name; const std::string& _name;
std::string _absolutePath; std::string _absolutePath;
Name _techno; const std::string& _techno;
Parameters _params; Parameters _params;
Netlist* _netlist; Netlist* _netlist;
Schematic* _schematic; Schematic* _schematic;
@ -131,15 +130,15 @@ namespace OpenChams {
}; };
inline Name Circuit::getName () { return _name; } inline const std::string& Circuit::getName () { return _name; }
inline Name Circuit::getTechno () { return _techno; } inline const std::string& Circuit::getTechno () { return _techno; }
inline const std::string& Circuit::getValue (Name name) { return _params.getValue(name); } inline const std::string& Circuit::getValue (const std::string& name) { return _params.getValue(name); }
inline Netlist* Circuit::getNetlist () { return _netlist; } inline Netlist* Circuit::getNetlist () { return _netlist; }
inline Schematic* Circuit::getSchematic () { return _schematic; } inline Schematic* Circuit::getSchematic () { return _schematic; }
inline Sizing* Circuit::getSizing () { return _sizing; } inline Sizing* Circuit::getSizing () { return _sizing; }
inline Layout* Circuit::getLayout () { return _layout; } inline Layout* Circuit::getLayout () { return _layout; }
inline void Circuit::addParameter (Name name, const char* value) { _params.addParameter(name, value); } inline void Circuit::addParameter (const std::string& 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 std::string& value) { _params.addParameter(name, value); }
inline Parameters Circuit::getParameters () { return _params; } inline Parameters Circuit::getParameters () { return _params; }
inline void Circuit::addSubCircuitPath (std::string path) { _subCircuitsPaths.push_back(path); } inline void Circuit::addSubCircuitPath (std::string path) { _subCircuitsPaths.push_back(path); }
inline std::vector<std::string>& Circuit::getSubCircuitPaths () { return _subCircuitsPaths; } inline std::vector<std::string>& Circuit::getSubCircuitPaths () { return _subCircuitsPaths; }

View File

@ -1,11 +1,19 @@
/*
* Device.h // -*- C++ -*-
* openChams //
* // This file is part of the VLSI SAPD Software.
* Created by damien dupuis on 22/11/10. // Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved
* Copyright 2010 UPMC / LIP6. 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__ #ifndef __OPENCHAMS_DEVICE_H__
#define __OPENCHAMS_DEVICE_H__ #define __OPENCHAMS_DEVICE_H__
@ -13,37 +21,43 @@
#include <map> #include <map>
#include <vector> #include <vector>
#include "vlsisapd/openChams/Name.h"
#include "vlsisapd/openChams/Instance.h" #include "vlsisapd/openChams/Instance.h"
#include "vlsisapd/openChams/Parameters.h" #include "vlsisapd/openChams/Parameters.h"
namespace OpenChams { namespace OpenChams {
class Netlist;
class Transistor; class Netlist;
class Device : public Instance { class Transistor;
class Device : public Instance {
public: public:
Device(Name name, Name model, unsigned, Name mosType, bool, Netlist*); Device ( const std::string& name
, const std::string& model
virtual ~Device() {}; , unsigned order
, const std::string& mosType
inline Name getMosType(); , bool sourceBulkConnected
inline bool isSourceBulkConnected(); , Netlist* );
// pour parcourir les transistors virtual ~Device ();
inline bool hasNoTransistors(); inline const std::string& getMosType ();
inline const std::vector<Transistor*>& getTransistors(); inline bool isSourceBulkConnected ();
// Pour parcourir les transistors
Transistor* addTransistor(Name); inline bool hasNoTransistors ();
inline const std::vector<Transistor*>& getTransistors ();
Transistor* addTransistor (const std::string&);
private: private:
Name _mosType; const std::string _mosType;
bool _sourceBulkConnected; bool _sourceBulkConnected;
std::vector<Transistor*> _trans; std::vector<Transistor*> _trans;
}; };
inline Name Device::getMosType() { return _mosType; };
inline bool Device::isSourceBulkConnected() { return _sourceBulkConnected; }; inline const std::string& Device::getMosType () { return _mosType; };
inline bool Device::hasNoTransistors() { return (_trans.size() == 0)? true : false; }; inline bool Device::isSourceBulkConnected() { return _sourceBulkConnected; };
inline const std::vector<Transistor*>& Device::getTransistors() { return _trans; }; inline bool Device::hasNoTransistors () { return (_trans.size() == 0)? true : false; };
inline const std::vector<Transistor*>& Device::getTransistors () { return _trans; };
} // namespace } // namespace
#endif #endif

View File

@ -22,7 +22,6 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include "vlsisapd/openChams/Name.h"
#include "vlsisapd/openChams/Parameters.h" #include "vlsisapd/openChams/Parameters.h"
@ -33,41 +32,42 @@ namespace OpenChams {
class Instance { class Instance {
public: public:
Instance (Name name, Name model, unsigned, Netlist*); Instance (const std::string& name, const std::string& model, unsigned, Netlist*);
virtual ~Instance (); virtual ~Instance ();
void addConnector (Name); void addConnector (const std::string&);
void connect (Name connectorName, Name netName); void connect (const std::string& connectorName, const std::string& netName);
inline void addParameter (Name, const char* ); inline void addParameter (const std::string&, const char* );
inline void addParameter (Name, const std::string& ); inline void addParameter (const std::string&, const std::string& );
inline Name getName () const; inline const std::string& getName () const;
inline Name getModel (); inline const std::string& getModel () const;
inline unsigned getOrder (); inline unsigned getOrder ();
inline Netlist* getNetlist (); inline Netlist* getNetlist ();
inline Parameters getParameters (); inline Parameters getParameters ();
inline bool hasNoConnectors (); inline bool hasNoConnectors ();
inline const std::map<Name, Net*>& getConnectors (); inline const std::map<std::string, Net*>&
getConnectors ();
private: private:
Name _name; std::string _name;
Name _model; std::string _model;
unsigned _order; unsigned _order;
Netlist* _netlist; Netlist* _netlist;
Parameters _params; Parameters _params;
std::map<Name, Net*> _netMap; std::map<std::string, Net*> _netMap;
}; };
inline void Instance::addParameter (Name name, const char* value) { _params.addParameter(name,value); }; inline void Instance::addParameter (const std::string& name, const char* value) { _params.addParameter(name,value); };
inline void Instance::addParameter (Name name, const std::string& value) { _params.addParameter(name,value); }; inline void Instance::addParameter (const std::string& name, const std::string& value) { _params.addParameter(name,value); };
inline Name Instance::getName () const { return _name; }; inline const std::string& Instance::getName () const { return _name; };
inline Name Instance::getModel () { return _model; }; inline const std::string& Instance::getModel () const { return _model; };
inline unsigned Instance::getOrder () { return _order; }; inline unsigned Instance::getOrder () { return _order; };
inline Netlist* Instance::getNetlist () { return _netlist; }; inline Netlist* Instance::getNetlist () { return _netlist; };
inline Parameters Instance::getParameters () { return _params; }; inline Parameters Instance::getParameters () { return _params; };
inline bool Instance::hasNoConnectors () { return _netMap.empty(); }; inline bool Instance::hasNoConnectors () { return _netMap.empty(); };
inline const std::map<Name, Net*>& Instance::getConnectors () { return _netMap; }; inline const std::map<std::string, Net*>& Instance::getConnectors () { return _netMap; };
} // OpenChams namespace. } // OpenChams namespace.

View File

@ -1,46 +1,55 @@
/*
* Layout.h // -*- C++ -*-
* openChams //
* // This file is part of the VLSI SAPD Software.
* Created by damien dupuis on 31/08/10. // Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved
* Copyright 2008-2010 UPMC / LIP6. 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__ #ifndef __OPENCHAMS_LAYOUT_H__
#define __OPENCHAMS_LAYOUT_H__ #define __OPENCHAMS_LAYOUT_H__
#include <map> #include <map>
#include <string>
namespace OpenChams { namespace OpenChams {
class Name;
class Circuit;
class Node;
class Layout { class Circuit;
class Node;
class Layout {
public: public:
Layout(Circuit*); Layout (Circuit*);
void addInstance (const std::string& name, const std::string& style);
void addInstance(Name name, Name style); inline bool hasNoInstance ();
inline Node* getHBTreeRoot ();
inline bool hasNoInstance(); inline void setHBTreeRoot (Node*);
inline const std::map<Name, Name>& getInstances(); inline const std::map<std::string, std::string>& getInstances();
inline Node* getHBTreeRoot();
inline void setHBTreeRoot(Node*);
private: private:
Circuit* _circuit; Circuit* _circuit;
Node* _hbTreeRoot; Node* _hbTreeRoot;
std::map<Name, Name> _instances; // device name <-> style (name) std::map<std::string, std::string> _instances; // device name <-> style (name)
}; };
inline bool Layout::hasNoInstance() { return (_instances.size() == 0) ? true : false; };
inline const std::map<Name, Name>& Layout::getInstances() { return _instances; };
inline Node* Layout::getHBTreeRoot() { return _hbTreeRoot; } inline bool Layout::hasNoInstance () { return _instances.empty(); };
inline void Layout::setHBTreeRoot(Node* root) { _hbTreeRoot = root; } inline Node* Layout::getHBTreeRoot () { return _hbTreeRoot; }
inline void Layout::setHBTreeRoot (Node* root) { _hbTreeRoot = root; }
inline const std::map<std::string, std::string>& Layout::getInstances() { return _instances; }
} // namespace } // namespace
#endif #endif

View File

@ -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 <string>
#include <map>
#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<std::string, unsigned long> _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

View File

@ -1,85 +1,88 @@
/*
* Net.h // -*- C++ -*-
* openChams //
* // This file is part of the VLSI SAPD Software.
* Created by damien dupuis on 12/01/10. // Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved
* Copyright 2010 UPMC / LIP6. 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__ #ifndef __OPENCHAMS_NET_H__
#define __OPENCHAMS_NET_H__ #define __OPENCHAMS_NET_H__
#include <vector> #include <vector>
#include <string>
#include "vlsisapd/openChams/Name.h"
namespace OpenChams { namespace OpenChams {
class Netlist;
class Port; class Netlist;
class Wire; class Port;
class Net { class Wire;
class Net {
public: public:
class Connection { class Connection {
public: public:
Connection(Name instanceName, Name connectorName); Connection (const std::string& instanceName, const std::string& connectorName);
inline const std::string& getInstanceName () const;
inline Name getInstanceName() const; inline const std::string& getConnectorName() const;
inline Name getConnectorName() const;
private: private:
Name _instanceName; const std::string& _instanceName;
Name _connectorName; const std::string& _connectorName;
}; };
public: public:
Net(Name netName, Name typeName, bool, Netlist*); Net (const std::string& netName, const std::string& typeName, bool, Netlist*);
void connectTo (const std::string& instanceName, const std::string& connectorName);
void connectTo(Name instanceName, Name connectorName); inline const std::string& getName () const;
inline const std::string& getType ();
inline Name getName() const; inline bool isExternal ();
inline Name getType(); inline Netlist* getNetlist ();
inline bool isExternal(); inline bool hasNoConnections ();
inline Netlist* getNetlist(); inline const std::vector<Net::Connection*>& getConnections();
inline bool hasNoConnections();
//inline vector<pair<Name, Name> >::iterator getFirstConnectionIt();
//inline vector<pair<Name, Name> >::iterator getLastConnectionIt();
inline const std::vector<Net::Connection*>& getConnections();
// schematic relative methods // schematic relative methods
Port* addPort(Name type, unsigned idx, double x, double y, Name orient); Port* addPort (const std::string& type, unsigned idx, double x, double y, const std::string& orient);
Wire* addWire(); Wire* addWire ();
inline bool hasNoPorts(); inline bool hasNoPorts ();
inline const std::vector<Port*>& getPorts(); inline const std::vector<Port*>& getPorts ();
inline bool hasNoWires(); inline bool hasNoWires ();
inline const std::vector<Wire*>& getWires(); inline const std::vector<Wire*>& getWires ();
private: private:
Name _name; const std::string& _name;
Name _typeName; const std::string& _typeName;
bool _isExternal; bool _isExternal;
Netlist* _netlist; Netlist* _netlist;
std::vector<Net::Connection*> _connections; // <instanceName, connectorName> std::vector<Net::Connection*> _connections; // <instanceName, connectorName>
// schematic relative members // schematic relative members
std::vector<Port*> _ports; std::vector<Port*> _ports;
std::vector<Wire*> _wires; std::vector<Wire*> _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<pair<Name, Name> >::iterator Net::getFirstConnectionIt() { return _connections.begin();};
//inline vector<pair<Name, Name> >::iterator Net::getLastConnectionIt() { return _connections.end();};
inline const std::vector<Net::Connection*>& Net::getConnections() { return _connections; }
inline bool Net::hasNoPorts() { return (_ports.size() == 0)? true : false; }
inline const std::vector<Port*>& Net::getPorts() { return _ports; }
inline bool Net::hasNoWires() { return (_wires.size() == 0)? true : false; }
inline const std::vector<Wire*>& Net::getWires() { return _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::Connection*>& Net::getConnections() { return _connections; }
inline bool Net::hasNoPorts () { return (_ports.size() == 0)? true : false; }
inline const std::vector<Port*>& Net::getPorts () { return _ports; }
inline bool Net::hasNoWires () { return (_wires.size() == 0)? true : false; }
inline const std::vector<Wire*>& 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 } // namespace
#endif #endif

View File

@ -1,11 +1,19 @@
/*
* NetList.h // -*- C++ -*-
* openChams //
* // This file is part of the VLSI SAPD Software.
* Created by damien dupuis on 12/01/10. // Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved
* Copyright 2010 UPMC / LIP6. 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__ #ifndef __OPENCHAMS_NETLIST_H__
#define __OPENCHAMS_NETLIST_H__ #define __OPENCHAMS_NETLIST_H__
@ -13,41 +21,41 @@
#include <vector> #include <vector>
namespace OpenChams { 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: public:
Netlist(Circuit*); Netlist (Circuit*);
Instance* addInstance (const std::string& name, const std::string& model, unsigned);
Instance* addInstance(Name name, Name model, unsigned); Device* addDevice (const std::string& name, const std::string& model, unsigned, const std::string& mosType, bool);
Device* addDevice (Name name, Name model, unsigned, Name mosType, bool); Net* addNet (const std::string& name, const std::string& type , bool);
Net* addNet (Name name, Name type , bool); Instance* getInstance (const std::string&);
Net* getNet (const std::string&);
Instance* getInstance(Name); inline bool hasNoInstances ();
Net* getNet(Name); inline bool hasNoNets ();
inline const std::vector<Instance*>& getInstances ();
inline bool hasNoInstances(); inline const std::vector<Net*>& getNets ();
inline bool hasNoNets(); inline Circuit* getCircuit ();
inline const std::vector<Instance*>& getInstances();
inline const std::vector<Net*>& getNets();
inline Circuit* getCircuit();
private: private:
Circuit* _circuit; Circuit* _circuit;
std::vector<Instance*> _instances; std::vector<Instance*> _instances;
std::vector<Net*> _nets; std::vector<Net*> _nets;
}; };
inline bool Netlist::hasNoInstances() { return (_instances.size() == 0)? true : false; }
inline bool Netlist::hasNoNets() { return (_nets.size() == 0)? true : false; } inline bool Netlist::hasNoInstances() { return _instances.empty(); }
inline const std::vector<Instance*>& Netlist::getInstances() { return _instances; } inline bool Netlist::hasNoNets () { return _nets.empty(); }
inline const std::vector<Net*>& Netlist::getNets() { return _nets; } inline const std::vector<Instance*>& Netlist::getInstances () { return _instances; }
inline Circuit* Netlist::getCircuit() { return _circuit; } inline const std::vector<Net*>& Netlist::getNets () { return _nets; }
inline Circuit* Netlist::getCircuit () { return _circuit; }
} // namespace
} // OpenChams namespace.
#endif #endif

View File

@ -1,100 +1,101 @@
/*
* Node.h // -*- C++ -*-
* openChams //
* // This file is part of the VLSI SAPD Software.
* Created by damien dupuis on 23/08/11. // Copyright (c) UPMC/LIP6 2011-2012, All Rights Reserved
* Copyright 2010-2011 UPMC / LIP6. 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__ #ifndef __OPENCHAMS_NODE_H__
#define __OPENCHAMS_NODE_H__ #define __OPENCHAMS_NODE_H__
#include "vlsisapd/openChams/Name.h" #include <string>
namespace OpenChams { namespace OpenChams {
class Node {
public:
enum Position { NONE = 0,
RIGHT = 1,
TOP = 2
};
protected:
Node(Name nodeName, Position pos, Node* parent); class Node {
virtual ~Node() {}; public:
enum Position { NONE=0, RIGHT=1, TOP=2 };
public: public:
inline Name getName() const; inline const std::string& getName () const;
inline Position getPosition() const; inline Position getPosition () const;
inline Node* getParent(); inline Node* getParent ();
inline Node* getRight(); inline Node* getRight ();
inline Node* getTop(); inline Node* getTop ();
inline bool isRoot(); inline bool isRoot ();
inline void setRight (Node*);
inline void setRight(Node*); inline void setTop (Node*);
inline void setTop(Node*); protected:
Node (const std::string& nodeName, Position pos, Node* parent);
virtual ~Node () {};
private: private:
Name _name; std::string _name;
Position _position; Position _position;
Node* _parent; Node* _parent;
Node* _right; Node* _right;
Node* _top; 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; }
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: 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: public:
enum Align { NONE = 0 enum Align { NONE=0 , VERTICAL=1 , HORIZONTAL=2 };
, VERTICAL = 1 public:
, HORIZONTAL = 2 Group (const std::string& groupName, Position pos=Node::NONE, Node* parent=NULL);
}; inline void setRootNode (Node*);
inline void setIsolated (bool);
Group(Name groupName, Position pos=Node::NONE, Node* parent=NULL); inline void setPaired (bool);
inline void setAlign (Align);
inline void setRootNode(Node*); inline Node* getRootNode ();
inline void setIsolated(bool); inline bool isIsolated ();
inline void setPaired(bool); inline bool isPaired ();
inline void setAlign(Align); inline Align getAlign ();
inline Node* getRootNode();
inline bool isIsolated();
inline bool isPaired();
inline Align getAlign();
private: private:
Node* _root; Node* _root;
bool _isolated; bool _isolated;
bool _paired; bool _paired;
Align _align; 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 void Group::setRootNode(Node* root) { _root = root; }
inline bool Group::isIsolated() { return _isolated; } inline void Group::setIsolated(bool isolated) { _isolated = isolated; }
inline bool Group::isPaired() { return _paired; } inline void Group::setPaired (bool paired) { _paired = paired; }
inline Group::Align Group::getAlign() { return _align; } 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 #endif

View File

@ -1,64 +1,74 @@
/*
* Operator.h // -*- C++ -*-
* openChams //
* // This file is part of the VLSI SAPD Software.
* Created by damien dupuis on 08/02/10. // Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved
* Copyright 2010 UPMC / LIP6. 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__ #ifndef __OPENCHAMS_OPERATOR_H__
#define __OPENCHAMS_OPERATOR_H__ #define __OPENCHAMS_OPERATOR_H__
#include <map> #include <map>
#include "vlsisapd/openChams/Name.h"
namespace OpenChams { namespace OpenChams {
class Operator {
class Operator {
public: public:
class Constraint { class Constraint {
public: public:
Constraint(Name ref, Name refParam, double factor); Constraint ( const std::string& ref
, const std::string& refParam
inline Name getRef(); , double factor );
inline Name getRefParam(); inline const std::string& getRef ();
inline double getFactor(); inline const std::string& getRefParam ();
inline double getFactor ();
private: private:
Name _ref; std::string _ref;
Name _refParam; std::string _refParam;
double _factor; double _factor;
}; };
public: public:
Operator(Name operatorName, Name simulModel); 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(Name paramName, Name ref, Name refParam ); void addConstraint (const std::string& paramName, const std::string& ref, const std::string& refParam, double factor);
void addConstraint(Name paramName, Name ref, Name refParam, double factor); void addConstraint (const std::string& paramName, const std::string& refEquation);
void addConstraint(Name paramName, Name refEquation ); void addConstraint (const std::string& paramName, const std::string& refEquation, double factor);
void addConstraint(Name paramName, Name refEquation, double factor); inline const std::string& getName ();
inline const std::string& getSimulModel ();
inline Name getName(); inline bool hasNoConstraints ();
inline Name getSimulModel(); inline const std::map<std::string, Constraint*>& getConstraints();
inline bool hasNoConstraints();
inline const std::map<Name, Constraint*>& getConstraints();
private: private:
Name _name; std::string _name;
Name _simulModel; std::string _simulModel;
std::map<Name, Constraint*> _constraints; std::map<std::string, Constraint*> _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<Name, Operator::Constraint*>& Operator::getConstraints() { return _constraints; };
inline Name Operator::Constraint::getRef() { return _ref; }; inline const std::string& Operator::getName () { return _name; };
inline Name Operator::Constraint::getRefParam() { return _refParam; }; inline const std::string& Operator::getSimulModel () { return _simulModel; };
inline double Operator::Constraint::getFactor() { return _factor; }; inline bool Operator::hasNoConstraints () { return _constraints.empty(); };
inline const std::map<std::string, Operator::Constraint*>& 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 } // namespace
#endif #endif

View File

@ -22,26 +22,24 @@
#include <string> #include <string>
namespace OpenChams { namespace OpenChams {
class Name;
class Parameters { class Parameters {
public: public:
inline Parameters (); inline Parameters ();
inline bool isEmpty (); inline bool isEmpty ();
const std::string& getValue (Name); const std::string& getValue (const std::string&);
inline const std::map<Name,std::string>& getValues (); inline const std::map<std::string,std::string>& getValues ();
inline void addParameter (Name, const std::string&); void addParameter (const std::string&, const std::string&);
void addParameter (Name, const char*);
private: private:
std::map<Name,std::string> _params; std::map<std::string,std::string> _params;
}; };
inline Parameters::Parameters () { } inline Parameters::Parameters () { }
inline bool Parameters::isEmpty () { return (_params.size() == 0); } inline bool Parameters::isEmpty () { return (_params.size() == 0); }
inline const std::map<Name,std::string>& Parameters::getValues () { return _params; }; inline const std::map<std::string,std::string>& Parameters::getValues () { return _params; };
inline void Parameters::addParameter (Name name, const std::string& value) { addParameter(name,value.c_str()); }
} // OpenChams namespace. } // OpenChams namespace.

View File

@ -1,43 +1,68 @@
/*
* Port.h // -*- C++ -*-
* openChams //
* // This file is part of the VLSI SAPD Software.
* Created by damien dupuis on 08/02/11. // Copyright (c) UPMC/LIP6 2011-2012, All Rights Reserved
* Copyright 2011 UPMC / LIP6. 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__ #ifndef __OPENCHAMS_PORT_H__
#define __OPENCHAMS_PORT_H__ #define __OPENCHAMS_PORT_H__
#include "vlsisapd/openChams/Name.h"
namespace OpenChams { 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: private:
Name _type; std::string _type;
unsigned _idx; unsigned _idx;
double _x; double _x;
double _y; double _y;
Name _orient; std::string _orient;
}; };
inline Name Port::getType() const { return _type; }
inline unsigned Port::getIndex() const { return _idx; } inline Port::Port (const std::string& type
inline double Port::getX() const { return _x; } , unsigned idx
inline double Port::getY() const { return _y; } , double x
inline Name Port::getOrientation() const { return _orient; } , 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 #endif

View File

@ -1,57 +1,67 @@
/*
* Schematic.h // -*- C++ -*-
* openChams //
* // This file is part of the VLSI SAPD Software.
* Created by damien dupuis on 22/01/10. // Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved
* Copyright 2010 UPMC / LIP6. 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__ #ifndef __OPENCHAMS_SCHEMATIC_H__
#define __OPENCHAMS_SCHEMATIC_H__ #define __OPENCHAMS_SCHEMATIC_H__
#include <map> #include <map>
#include <string>
#include "vlsisapd/openChams/Name.h"
namespace OpenChams { namespace OpenChams {
class Circuit;
class Schematic { class Circuit;
class Schematic {
public: public:
class Infos { class Infos {
public: public:
Infos(double x, double y, Name orient); Infos (double x, double y, const std::string& orient);
inline double getX ();
inline double getX(); inline double getY ();
inline double getY(); inline const std::string& getOrientation();
inline Name getOrientation();
private: private:
double _x; double _x;
double _y; double _y;
Name _orient; std::string _orient;
}; };
public: public:
Schematic(Circuit*); Schematic ( Circuit* );
void addInstance ( const std::string& instanceName
void addInstance(Name instanceName, double x, double y, Name orient ); , double x
, double y
inline bool hasNoInstances(); , const std::string& orient );
inline const std::map<Name, Infos*>& getInstances(); inline bool hasNoInstances ();
inline const std::map<std::string, Infos*>& getInstances();
private: private:
Circuit* _circuit; Circuit* _circuit;
std::map<Name, Infos*> _instances; std::map<std::string, Infos*> _instances;
}; };
inline bool Schematic::hasNoInstances() { return (_instances.size() == 0) ? true : false; }; inline bool Schematic::hasNoInstances() { return _instances.empty(); };
inline const std::map<Name, Schematic::Infos*>& Schematic::getInstances() { return _instances; }; inline const std::map<std::string, Schematic::Infos*>& Schematic::getInstances () { return _instances; };
inline double Schematic::Infos::getX() { return _x; }; inline double Schematic::Infos::getX () { return _x; };
inline double Schematic::Infos::getY() { return _y; }; inline double Schematic::Infos::getY () { return _y; };
inline Name Schematic::Infos::getOrientation() { return _orient; }; inline const std::string& Schematic::Infos::getOrientation() { return _orient; };
} // namespace
#endif
} // OpenChams namespace.
#endif

View File

@ -10,7 +10,8 @@
#ifndef __OPENCHAMS_SIMULMODEL_H__ #ifndef __OPENCHAMS_SIMULMODEL_H__
#define __OPENCHAMS_SIMULMODEL_H__ #define __OPENCHAMS_SIMULMODEL_H__
#include "vlsisapd/openChams/Name.h" #include <string>
namespace OpenChams { namespace OpenChams {
class SimulModel { class SimulModel {

View File

@ -1,52 +1,64 @@
/*
* Sizing.h // -*- C++ -*-
* openChams //
* // This file is part of the VLSI SAPD Software.
* Created by damien dupuis on 08/02/10. // Copyright (c) UPMC/LIP6 2010-2012, All Rights Reserved
* Copyright 2008-2010 UPMC / LIP6. 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__ #ifndef __OPENCHAMS_SIZING_H__
#define __OPENCHAMS_SIZING_H__ #define __OPENCHAMS_SIZING_H__
#include <map> #include <map>
#include <string>
namespace OpenChams { namespace OpenChams {
class Name;
class Circuit; class Circuit;
class Operator; class Operator;
class Equation; class Equation;
// class HighLevelCstr; //class HighLevelCstr;
// class NRCCstr; //class NRCCstr;
// class DDP; //class DDP;
class Sizing { class Sizing {
public: public:
Sizing(Circuit*); Sizing ( Circuit* );
Operator* addOperator ( const std::string& instanceName
Operator* addOperator(Name instanceName, Name operatorName, Name simulModel); , const std::string& operatorName
, const std::string& simulModel);
// void addEquation(Name equationName, HighLevelCstr*); // void addEquation ( const std::string& equationName, HighLevelCstr* );
// void addEquation(Name equationName, NRCCstr*); // void addEquation ( const std::string& equationName, NRCCstr* );
// void addEquation(Name equationName, DDP*); // void addEquation ( const std::string& equationName, DDP* );
void addEquation(Name equationName, Equation*); void addEquation ( const std::string& equationName, Equation* );
inline bool hasNoOperators ();
inline bool hasNoOperators(); inline bool hasNoEquations ();
inline bool hasNoEquations(); inline const std::map<std::string, Operator*>& getOperators();
inline const std::map<Name, Operator*>& getOperators(); inline const std::map<std::string, Equation*>& getEquations();
inline const std::map<Name, Equation*>& getEquations(); private:
Circuit* _circuit;
private: std::map<std::string, Operator*> _operators; // instanceName <-> operator
Circuit* _circuit; std::map<std::string, Equation*> _equations; // equationName <-> equation (string)
std::map<Name, Operator*> _operators; // instanceName <-> operator
std::map<Name, Equation*> _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 bool Sizing::hasNoOperators() { return _operators.empty(); };
inline const std::map<Name, Operator*>& Sizing::getOperators() { return _operators; }; inline bool Sizing::hasNoEquations() { return _equations.empty(); };
inline const std::map<Name, Equation*>& Sizing::getEquations() { return _equations; }; inline const std::map<std::string, Operator*>& Sizing::getOperators() { return _operators; };
} // namespace inline const std::map<std::string, Equation*>& Sizing::getEquations() { return _equations; };
} // OpenChams namespace
#endif #endif

View File

@ -11,7 +11,7 @@
// | Author : Damien Dupuis | // | Author : Damien Dupuis |
// | E-mail : Jean-Paul.Chaput@lip6.fr | // | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Header : "./vlsisapd/openChams/Instance.h" | // | C++ Header : "./vlsisapd/openChams/Transistor.h" |
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
@ -20,7 +20,6 @@
#include <map> #include <map>
#include "vlsisapd/openChams/Name.h"
#include "vlsisapd/openChams/Parameters.h" #include "vlsisapd/openChams/Parameters.h"
@ -32,42 +31,42 @@ namespace OpenChams {
class Transistor { class Transistor {
public: public:
Transistor (Name, Instance*); Transistor (const std::string&, Instance*);
inline void addParameter (Name, const char*); inline void addParameter (const std::string&, const char*);
inline void addParameter (Name, const std::string&); inline void addParameter (const std::string&, const std::string&);
inline Parameters getParameters (); inline Parameters getParameters ();
inline void setName (Name); inline void setName (const std::string&);
inline Name getName (); inline const std::string& getName ();
inline Name getGate (); inline const std::string& getGate ();
inline Name getSource (); inline const std::string& getSource ();
inline Name getDrain (); inline const std::string& getDrain ();
inline Name getBulk (); inline const std::string& getBulk ();
void setGate (Name); void setGate (const std::string&);
void setSource (Name); void setSource (const std::string&);
void setDrain (Name); void setDrain (const std::string&);
void setBulk (Name); void setBulk (const std::string&);
private:
bool checkConnector (const std::string&);
private: private:
bool checkConnector (Name); std::string _name;
private: std::string _gate; // le nom du connecteur de _instance auquel la gate est reliée
Name _name; std::string _source; // le nom du connecteur de _instance auquel la source est reliée
Name _gate; // le nom du connecteur de _instance auquel la gate est reliée std::string _drain; // le nom du connecteur de _instance auquel le drain est relié
Name _source; // le nom du connecteur de _instance auquel la source est reliée std::string _bulk; // le nom du connecteur de _instance auquel le bulk est relié
Name _drain; // le nom du connecteur de _instance auquel le drain est relié Instance* _instance;
Name _bulk; // le nom du connecteur de _instance auquel le bulk est relié Parameters _params;
Instance* _instance;
Parameters _params;
}; };
inline void Transistor::addParameter (Name name, const char* value) { _params.addParameter(name,value); }; inline void Transistor::addParameter (const std::string& name, const char* value) { _params.addParameter(name,value); };
inline void Transistor::addParameter (Name name, const std::string& 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 Parameters Transistor::getParameters () { return _params; };
inline void Transistor::setName (Name name) { _name = name; }; inline void Transistor::setName (const std::string& name) { _name = name; };
inline Name Transistor::getName () { return _name; }; inline const std::string& Transistor::getName () { return _name; };
inline Name Transistor::getGate () { return _gate; }; inline const std::string& Transistor::getGate () { return _gate; };
inline Name Transistor::getSource () { return _source; }; inline const std::string& Transistor::getSource () { return _source; };
inline Name Transistor::getDrain () { return _drain; }; inline const std::string& Transistor::getDrain () { return _drain; };
inline Name Transistor::getBulk () { return _bulk; }; inline const std::string& Transistor::getBulk () { return _bulk; };
} // OpenChams namespace. } // OpenChams namespace.

View File

@ -1,87 +1,124 @@
/*
* Wire.h // -*- C++ -*-
* openChams //
* // This file is part of the VLSI SAPD Software.
* Created by damien dupuis on 08/02/11. // Copyright (c) UPMC/LIP6 2011-2012, All Rights Reserved
* Copyright 2011 UPMC / LIP6. 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__ #ifndef __OPENCHAMS_WIRE_H__
#define __OPENCHAMS_WIRE_H__ #define __OPENCHAMS_WIRE_H__
#include <string>
#include <vector> #include <vector>
#include "vlsisapd/openChams/Name.h"
namespace OpenChams { 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: private:
Name _name; std::string _name;
Name _plug; std::string _plug;
};
class PortPoint: public WirePoint {
public: public:
InstancePoint(Name name, Name plug): _name(name), _plug(plug) {} inline PortPoint (unsigned idx);
virtual ~InstancePoint() {} inline virtual ~PortPoint ();
inline unsigned getIndex ();
inline Name getName() { return _name; }
inline Name getPlug() { return _plug; }
};
class PortPoint: public WirePoint {
private: private:
unsigned _idx; unsigned _idx;
};
class IntermediatePoint: public WirePoint {
public: public:
PortPoint(unsigned idx): _idx(idx) {} inline IntermediatePoint (double x, double y);
virtual ~PortPoint() {} inline virtual ~IntermediatePoint ();
inline double getX ();
inline unsigned getIndex() { return _idx; } inline double getY ();
};
class IntermediatePoint: public WirePoint {
private: private:
double _x; double _x;
double _y; 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<IntermediatePoint*> _inters;
class Wire {
public: public:
Wire(): _start(NULL), _end(NULL), _inters() {} inline Wire ();
~Wire() {} inline ~Wire ();
// Accessors // Accessors
inline WirePoint* getStartPoint() { return _start; } inline WirePoint* getStartPoint ();
inline WirePoint* getEndPoint() { return _end; } inline WirePoint* getEndPoint ();
inline bool hasNoIntermediatePoints() { return (_inters.size() == 0)? true : false; } inline bool hasNoIntermediatePoints();
inline const std::vector<IntermediatePoint*>& getIntermediatePoints() { return _inters; } inline const std::vector<IntermediatePoint*>& getIntermediatePoints();
// Modifiers // Modifiers
void setStartPoint(Name name, Name plug); void setStartPoint (const std::string& name, const std::string& plug);
void setStartPoint(unsigned idx); void setStartPoint (unsigned idx);
void setEndPoint(Name name, Name plug); void setEndPoint (const std::string& name, const std::string& plug);
void setEndPoint(unsigned idx); void setEndPoint (unsigned idx);
void addIntermediatePoint(double x, double y); void addIntermediatePoint (double x, double y);
}; private:
WirePoint* _start;
WirePoint* _end;
std::vector<IntermediatePoint*> _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<IntermediatePoint*>& Wire::getIntermediatePoints() { return _inters; }
} // namespace } // namespace
#endif #endif