ADDS:
- access to Sizing object in Circuit object (method getSizing()) - now driver is deterministic since it sorts names in alphabetical order (cannot use name's id since names are destroyed when converted to hurricane and then recreated before drive but with totaly unknow/uncontroled ids)
This commit is contained in:
parent
de38cf5496
commit
eefb15127a
|
@ -45,6 +45,19 @@ Circuit::Circuit(Name name, Name techno) : _name(name), _techno(techno), _netlis
|
|||
readSizingDone = false;
|
||||
}
|
||||
|
||||
// COMPARISON FUNCTION //
|
||||
bool ConnectionsSort(const pair<Name, Name>& p1, const pair<Name, Name>& p2) {
|
||||
return p1.first < p2.first;
|
||||
}
|
||||
|
||||
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) {
|
||||
transform(str.begin(), str.end(), str.begin(), ::toupper);
|
||||
|
@ -640,7 +653,9 @@ bool Circuit::writeToFile(string filePath) {
|
|||
}
|
||||
file << " <netlist>" << endl
|
||||
<< " <instances>" << endl;
|
||||
for (vector<Instance*>::const_iterator it = _netlist->getInstances().begin() ; it != _netlist->getInstances().end() ; ++it) {
|
||||
vector<Instance*> instances = _netlist->getInstances();
|
||||
sort(instances.begin(), instances.end(), InstanceNameSort); // sort based on instances' names
|
||||
for (vector<Instance*>::iterator it = instances.begin() ; it != instances.end() ; ++it) {
|
||||
Instance* inst = (*it);
|
||||
if (inst->hasNoConnectors()) {
|
||||
string error("[ERROR] Cannot writeToFile since instance (");
|
||||
|
@ -682,7 +697,9 @@ bool Circuit::writeToFile(string filePath) {
|
|||
}
|
||||
file << " </instances>" << endl
|
||||
<< " <nets>" << endl;
|
||||
for (vector<Net*>::const_iterator it = _netlist->getNets().begin() ; it != _netlist->getNets().end() ; ++it) {
|
||||
vector<Net*> nets = _netlist->getNets();
|
||||
sort(nets.begin(), nets.end(), NetNameSort); // sort based on nets' names
|
||||
for (vector<Net*>::iterator it = nets.begin() ; it != nets.end() ; ++it) {
|
||||
Net* net = (*it);
|
||||
if (net->hasNoConnectors()) {
|
||||
string error("[ERROR] Cannot writeToFile since net (");
|
||||
|
@ -693,7 +710,9 @@ bool Circuit::writeToFile(string filePath) {
|
|||
}
|
||||
string externStr = (net->isExternal()) ? "True" : "False";
|
||||
file << " <net name=\"" << net->getName().getString() << "\" type=\"" << net->getType().getString() << "\" isExternal=\"" << externStr << "\">" << endl;
|
||||
for (vector<pair<Name, Name> >::const_iterator it = net->getConnections().begin() ; it != net->getConnections().end() ; ++it) {
|
||||
vector<pair<Name, Name> > connections = net->getConnections();
|
||||
sort(connections.begin(), connections.end(), ConnectionsSort);
|
||||
for (vector<pair<Name, Name> >::iterator it = connections.begin() ; it != connections.end() ; ++it) {
|
||||
file << " <connector instance=\"" << (*it).first.getString() << "\" name=\"" << (*it).second.getString() << "\"/>" << endl;
|
||||
}
|
||||
file << " </net>" << endl;
|
||||
|
|
|
@ -35,6 +35,7 @@ class Circuit {
|
|||
inline double getValue(Name);
|
||||
inline Netlist* getNetlist();
|
||||
inline Schematic* getSchematic();
|
||||
inline Sizing* getSizing();
|
||||
inline void addParameter(Name, double);
|
||||
inline void addParameter(Name, std::string);
|
||||
inline Parameters getParameters();
|
||||
|
@ -86,6 +87,7 @@ inline Name Circuit::getTechno() { return _techno; };
|
|||
inline double Circuit::getValue(Name name) { return _params.getValue(name); };
|
||||
inline Netlist* Circuit::getNetlist() { return _netlist; };
|
||||
inline Schematic* Circuit::getSchematic() { return _schematic; };
|
||||
inline Sizing* Circuit::getSizing() { return _sizing; };
|
||||
inline void Circuit::addParameter(Name name, double value) { _params.addParameter(name, value); };
|
||||
inline void Circuit::addParameter(Name name, std::string eqStr) { _params.addParameter(name, eqStr); };
|
||||
inline Parameters Circuit::getParameters() { return _params; };
|
||||
|
|
|
@ -32,7 +32,7 @@ class Instance {
|
|||
inline void addParameter(Name, double);
|
||||
inline void addParameter(Name, std::string);
|
||||
inline void addTransistor(Transistor*);
|
||||
inline Name getName();
|
||||
inline Name getName() const;
|
||||
inline Name getModel();
|
||||
inline Name getMosType();
|
||||
inline bool isSourceBulkConnected();
|
||||
|
@ -43,7 +43,7 @@ class Instance {
|
|||
// pour parcourir les transistors
|
||||
inline bool hasNoTransistors();
|
||||
inline const std::vector<Transistor*>& getTransistors();
|
||||
|
||||
|
||||
private:
|
||||
Name _name;
|
||||
Name _model;
|
||||
|
@ -58,7 +58,7 @@ class Instance {
|
|||
inline void Instance::addParameter(Name name, double value) { _params.addParameter(name, value); };
|
||||
inline void Instance::addParameter(Name name, std::string eqStr) { _params.addParameter(name, eqStr); };
|
||||
inline void Instance::addTransistor(Transistor* tr) { _trans.push_back(tr); };
|
||||
inline Name Instance::getName() { return _name; };
|
||||
inline Name Instance::getName() const { return _name; };
|
||||
inline Name Instance::getModel() { return _model; };
|
||||
inline Name Instance::getMosType() { return _mosType; };
|
||||
inline bool Instance::isSourceBulkConnected() { return _sourceBulkConnected; };
|
||||
|
|
|
@ -48,8 +48,9 @@ bool Name::operator==(const string& str) {
|
|||
Name n(str);
|
||||
return (_id == n._id);
|
||||
}
|
||||
bool Name::operator<(const Name n) const {
|
||||
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
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class Name {
|
|||
|
||||
bool operator==(const Name&);
|
||||
bool operator==(const std::string&);
|
||||
bool operator<(const Name) const;
|
||||
bool operator<(const Name&) const;
|
||||
|
||||
inline const std::string& getString() const;
|
||||
|
||||
|
@ -32,7 +32,7 @@ class Name {
|
|||
const std::string *_str;
|
||||
|
||||
static std::map<std::string, unsigned long> _dict;
|
||||
static unsigned long _globalId;
|
||||
static unsigned long _globalId;
|
||||
};
|
||||
|
||||
inline const std::string& Name::getString() const{
|
||||
|
|
|
@ -23,7 +23,7 @@ class Net {
|
|||
|
||||
void connectTo(Name instanceName, Name connectorName);
|
||||
|
||||
inline Name getName();
|
||||
inline Name getName() const;
|
||||
inline Name getType();
|
||||
inline bool isExternal();
|
||||
inline Netlist* getNetlist();
|
||||
|
@ -31,7 +31,7 @@ class Net {
|
|||
//inline vector<pair<Name, Name> >::iterator getFirstConnectionIt();
|
||||
//inline vector<pair<Name, Name> >::iterator getLastConnectionIt();
|
||||
inline const std::vector<std::pair<Name, Name> >& getConnections();
|
||||
|
||||
|
||||
private:
|
||||
Name _name;
|
||||
Name _typeName;
|
||||
|
@ -40,7 +40,7 @@ class Net {
|
|||
std::vector<std::pair<Name, Name> > _connections; // <instanceName, connectorName>
|
||||
};
|
||||
|
||||
inline Name Net::getName() { return _name; };
|
||||
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; };
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* openChams
|
||||
*
|
||||
* Created by damien dupuis on 08/02/10.
|
||||
* Copyright 2010 UPMC / LIP6. All rights reserved.
|
||||
* Copyright 2008-2010 UPMC / LIP6. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -31,8 +31,8 @@ namespace OpenChams {
|
|||
|
||||
private:
|
||||
Circuit* _circuit;
|
||||
std::map<Name, Operator*> _operators; //instanceName <-> operator
|
||||
std::map<Name, std::string> _equations; //equationName <-> equation (string)
|
||||
std::map<Name, Operator*> _operators; // instanceName <-> operator
|
||||
std::map<Name, std::string> _equations; // equationName <-> equation (string)
|
||||
};
|
||||
|
||||
inline bool Sizing::hasNoOperators() { return (_operators.size() == 0) ? true : false; };
|
||||
|
|
Loading…
Reference in New Issue