Added classes to handle equations (HighLevelCstr, DDP, DesignerCstrOC, NRCCstr), all child of Equation.
Modified openChams parser and driver to take into account these classes.
This commit is contained in:
parent
f1ba48f977
commit
64ae150d5e
|
@ -17,6 +17,11 @@ SET ( hpps vlsisapd/openChams/Circuit.h
|
||||||
vlsisapd/openChams/Port.h
|
vlsisapd/openChams/Port.h
|
||||||
vlsisapd/openChams/Wire.h
|
vlsisapd/openChams/Wire.h
|
||||||
vlsisapd/openChams/OpenChamsException.h
|
vlsisapd/openChams/OpenChamsException.h
|
||||||
|
vlsisapd/openChams/Equation.h
|
||||||
|
vlsisapd/openChams/HighLevelCstr.h
|
||||||
|
vlsisapd/openChams/NRCCstr.h
|
||||||
|
vlsisapd/openChams/DDP.h
|
||||||
|
vlsisapd/openChams/DesignerCstrOC.h
|
||||||
)
|
)
|
||||||
SET ( cpps Circuit.cpp
|
SET ( cpps Circuit.cpp
|
||||||
Netlist.cpp
|
Netlist.cpp
|
||||||
|
@ -33,6 +38,11 @@ SET ( cpps Circuit.cpp
|
||||||
Node.cpp
|
Node.cpp
|
||||||
Transistor.cpp
|
Transistor.cpp
|
||||||
Wire.cpp
|
Wire.cpp
|
||||||
|
Equation.cpp
|
||||||
|
HighLevelCstr.cpp
|
||||||
|
NRCCstr.cpp
|
||||||
|
DDP.cpp
|
||||||
|
DesignerCstrOC.cpp
|
||||||
)
|
)
|
||||||
SET ( pycpps PyOpenChams.cpp
|
SET ( pycpps PyOpenChams.cpp
|
||||||
)
|
)
|
||||||
|
|
|
@ -29,6 +29,11 @@ using namespace std;
|
||||||
#include "vlsisapd/openChams/Port.h"
|
#include "vlsisapd/openChams/Port.h"
|
||||||
#include "vlsisapd/openChams/Wire.h"
|
#include "vlsisapd/openChams/Wire.h"
|
||||||
#include "vlsisapd/openChams/OpenChamsException.h"
|
#include "vlsisapd/openChams/OpenChamsException.h"
|
||||||
|
#include "vlsisapd/openChams/Equation.h"
|
||||||
|
#include "vlsisapd/openChams/HighLevelCstr.h"
|
||||||
|
#include "vlsisapd/openChams/NRCCstr.h"
|
||||||
|
#include "vlsisapd/openChams/DDP.h"
|
||||||
|
#include "vlsisapd/openChams/DesignerCstrOC.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
template<class T> T getValue(xmlChar* str) {
|
template<class T> T getValue(xmlChar* str) {
|
||||||
|
@ -768,26 +773,116 @@ void Circuit::readEquations(xmlNode* node, Sizing* sizing) {
|
||||||
xmlNode* child = node->children;
|
xmlNode* child = node->children;
|
||||||
for (xmlNode* node = child; node; node = node->next) {
|
for (xmlNode* node = child; node; node = node->next) {
|
||||||
if (node->type == XML_ELEMENT_NODE) {
|
if (node->type == XML_ELEMENT_NODE) {
|
||||||
if (xmlStrEqual(node->name, (xmlChar*)"eq")) {
|
if (xmlStrEqual(node->name, (xmlChar*)"cstr_circuit_level"))
|
||||||
readEquation(node, sizing);
|
readEquation_CircuitLevel(node, sizing);
|
||||||
} else {
|
else if (xmlStrEqual(node->name, (xmlChar*)"nrc_cstr"))
|
||||||
throw OpenChamsException("[ERROR] Only 'eq' nodes are allowed in 'equations'.");
|
readEquation_NRC(node, sizing);
|
||||||
|
else if (xmlStrEqual(node->name, (xmlChar*)"ddps"))
|
||||||
|
readEquation_DDPs(node, sizing);
|
||||||
|
else if (xmlStrEqual(node->name, (xmlChar*)"cstr_designer"))
|
||||||
|
readEquation_DesignerCstr(node, sizing);
|
||||||
|
else {
|
||||||
|
throw OpenChamsException("[ERROR] 'cstr_circuit_level', 'nrc_cstr' and 'ddps' nodes are allowed in 'equations'.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Circuit::readEquation(xmlNode* node, Sizing* sizing) {
|
void Circuit::readEquation_CircuitLevel(xmlNode* node, Sizing* sizing) {
|
||||||
xmlChar* nameC = xmlGetProp(node, (xmlChar*)"name");
|
if (node->type == XML_ELEMENT_NODE && node->children) {
|
||||||
xmlChar* equationC = xmlGetProp(node, (xmlChar*)"equation");
|
for (xmlNode* eqNode = node->children ; eqNode ; eqNode = eqNode->next) {
|
||||||
|
if (eqNode->type == XML_ELEMENT_NODE && xmlStrEqual(eqNode->name, (xmlChar*)"cstr_cl")) {
|
||||||
|
xmlChar* nameC = xmlGetProp(eqNode, (xmlChar*)"name");
|
||||||
|
xmlChar* equationC = xmlGetProp(eqNode, (xmlChar*)"equation");
|
||||||
if (nameC && equationC) {
|
if (nameC && equationC) {
|
||||||
Name eName ((const char*)nameC);
|
Name eName ((const char*)nameC);
|
||||||
string eqStr ((const char*)equationC);
|
string eqStr ((const char*)equationC);
|
||||||
sizing->addEquation(eName, eqStr);
|
HighLevelCstr* equation = new HighLevelCstr();
|
||||||
} else {
|
equation->addEquation(eqStr);
|
||||||
throw OpenChamsException("[ERROR] 'eq' node in 'equations' must have 'name' and 'equation' properties.");
|
sizing->addEquation(eName, (Equation*)(equation));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw OpenChamsException("[ERROR] 'cstr_cl' node in 'equations' must have 'name' and 'equation' properties.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Circuit::readEquation_DesignerCstr(xmlNode* node, Sizing* sizing) {
|
||||||
|
if (node->type == XML_ELEMENT_NODE && node->children) {
|
||||||
|
for (xmlNode* eqNode = node->children ; eqNode ; eqNode = eqNode->next) {
|
||||||
|
if (eqNode->type == XML_ELEMENT_NODE && xmlStrEqual(eqNode->name, (xmlChar*)"cstr_dsg")) {
|
||||||
|
xmlChar* nameC = xmlGetProp(eqNode, (xmlChar*)"name");
|
||||||
|
xmlChar* equationC = xmlGetProp(eqNode, (xmlChar*)"equation");
|
||||||
|
if (nameC && equationC) {
|
||||||
|
Name eName ((const char*)nameC);
|
||||||
|
string eqStr ((const char*)equationC);
|
||||||
|
DesignerCstrOC* equation = new DesignerCstrOC();
|
||||||
|
equation->addEquation(eqStr);
|
||||||
|
sizing->addEquation(eName, (Equation*)(equation));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw OpenChamsException("[ERROR] 'cstr_dsg' node in 'equations' must have 'name' and 'equation' properties.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Circuit::readEquation_NRC(xmlNode* node, Sizing* sizing) {
|
||||||
|
// cerr << "NRC not yet managed" << endl;
|
||||||
|
|
||||||
|
if (node->type == XML_ELEMENT_NODE && node->children) {
|
||||||
|
for (xmlNode* eqNode = node->children ; eqNode ; eqNode = eqNode->next) {
|
||||||
|
if (eqNode->type == XML_ELEMENT_NODE && xmlStrEqual(eqNode->name, (xmlChar*)"nrc")) {
|
||||||
|
xmlChar* nameC = xmlGetProp(eqNode, (xmlChar*)"name");
|
||||||
|
xmlChar* paramC = xmlGetProp(eqNode, (xmlChar*)"param");
|
||||||
|
xmlChar* equationC = xmlGetProp(eqNode, (xmlChar*)"equation");
|
||||||
|
if (nameC && equationC && paramC) {
|
||||||
|
Name eName ((const char*)nameC);
|
||||||
|
string eqStr ((const char*)equationC);
|
||||||
|
string paramStr ((const char*)paramC);
|
||||||
|
NRCCstr* equation = new NRCCstr(paramStr);
|
||||||
|
equation->addEquation(eqStr);
|
||||||
|
sizing->addEquation(eName, (Equation*)(equation));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw OpenChamsException("[ERROR] 'nrc' node in 'nrc_cstr' must have 'name', 'param' and 'equation' properties.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Circuit::readEquation_DDPs(xmlNode* node, Sizing* sizing) {
|
||||||
|
// cerr << "DDP not yet managed" << endl;
|
||||||
|
|
||||||
|
if (node->type == XML_ELEMENT_NODE && node->children) {
|
||||||
|
for (xmlNode* eqNode = node->children ; eqNode ; eqNode = eqNode->next) {
|
||||||
|
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);
|
||||||
|
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")) {
|
||||||
|
xmlChar* equationC = xmlGetProp(eqNode2, (xmlChar*)"equation");
|
||||||
|
if (equationC) {
|
||||||
|
string eqStr ((const char*)equationC);
|
||||||
|
equation->addEquation(eqStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sizing->addEquation(eName, (Equation*)(equation));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw OpenChamsException("[ERROR] 'ddp_i' node in 'ddps' must have 'name' property.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// *************************************************************************************
|
||||||
|
|
||||||
// LAYOUT //
|
// LAYOUT //
|
||||||
void Circuit::readLayout(xmlNode* node) {
|
void Circuit::readLayout(xmlNode* node) {
|
||||||
|
@ -1132,8 +1227,10 @@ bool Circuit::writeToFile(string filePath) {
|
||||||
for (map<Name, double>::const_iterator it = _params.getValues().begin() ; it != _params.getValues().end() ; ++it) {
|
for (map<Name, double>::const_iterator it = _params.getValues().begin() ; it != _params.getValues().end() ; ++it) {
|
||||||
file << " <parameter name=\"" << (*it).first.getString() << "\" value=\"" << (*it).second << "\"/>" << endl;
|
file << " <parameter name=\"" << (*it).first.getString() << "\" value=\"" << (*it).second << "\"/>" << endl;
|
||||||
}
|
}
|
||||||
for (map<Name, string>::const_iterator it = _params.getEqValues().begin() ; it != _params.getEqValues().end() ; ++it) {
|
cerr << "_params.getValues().size() = " << _params.getValues().size() << endl;
|
||||||
file << " <parameterEq name=\"" << (*it).first.getString() << "\" equation=\"" << (*it).second << "\"/>" << endl;
|
cerr << "_params.getEqValues().size() = " << _params.getEqValues().size() << endl;
|
||||||
|
for (map<Name, string>::const_iterator it2 = _params.getEqValues().begin() ; it2 != _params.getEqValues().end() ; ++it2) {
|
||||||
|
file << " <parameterEq name=\"" << (*it2).first.getString() << "\" equation=\"" << (*it2).second << "\"/>" << endl;
|
||||||
}
|
}
|
||||||
file << " </parameters>" << endl;
|
file << " </parameters>" << endl;
|
||||||
}
|
}
|
||||||
|
@ -1184,6 +1281,9 @@ bool Circuit::writeToFile(string filePath) {
|
||||||
for (map<Name, double>::const_iterator it = params.getValues().begin() ; it != params.getValues().end() ; ++it) {
|
for (map<Name, double>::const_iterator it = params.getValues().begin() ; it != params.getValues().end() ; ++it) {
|
||||||
file << " <parameter name=\"" << (*it).first.getString() << "\" value=\"" << (*it).second << "\"/>" << endl;
|
file << " <parameter name=\"" << (*it).first.getString() << "\" value=\"" << (*it).second << "\"/>" << endl;
|
||||||
}
|
}
|
||||||
|
for(map<Name, string>::const_iterator it = params.getEqValues().begin() ; it != params.getEqValues().end() ; ++it) {
|
||||||
|
file << " <parameterEq name=\"" << (*it).first.getString() << "\" equation=\"" << (*it).second << "\"/>" << endl;
|
||||||
|
}
|
||||||
file << " </parameters>" << endl;
|
file << " </parameters>" << endl;
|
||||||
}
|
}
|
||||||
file << " </instance>" << endl;
|
file << " </instance>" << endl;
|
||||||
|
@ -1270,8 +1370,12 @@ bool Circuit::writeToFile(string filePath) {
|
||||||
}
|
}
|
||||||
file << " </schematic>" << endl;
|
file << " </schematic>" << endl;
|
||||||
}
|
}
|
||||||
if (_sizing && !_sizing->hasNoOperators()) {
|
|
||||||
|
// SIZING (modified by Farakh) ***************************************************************
|
||||||
|
if(_sizing && (!_sizing->hasNoOperators() || !_sizing->hasNoEquations()) )
|
||||||
file << " <sizing>" << endl;
|
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<Name, Operator*>::const_iterator it = _sizing->getOperators().begin() ; it != _sizing->getOperators().end() ; ++it) {
|
||||||
Operator* op = (*it).second;
|
Operator* op = (*it).second;
|
||||||
string opName = op->getName().getString();
|
string opName = op->getName().getString();
|
||||||
|
@ -1290,15 +1394,53 @@ bool Circuit::writeToFile(string filePath) {
|
||||||
}
|
}
|
||||||
file << " </instance>" << endl;
|
file << " </instance>" << endl;
|
||||||
}
|
}
|
||||||
if (!_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;
|
|
||||||
}
|
}
|
||||||
|
// 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;
|
||||||
|
file << " <cstr_designer>" << endl;
|
||||||
|
for(map<Name, 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_designer>" << endl;
|
||||||
|
|
||||||
|
file << " <cstr_circuit_level>" << endl;
|
||||||
|
for(map<Name, 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_circuit_level>" << endl;
|
||||||
|
|
||||||
|
file << " <nrc_cstr>" << endl;
|
||||||
|
for(map<Name, 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_cstr>" << endl;
|
||||||
|
|
||||||
|
file << " <ddps>" << endl;
|
||||||
|
for(map<Name, 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;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file << " </ddps>" << endl;
|
||||||
|
|
||||||
|
|
||||||
file << " </equations>" << endl;
|
file << " </equations>" << endl;
|
||||||
}
|
}
|
||||||
|
if(_sizing && (!_sizing->hasNoOperators() || !_sizing->hasNoEquations()) )
|
||||||
file << " </sizing>" << endl;
|
file << " </sizing>" << endl;
|
||||||
}
|
// *******************************************************************************************
|
||||||
|
|
||||||
if (_layout) {
|
if (_layout) {
|
||||||
file << " <layout>" << endl;
|
file << " <layout>" << endl;
|
||||||
if (!_layout->hasNoInstance()) {
|
if (!_layout->hasNoInstance()) {
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* DDP.cpp
|
||||||
|
* openChams
|
||||||
|
*
|
||||||
|
* Created by Farakh JAVID on 25/10/2011.
|
||||||
|
* Copyright 2010 UPMC / LIP6. All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include "vlsisapd/openChams/DDP.h"
|
||||||
|
|
||||||
|
namespace OpenChams {
|
||||||
|
DDP::DDP()
|
||||||
|
: Equation()
|
||||||
|
{}
|
||||||
|
|
||||||
|
// This function prints all equations
|
||||||
|
void DDP::printEquations() {
|
||||||
|
map<int, string>::iterator it;
|
||||||
|
cerr << "Printing equations of a DDP : " << endl;
|
||||||
|
for(it=_equations.begin(); it!=_equations.end(); ++it) {
|
||||||
|
cerr << (*it).first << "\t" << (*it).second << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* DesignerCstrOC.cpp
|
||||||
|
* openChams
|
||||||
|
*
|
||||||
|
* Created by Farakh JAVID on 25/10/2011.
|
||||||
|
* Copyright 2010 UPMC / LIP6. All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include "vlsisapd/openChams/DesignerCstrOC.h"
|
||||||
|
|
||||||
|
namespace OpenChams {
|
||||||
|
DesignerCstrOC::DesignerCstrOC()
|
||||||
|
: Equation()
|
||||||
|
{}
|
||||||
|
|
||||||
|
// This function prints all equations
|
||||||
|
void DesignerCstrOC::printEquations() {
|
||||||
|
map<int, string>::iterator it;
|
||||||
|
cerr << "Printing equations of a DesignerCstrOC : " << endl;
|
||||||
|
for(it=_equations.begin(); it!=_equations.end(); ++it) {
|
||||||
|
cerr << (*it).first << "\t" << (*it).second << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* Equation.cpp
|
||||||
|
* openChams
|
||||||
|
*
|
||||||
|
* Created by Farakh JAVID on 25/10/2011.
|
||||||
|
* Copyright 2010 UPMC / LIP6. All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include "vlsisapd/openChams/Equation.h"
|
||||||
|
|
||||||
|
namespace OpenChams {
|
||||||
|
Equation::Equation()
|
||||||
|
: _equations()
|
||||||
|
// , _paramsInEquation()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void Equation::addEquation(std::string eq) {
|
||||||
|
_equations[_equations.size()] = eq;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* HighLevelCstr.cpp
|
||||||
|
* openChams
|
||||||
|
*
|
||||||
|
* Created by Farakh JAVID on 25/10/2011.
|
||||||
|
* Copyright 2010 UPMC / LIP6. All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include "vlsisapd/openChams/HighLevelCstr.h"
|
||||||
|
|
||||||
|
namespace OpenChams {
|
||||||
|
HighLevelCstr::HighLevelCstr()
|
||||||
|
: Equation()
|
||||||
|
{}
|
||||||
|
|
||||||
|
// This function prints all equations
|
||||||
|
void HighLevelCstr::printEquations() {
|
||||||
|
map<int, string>::iterator it;
|
||||||
|
cerr << "Printing equations of a HighLevelCstr : " << endl;
|
||||||
|
for(it=_equations.begin(); it!=_equations.end(); ++it) {
|
||||||
|
cerr << (*it).first << "\t" << (*it).second << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* NRCCstr.cpp
|
||||||
|
* openChams
|
||||||
|
*
|
||||||
|
* Created by Farakh JAVID on 25/10/2011.
|
||||||
|
* Copyright 2010 UPMC / LIP6. All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include "vlsisapd/openChams/NRCCstr.h"
|
||||||
|
|
||||||
|
namespace OpenChams {
|
||||||
|
NRCCstr::NRCCstr(string controlVoltage)
|
||||||
|
: Equation()
|
||||||
|
, _controlVoltage(controlVoltage)
|
||||||
|
{}
|
||||||
|
|
||||||
|
// This function prints all equations
|
||||||
|
void NRCCstr::printEquations() {
|
||||||
|
map<int, string>::iterator it;
|
||||||
|
cerr << "Printing equations of a NRCCstr : " << endl;
|
||||||
|
cerr << "Control voltage = " << _controlVoltage << endl;
|
||||||
|
for(it=_equations.begin(); it!=_equations.end(); ++it) {
|
||||||
|
cerr << (*it).first << "\t" << (*it).second << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
|
@ -59,6 +59,7 @@ void Parameters::addParameter(Name name, string eqStr) {
|
||||||
throw OpenChamsException(error);
|
throw OpenChamsException(error);
|
||||||
}
|
}
|
||||||
_paramsEq[name] = eqStr;
|
_paramsEq[name] = eqStr;
|
||||||
|
cerr << "987* _paramsEq.size() = " << _paramsEq.size() << endl;
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
|
@ -299,6 +299,7 @@ BOOST_PYTHON_MODULE(OPENCHAMS) {
|
||||||
;
|
;
|
||||||
} // end operatorScope
|
} // end operatorScope
|
||||||
|
|
||||||
|
/*
|
||||||
// map wrapping for OpenChams::Sizing
|
// map wrapping for OpenChams::Sizing
|
||||||
STL_MAP_WRAPPING_PTR(Name, Operator*, "OperatorsMap")
|
STL_MAP_WRAPPING_PTR(Name, Operator*, "OperatorsMap")
|
||||||
// class OpenChams::Sizing
|
// class OpenChams::Sizing
|
||||||
|
@ -313,6 +314,7 @@ BOOST_PYTHON_MODULE(OPENCHAMS) {
|
||||||
.def("getEquations", &Sizing::getEquations, return_internal_reference<>())
|
.def("getEquations", &Sizing::getEquations, return_internal_reference<>())
|
||||||
.def("getOperators", &Sizing::getOperators, return_internal_reference<>())
|
.def("getOperators", &Sizing::getOperators, return_internal_reference<>())
|
||||||
;
|
;
|
||||||
|
*/
|
||||||
|
|
||||||
// map wrapping for OpenChams::Layout
|
// map wrapping for OpenChams::Layout
|
||||||
STL_MAP_WRAPPING(Name, Name, "LayoutInstancesMap")
|
STL_MAP_WRAPPING(Name, Name, "LayoutInstancesMap")
|
||||||
|
|
|
@ -13,6 +13,7 @@ using namespace std;
|
||||||
#include "vlsisapd/openChams/Sizing.h"
|
#include "vlsisapd/openChams/Sizing.h"
|
||||||
#include "vlsisapd/openChams/Circuit.h"
|
#include "vlsisapd/openChams/Circuit.h"
|
||||||
#include "vlsisapd/openChams/Operator.h"
|
#include "vlsisapd/openChams/Operator.h"
|
||||||
|
#include "vlsisapd/openChams/Equation.h"
|
||||||
#include "vlsisapd/openChams/OpenChamsException.h"
|
#include "vlsisapd/openChams/OpenChamsException.h"
|
||||||
|
|
||||||
namespace OpenChams {
|
namespace OpenChams {
|
||||||
|
@ -31,8 +32,8 @@ Operator* Sizing::addOperator(Name instanceName, Name operatorName, Name simulMo
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sizing::addEquation(Name equationName, string equation) {
|
void Sizing::addEquation(Name equationName, Equation* equation) {
|
||||||
map<Name, string>::iterator it = _equations.find(equationName);
|
map<Name, Equation*>::iterator it = _equations.find(equationName);
|
||||||
if (it != _equations.end()) {
|
if (it != _equations.end()) {
|
||||||
string error("[ERROR] Cannot set several equations with the same name in 'sizing' (");
|
string error("[ERROR] Cannot set several equations with the same name in 'sizing' (");
|
||||||
error += equationName.getString();
|
error += equationName.getString();
|
||||||
|
|
|
@ -91,8 +91,13 @@ class Circuit {
|
||||||
void readSizing(xmlNode*);
|
void readSizing(xmlNode*);
|
||||||
void readInstanceSizing(xmlNode*, Sizing*);
|
void readInstanceSizing(xmlNode*, Sizing*);
|
||||||
void readConstraint(xmlNode*, Operator*);
|
void readConstraint(xmlNode*, Operator*);
|
||||||
|
|
||||||
void readEquations(xmlNode*, Sizing*);
|
void readEquations(xmlNode*, Sizing*);
|
||||||
void readEquation(xmlNode*, Sizing*);
|
void readEquation_CircuitLevel(xmlNode*, Sizing*);
|
||||||
|
void readEquation_NRC(xmlNode*, Sizing*);
|
||||||
|
void readEquation_DDPs(xmlNode*, Sizing*);
|
||||||
|
void readEquation_DesignerCstr(xmlNode*, Sizing*);
|
||||||
|
|
||||||
void readLayout(xmlNode*);
|
void readLayout(xmlNode*);
|
||||||
void readInstanceLayout(xmlNode*, Layout*);
|
void readInstanceLayout(xmlNode*, Layout*);
|
||||||
void readHBTree(xmlNode*, Layout*);
|
void readHBTree(xmlNode*, Layout*);
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* DDP.h
|
||||||
|
* openChams
|
||||||
|
*
|
||||||
|
* Created by Farakh JAVID on 25/10/2011.
|
||||||
|
* Copyright 2008-2010 UPMC / LIP6. All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __OPENCHAMS_DDP_H__
|
||||||
|
#define __OPENCHAMS_DDP_H__
|
||||||
|
|
||||||
|
#include "vlsisapd/openChams/Equation.h"
|
||||||
|
|
||||||
|
namespace OpenChams {
|
||||||
|
class DDP : public Equation {
|
||||||
|
public:
|
||||||
|
DDP();
|
||||||
|
|
||||||
|
virtual void printEquations();
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
#endif
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* DesignerCstrOC.h
|
||||||
|
* openChams
|
||||||
|
*
|
||||||
|
* Created by Farakh JAVID on 25/10/2011.
|
||||||
|
* Copyright 2008-2010 UPMC / LIP6. All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __OPENCHAMS_DESIGNERCSTROC_H__
|
||||||
|
#define __OPENCHAMS_DESIGNERCSTROC_H__
|
||||||
|
|
||||||
|
#include "vlsisapd/openChams/Equation.h"
|
||||||
|
|
||||||
|
namespace OpenChams {
|
||||||
|
class DesignerCstrOC : public Equation {
|
||||||
|
public:
|
||||||
|
DesignerCstrOC();
|
||||||
|
|
||||||
|
virtual void printEquations();
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
#endif
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* Equation.h
|
||||||
|
* openChams
|
||||||
|
*
|
||||||
|
* Created by Farakh JAVID on 25/10/2011.
|
||||||
|
* Copyright 2008-2010 UPMC / LIP6. All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __OPENCHAMS_EQUATION_H__
|
||||||
|
#define __OPENCHAMS_EQUATION_H__
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
|
//using namespace std;
|
||||||
|
|
||||||
|
namespace OpenChams {
|
||||||
|
class Equation {
|
||||||
|
public:
|
||||||
|
Equation();
|
||||||
|
|
||||||
|
void addEquation(std::string eq);
|
||||||
|
inline std::map<int, std::string>& getEquationStr();
|
||||||
|
virtual void printEquations() = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::map<int, std::string> _equations; // this map contains the equation(s)
|
||||||
|
// std::vector<std::string> _paramsInEquation; //
|
||||||
|
};
|
||||||
|
|
||||||
|
inline std::map<int, std::string>& Equation::getEquationStr() {return _equations;}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
#endif
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* HighLevelCstr.h
|
||||||
|
* openChams
|
||||||
|
*
|
||||||
|
* Created by Farakh JAVID on 25/10/2011.
|
||||||
|
* Copyright 2008-2010 UPMC / LIP6. All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __OPENCHAMS_HIGHLEVELCSTR_H__
|
||||||
|
#define __OPENCHAMS_HIGHLEVELCSTR_H__
|
||||||
|
|
||||||
|
#include "vlsisapd/openChams/Equation.h"
|
||||||
|
|
||||||
|
namespace OpenChams {
|
||||||
|
class HighLevelCstr : public Equation {
|
||||||
|
public:
|
||||||
|
HighLevelCstr();
|
||||||
|
|
||||||
|
virtual void printEquations();
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
#endif
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* NRCCstr.h
|
||||||
|
* openChams
|
||||||
|
*
|
||||||
|
* Created by Farakh JAVID on 25/10/2011.
|
||||||
|
* Copyright 2008-2010 UPMC / LIP6. All rights reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __OPENCHAMS_NRCCSTR_H__
|
||||||
|
#define __OPENCHAMS_NRCCSTR_H__
|
||||||
|
|
||||||
|
#include "vlsisapd/openChams/Equation.h"
|
||||||
|
|
||||||
|
namespace OpenChams {
|
||||||
|
class NRCCstr : public Equation {
|
||||||
|
public:
|
||||||
|
NRCCstr(string controlVoltage);
|
||||||
|
|
||||||
|
inline void setVoltage(std::string s);
|
||||||
|
inline std::string getVoltage();
|
||||||
|
|
||||||
|
virtual void printEquations();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string _controlVoltage;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void NRCCstr::setVoltage(std::string s) {_controlVoltage = s;}
|
||||||
|
inline std::string NRCCstr::getVoltage() {return _controlVoltage;}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
#endif
|
|
@ -16,29 +16,37 @@ namespace OpenChams {
|
||||||
class Name;
|
class Name;
|
||||||
class Circuit;
|
class Circuit;
|
||||||
class Operator;
|
class Operator;
|
||||||
|
class Equation;
|
||||||
|
// class HighLevelCstr;
|
||||||
|
// class NRCCstr;
|
||||||
|
// class DDP;
|
||||||
|
|
||||||
class Sizing {
|
class Sizing {
|
||||||
public:
|
public:
|
||||||
Sizing(Circuit*);
|
Sizing(Circuit*);
|
||||||
|
|
||||||
Operator* addOperator(Name instanceName, Name operatorName, Name simulModel);
|
Operator* addOperator(Name instanceName, Name operatorName, Name simulModel);
|
||||||
void addEquation(Name equationName, std::string equation);
|
|
||||||
|
// 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 hasNoOperators();
|
||||||
inline bool hasNoEquations();
|
inline bool hasNoEquations();
|
||||||
inline const std::map<Name, Operator*>& getOperators();
|
inline const std::map<Name, Operator*>& getOperators();
|
||||||
inline const std::map<Name, std::string>& getEquations();
|
inline const std::map<Name, Equation*>& getEquations();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Circuit* _circuit;
|
Circuit* _circuit;
|
||||||
std::map<Name, Operator*> _operators; // instanceName <-> operator
|
std::map<Name, Operator*> _operators; // instanceName <-> operator
|
||||||
std::map<Name, std::string> _equations; // equationName <-> equation (string)
|
std::map<Name, Equation*> _equations; // equationName <-> equation (string)
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool Sizing::hasNoOperators() { return (_operators.size() == 0) ? true : false; };
|
inline bool Sizing::hasNoOperators() { return (_operators.size() == 0) ? true : false; };
|
||||||
inline bool Sizing::hasNoEquations() { return (_equations.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, Operator*>& Sizing::getOperators() { return _operators; };
|
||||||
inline const std::map<Name, std::string>& Sizing::getEquations() { return _equations; };
|
inline const std::map<Name, Equation*>& Sizing::getEquations() { return _equations; };
|
||||||
} // namespace
|
} // namespace
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue