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