Useful getters.
This commit is contained in:
parent
6660ae8663
commit
3db947d302
|
@ -54,7 +54,7 @@ int main ( int argc, char * argv[] ) {
|
||||||
// Timing
|
// Timing
|
||||||
LIB::Timing * timing;
|
LIB::Timing * timing;
|
||||||
pin->addTiming();
|
pin->addTiming();
|
||||||
timing = pin->getTiming().back();
|
timing = pin->getTimings().back();
|
||||||
valeur="negative_unate"; timing->addAttribute(LIB::Name("timing_sense"), LIB::Attribute::String, valeur);
|
valeur="negative_unate"; timing->addAttribute(LIB::Name("timing_sense"), LIB::Attribute::String, valeur);
|
||||||
valeur="e"; timing->addAttribute(LIB::Name("related_pin"), LIB::Attribute::String, valeur);
|
valeur="e"; timing->addAttribute(LIB::Name("related_pin"), LIB::Attribute::String, valeur);
|
||||||
valeur="0.101"; timing->addAttribute(LIB::Name("intrinsic_rise"), LIB::Attribute::Double, valeur);
|
valeur="0.101"; timing->addAttribute(LIB::Name("intrinsic_rise"), LIB::Attribute::Double, valeur);
|
||||||
|
|
|
@ -9,7 +9,11 @@ int main ( int argc, char * argv[] ) {
|
||||||
LIB::Library* library = LIB::Library::readFromFile("./testParse.lib");
|
LIB::Library* library = LIB::Library::readFromFile("./testParse.lib");
|
||||||
|
|
||||||
if ( library ) {
|
if ( library ) {
|
||||||
|
// print of the library
|
||||||
library->print();
|
library->print();
|
||||||
|
// print of one attribute in particular
|
||||||
|
cout << "| area of inv_x1= " << library->getCell(LIB::Name("inv_x1"))->getAttribute(LIB::Name("area"))->valueAsString() << endl;
|
||||||
|
cout << "| timing intrinsic_rise of nq of inv_x1= " << library->getCell(LIB::Name("inv_x1"))->getPin(LIB::Name("nq"))->getTiming(LIB::Name("i"))->getAttribute(LIB::Name("intrinsic_rise"))->valueAsString() << endl;
|
||||||
} else {
|
} else {
|
||||||
cerr << "library is NULL" << endl;
|
cerr << "library is NULL" << endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,8 +53,8 @@ double Attribute::secondValueAsDouble() const {
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
string Attribute::typeToString(Attribute::Type type) {
|
string Attribute::typeToString() {
|
||||||
switch(type) {
|
switch(_type) {
|
||||||
case Unknown: return "unknown";
|
case Unknown: return "unknown";
|
||||||
case String: return "string";
|
case String: return "string";
|
||||||
case Bool: return "bool";
|
case Bool: return "bool";
|
||||||
|
|
|
@ -9,7 +9,18 @@ using namespace std;
|
||||||
#include "vlsisapd/liberty/FlipFlop.h"
|
#include "vlsisapd/liberty/FlipFlop.h"
|
||||||
|
|
||||||
namespace LIB {
|
namespace LIB {
|
||||||
Cell::Cell(Name name): _name(name), _attributes(), _pins(), _ff(NULL), _test_cell(NULL) {};
|
Cell::Cell(Name name): _name(name), _attributes(), _pins(), _ff(NULL), _testCell(NULL) {};
|
||||||
|
|
||||||
|
Attribute* Cell::getAttribute(Name attrName) {
|
||||||
|
Attribute* attr = NULL;
|
||||||
|
map<Name, Attribute*>::iterator it = _attributes.find(attrName);
|
||||||
|
if (it == _attributes.end()) {
|
||||||
|
cerr << "[ERROR] Cell " << _name.getString() << " has no attribute named " << attrName.getString() << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
attr= (*it).second;
|
||||||
|
return attr;
|
||||||
|
}
|
||||||
|
|
||||||
Pin* Cell::getPin(Name pinName) {
|
Pin* Cell::getPin(Name pinName) {
|
||||||
Pin* pin = NULL;
|
Pin* pin = NULL;
|
||||||
|
@ -48,7 +59,7 @@ void Cell::addFF(Name noninverting, Name inverting) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cell::setTestCell(Cell *cell) {
|
void Cell::setTestCell(Cell *cell) {
|
||||||
_test_cell = cell;
|
_testCell = cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cell::print() {
|
void Cell::print() {
|
||||||
|
@ -58,7 +69,7 @@ void Cell::print() {
|
||||||
cout << "| Attributes :" << endl;
|
cout << "| Attributes :" << endl;
|
||||||
for(map<Name, Attribute*>::const_iterator it=_attributes.begin() ; it!=_attributes.end() ; ++it) {
|
for(map<Name, Attribute*>::const_iterator it=_attributes.begin() ; it!=_attributes.end() ; ++it) {
|
||||||
cout << "| name= " << (*it).first.getString()
|
cout << "| name= " << (*it).first.getString()
|
||||||
<< ", type= " << (*it).second->typeToString((*it).second->getType())
|
<< ", type= " << (*it).second->typeToString()
|
||||||
<< ", value= " << (*it).second->valueAsString() << endl;
|
<< ", value= " << (*it).second->valueAsString() << endl;
|
||||||
}
|
}
|
||||||
// Cell's pins
|
// Cell's pins
|
||||||
|
@ -69,8 +80,8 @@ void Cell::print() {
|
||||||
if(_ff)
|
if(_ff)
|
||||||
_ff->print();
|
_ff->print();
|
||||||
// test_cell
|
// test_cell
|
||||||
if(_test_cell)
|
if(_testCell)
|
||||||
_test_cell->print();
|
_testCell->print();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Cell::write(ofstream &file, bool test) {
|
bool Cell::write(ofstream &file, bool test) {
|
||||||
|
@ -95,8 +106,8 @@ bool Cell::write(ofstream &file, bool test) {
|
||||||
if(_ff)
|
if(_ff)
|
||||||
_ff->write(file);
|
_ff->write(file);
|
||||||
// test_cell
|
// test_cell
|
||||||
if(_test_cell)
|
if(_testCell)
|
||||||
_test_cell->write(file, true);
|
_testCell->write(file, true);
|
||||||
file << " }" << endl;
|
file << " }" << endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,17 @@ using namespace std;
|
||||||
namespace LIB {
|
namespace LIB {
|
||||||
FlipFlop::FlipFlop(Name noninverting, Name inverting): _noninverting(noninverting), _inverting(inverting), _attributes() {};
|
FlipFlop::FlipFlop(Name noninverting, Name inverting): _noninverting(noninverting), _inverting(inverting), _attributes() {};
|
||||||
|
|
||||||
|
Attribute* FlipFlop::getAttribute(Name attrName) {
|
||||||
|
Attribute* attr = NULL;
|
||||||
|
map<Name, Attribute*>::iterator it = _attributes.find(attrName);
|
||||||
|
if (it == _attributes.end()) {
|
||||||
|
cerr << "[ERROR] FlipFLop has no attribute named " << attrName.getString() << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
attr= (*it).second;
|
||||||
|
return attr;
|
||||||
|
}
|
||||||
|
|
||||||
void FlipFlop::addAttribute(Name attrName, Attribute::Type attrType, string& attrValue) {
|
void FlipFlop::addAttribute(Name attrName, Attribute::Type attrType, string& attrValue) {
|
||||||
Attribute* attr = new Attribute(attrName, attrType, attrValue);
|
Attribute* attr = new Attribute(attrName, attrType, attrValue);
|
||||||
map<Name, Attribute*>::iterator it = _attributes.find(attrName);
|
map<Name, Attribute*>::iterator it = _attributes.find(attrName);
|
||||||
|
@ -26,7 +37,7 @@ void FlipFlop::print() {
|
||||||
cout << "| Attributes :" << endl;
|
cout << "| Attributes :" << endl;
|
||||||
for(map<Name, Attribute*>::const_iterator it=_attributes.begin() ; it!=_attributes.end() ; ++it) {
|
for(map<Name, Attribute*>::const_iterator it=_attributes.begin() ; it!=_attributes.end() ; ++it) {
|
||||||
cout << "| name= " << (*it).first.getString()
|
cout << "| name= " << (*it).first.getString()
|
||||||
<< ", type= " << (*it).second->typeToString((*it).second->getType())
|
<< ", type= " << (*it).second->typeToString()
|
||||||
<< ", value= " << (*it).second->valueAsString() << endl;
|
<< ", value= " << (*it).second->valueAsString() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -408,7 +408,7 @@ timing_header
|
||||||
: TIMING '(' ')'
|
: TIMING '(' ')'
|
||||||
{
|
{
|
||||||
library->getCell(currentCell)->getPin(listPins.back())->addTiming();
|
library->getCell(currentCell)->getPin(listPins.back())->addTiming();
|
||||||
currentTiming=library->getCell(currentCell)->getPin(listPins.back())->getTiming().back();
|
currentTiming=library->getCell(currentCell)->getPin(listPins.back())->getTimings().back();
|
||||||
// only for 1 pin, not available for pins' list
|
// only for 1 pin, not available for pins' list
|
||||||
if(listPins.size()>1)
|
if(listPins.size()>1)
|
||||||
cerr << "[Warning] timing information for a list of pins, not available." << endl;
|
cerr << "[Warning] timing information for a list of pins, not available." << endl;
|
||||||
|
|
|
@ -72,28 +72,167 @@ void Library::addCell(Name cellName) {
|
||||||
|
|
||||||
void Library::print() {
|
void Library::print() {
|
||||||
cout << "+-----------------------------+" << endl
|
cout << "+-----------------------------+" << endl
|
||||||
<< "| Library name= " << _name.getString() << endl;
|
<< "| Library : " << _name.getString() << endl;
|
||||||
|
|
||||||
// Library's attributes
|
// Library's attributes
|
||||||
cout << "| Attributes :" << endl;
|
cout << "| Attributes :" << endl;
|
||||||
for(map<Name, Attribute*>::const_iterator it=_attributes.begin() ; it!=_attributes.end() ; ++it) {
|
for(map<Name, Attribute*>::const_iterator it=_attributes.begin() ; it!=_attributes.end() ; ++it) {
|
||||||
cout << "| name= " << (*it).first.getString()
|
cout << "| name=" << (*it).first.getString()
|
||||||
<< ", type= " << (*it).second->typeToString((*it).second->getType())
|
<< ", type=" << (*it).second->typeToString()
|
||||||
<< ", value= " << (*it).second->valueAsString();
|
<< ", value=" << (*it).second->valueAsString();
|
||||||
string unit = (*it).second->getUnit();
|
string unit = (*it).second->getUnit();
|
||||||
if(!unit.empty())
|
if(!unit.empty())
|
||||||
cout << ", unit= " << unit;
|
cout << ", unit=" << unit;
|
||||||
cout << endl;
|
cout << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
map<Name, Attribute*> attributes;
|
||||||
|
map<Name, Pin*> pins;
|
||||||
|
vector<Timing*> timings;
|
||||||
|
FlipFlop* ff;
|
||||||
|
|
||||||
// WireLoad
|
// WireLoad
|
||||||
for(map<Name, WireLoad*>::const_iterator it=_wires_load.begin() ; it!=_wires_load.end() ; ++it) {
|
for(map<Name, WireLoad*>::const_iterator it=_wires_load.begin() ; it!=_wires_load.end() ; ++it) {
|
||||||
(*it).second->print();
|
// (*it).second->print();
|
||||||
|
cout << "| Wireload : " << (*it).first.getString() << endl;
|
||||||
|
// Wireload's attributes
|
||||||
|
cout << "| Attributes :" << endl;
|
||||||
|
attributes = (*it).second->getAttributes();
|
||||||
|
for(map<Name, Attribute*>::const_iterator it2=attributes.begin() ; it2 != attributes.end() ; ++it2) {
|
||||||
|
if ((*it2).second == NULL) {
|
||||||
|
cerr << "NULL attribute !" << endl;
|
||||||
|
exit(12);
|
||||||
|
}
|
||||||
|
cout << "| name=" << (*it2).first.getString()
|
||||||
|
<< ", type=" << (*it2).second->typeToString()
|
||||||
|
<< ", value=" << (*it2).second->valueAsString();
|
||||||
|
string value2=(*it2).second->secondValueAsString();
|
||||||
|
if(!value2.empty())
|
||||||
|
cout << ", value2=" << value2;
|
||||||
|
cout << endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WireLoadSelection
|
// WireLoadSelection
|
||||||
_wire_load_selection->print();
|
// _wire_load_selection->print();
|
||||||
|
cout << "| WireLoadSection name= " << _wire_load_selection->getName().getString() << endl;
|
||||||
|
vector<WireLoadArea*> wires_load_area = _wire_load_selection->getWiresLoadArea();
|
||||||
|
for(size_t i = 0 ; i < wires_load_area.size() ; i++) {
|
||||||
|
cout << "| wire_load_from_area name= " << wires_load_area[i]->getName().getString()
|
||||||
|
<< ", min= " << wires_load_area[i]->getMin()
|
||||||
|
<< ", max= " << wires_load_area[i]->getMax()
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Cell
|
// Cell
|
||||||
for(map<Name, Cell*>::const_iterator it=_cells.begin() ; it!=_cells.end() ; ++it) {
|
for(map<Name, Cell*>::const_iterator it=_cells.begin() ; it!=_cells.end() ; ++it) {
|
||||||
(*it).second->print();
|
// (*it).second->print();
|
||||||
|
cout << "| Cell name= " << (*it).first.getString() << endl;
|
||||||
|
|
||||||
|
// Cell's attributes
|
||||||
|
cout << "| Attributes :" << endl;
|
||||||
|
attributes=(*it).second->getAttributes();
|
||||||
|
for(map<Name, Attribute*>::const_iterator it2=attributes.begin() ; it2!=attributes.end() ; ++it2) {
|
||||||
|
cout << "| name= " << (*it2).first.getString()
|
||||||
|
<< ", type= " << (*it2).second->typeToString()
|
||||||
|
<< ", value= " << (*it2).second->valueAsString() << endl;
|
||||||
|
}
|
||||||
|
// Cell's pins
|
||||||
|
pins=(*it).second->getPins();
|
||||||
|
for(map<Name, Pin*>::const_iterator it2=pins.begin() ; it2!=pins.end() ; ++it2) {
|
||||||
|
// (*it2).second->print();
|
||||||
|
cout << "| Pin name= " << (*it2).first.getString() << endl;
|
||||||
|
// Pin's attributes
|
||||||
|
cout << "| Attributes :" << endl;
|
||||||
|
attributes=(*it2).second->getAttributes();
|
||||||
|
for(map<Name, Attribute*>::const_iterator it3=attributes.begin() ; it3!=attributes.end() ; ++it3) {
|
||||||
|
cout << "| name= " << (*it3).first.getString()
|
||||||
|
<< ", type= " << (*it3).second->typeToString()
|
||||||
|
<< ", value= " << (*it3).second->valueAsString() << endl;
|
||||||
|
}
|
||||||
|
// Timing
|
||||||
|
timings=(*it2).second->getTimings();
|
||||||
|
for (size_t i = 0 ; i < timings.size() ; i++) {
|
||||||
|
attributes=timings[i]->getAttributes();
|
||||||
|
// Timing's attributes
|
||||||
|
cout << "| Timing's attributes :" << endl;
|
||||||
|
for(map<Name, Attribute*>::const_iterator it3=attributes.begin() ; it3!=attributes.end() ; ++it3) {
|
||||||
|
cout << "| name= " << (*it3).first.getString()
|
||||||
|
<< ", type= " << (*it3).second->typeToString()
|
||||||
|
<< ", value= " << (*it3).second->valueAsString() << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// FF
|
||||||
|
// if(_ff)
|
||||||
|
// _ff->print();
|
||||||
|
ff = (*it).second->getFF();
|
||||||
|
if(ff) {
|
||||||
|
cout << "| FF noninverting= " << ff->getNonInverting().getString() << ", inverting= " << ff->getInverting().getString() << endl;
|
||||||
|
cout << "| Attributes :" << endl;
|
||||||
|
attributes=ff->getAttributes();
|
||||||
|
for(map<Name, Attribute*>::const_iterator it=attributes.begin() ; it!=attributes.end() ; ++it) {
|
||||||
|
cout << "| name= " << (*it).first.getString()
|
||||||
|
<< ", type= " << (*it).second->typeToString()
|
||||||
|
<< ", value= " << (*it).second->valueAsString() << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// test_cell
|
||||||
|
// if(_testCell)
|
||||||
|
// _testCell->print();
|
||||||
|
Cell* testCell = (*it).second->getTestCell();
|
||||||
|
if(testCell) {
|
||||||
|
cout << "| Test Cell" << endl;
|
||||||
|
|
||||||
|
// Cell's attributes
|
||||||
|
cout << "| Attributes :" << endl;
|
||||||
|
attributes=testCell->getAttributes();
|
||||||
|
for(map<Name, Attribute*>::const_iterator it2=attributes.begin() ; it2!=attributes.end() ; ++it2) {
|
||||||
|
cout << "| name= " << (*it2).first.getString()
|
||||||
|
<< ", type= " << (*it2).second->typeToString()
|
||||||
|
<< ", value= " << (*it2).second->valueAsString() << endl;
|
||||||
|
}
|
||||||
|
// Cell's pins
|
||||||
|
pins=(*it).second->getPins();
|
||||||
|
for(map<Name, Pin*>::const_iterator it2=pins.begin() ; it2!=pins.end() ; ++it2) {
|
||||||
|
// (*it2).second->print();
|
||||||
|
cout << "| Pin name= " << (*it2).first.getString() << endl;
|
||||||
|
// Pin's attributes
|
||||||
|
cout << "| Attributes :" << endl;
|
||||||
|
attributes=(*it2).second->getAttributes();
|
||||||
|
for(map<Name, Attribute*>::const_iterator it3=attributes.begin() ; it3!=attributes.end() ; ++it3) {
|
||||||
|
cout << "| name= " << (*it3).first.getString()
|
||||||
|
<< ", type= " << (*it3).second->typeToString()
|
||||||
|
<< ", value= " << (*it3).second->valueAsString() << endl;
|
||||||
|
}
|
||||||
|
// Timing
|
||||||
|
timings=(*it2).second->getTimings();
|
||||||
|
for (size_t i = 0 ; i < timings.size() ; i++) {
|
||||||
|
attributes=timings[i]->getAttributes();
|
||||||
|
// Timing's attributes
|
||||||
|
cout << "| Timing's attributes :" << endl;
|
||||||
|
for(map<Name, Attribute*>::const_iterator it3=attributes.begin() ; it3!=attributes.end() ; ++it3) {
|
||||||
|
cout << "| name= " << (*it3).first.getString()
|
||||||
|
<< ", type= " << (*it3).second->typeToString()
|
||||||
|
<< ", value= " << (*it3).second->valueAsString() << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// FF
|
||||||
|
// if(_ff)
|
||||||
|
// _ff->print();
|
||||||
|
ff = (*it).second->getFF();
|
||||||
|
if(ff) {
|
||||||
|
cout << "| FF noninverting= " << ff->getNonInverting().getString() << ", inverting= " << ff->getInverting().getString() << endl;
|
||||||
|
cout << "| Attributes :" << endl;
|
||||||
|
attributes=ff->getAttributes();
|
||||||
|
for(map<Name, Attribute*>::const_iterator it2=attributes.begin() ; it2!=attributes.end() ; ++it2) {
|
||||||
|
cout << "| name= " << (*it2).first.getString()
|
||||||
|
<< ", type= " << (*it2).second->typeToString()
|
||||||
|
<< ", value= " << (*it2).second->valueAsString() << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cout << "+-----------------------------+" << endl;
|
cout << "+-----------------------------+" << endl;
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,6 +9,27 @@ using namespace std;
|
||||||
namespace LIB {
|
namespace LIB {
|
||||||
Pin::Pin(Name name): _name(name), _attributes(), _timings() {};
|
Pin::Pin(Name name): _name(name), _attributes(), _timings() {};
|
||||||
|
|
||||||
|
Attribute* Pin::getAttribute(Name attrName) {
|
||||||
|
Attribute* attr = NULL;
|
||||||
|
map<Name, Attribute*>::iterator it = _attributes.find(attrName);
|
||||||
|
if (it == _attributes.end()) {
|
||||||
|
cerr << "[ERROR] Pin " << _name.getString() << " has no attribute named " << attrName.getString() << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
attr= (*it).second;
|
||||||
|
return attr;
|
||||||
|
}
|
||||||
|
|
||||||
|
Timing* Pin::getTiming(Name pinName) {
|
||||||
|
for (size_t i = 0 ; i < _timings.size() ; i++) {
|
||||||
|
if (pinName.getString() == _timings[i]->getAttribute(Name("related_pin"))->valueAsString()) {
|
||||||
|
return _timings[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cerr << "[ERROR] Pin " << _name.getString() << " has no timing related to pin named " << pinName.getString() << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
void Pin::addAttribute(Name attrName, Attribute::Type attrType, string& attrValue) {
|
void Pin::addAttribute(Name attrName, Attribute::Type attrType, string& attrValue) {
|
||||||
Attribute* attr = new Attribute(attrName, attrType, attrValue);
|
Attribute* attr = new Attribute(attrName, attrType, attrValue);
|
||||||
map<Name, Attribute*>::iterator it = _attributes.find(attrName);
|
map<Name, Attribute*>::iterator it = _attributes.find(attrName);
|
||||||
|
@ -31,7 +52,7 @@ void Pin::print() {
|
||||||
cout << "| Attributes :" << endl;
|
cout << "| Attributes :" << endl;
|
||||||
for(map<Name, Attribute*>::const_iterator it=_attributes.begin() ; it!=_attributes.end() ; ++it) {
|
for(map<Name, Attribute*>::const_iterator it=_attributes.begin() ; it!=_attributes.end() ; ++it) {
|
||||||
cout << "| name= " << (*it).first.getString()
|
cout << "| name= " << (*it).first.getString()
|
||||||
<< ", type= " << (*it).second->typeToString((*it).second->getType())
|
<< ", type= " << (*it).second->typeToString()
|
||||||
<< ", value= " << (*it).second->valueAsString() << endl;
|
<< ", value= " << (*it).second->valueAsString() << endl;
|
||||||
}
|
}
|
||||||
// Timing
|
// Timing
|
||||||
|
|
|
@ -9,6 +9,17 @@ using namespace std;
|
||||||
namespace LIB {
|
namespace LIB {
|
||||||
Timing::Timing(): _attributes() {};
|
Timing::Timing(): _attributes() {};
|
||||||
|
|
||||||
|
Attribute* Timing::getAttribute(Name attrName) {
|
||||||
|
Attribute* attr = NULL;
|
||||||
|
map<Name, Attribute*>::iterator it = _attributes.find(attrName);
|
||||||
|
if (it == _attributes.end()) {
|
||||||
|
cerr << "[ERROR] Timing has no attribute named " << attrName.getString() << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
attr= (*it).second;
|
||||||
|
return attr;
|
||||||
|
}
|
||||||
|
|
||||||
void Timing::addAttribute(Name attrName, Attribute::Type attrType, string& attrValue) {
|
void Timing::addAttribute(Name attrName, Attribute::Type attrType, string& attrValue) {
|
||||||
Attribute* attr = new Attribute(attrName, attrType, attrValue);
|
Attribute* attr = new Attribute(attrName, attrType, attrValue);
|
||||||
map<Name, Attribute*>::iterator it = _attributes.find(attrName);
|
map<Name, Attribute*>::iterator it = _attributes.find(attrName);
|
||||||
|
@ -24,7 +35,7 @@ void Timing::print() {
|
||||||
cout << "| Timing's attributes :" << endl;
|
cout << "| Timing's attributes :" << endl;
|
||||||
for(map<Name, Attribute*>::const_iterator it=_attributes.begin() ; it!=_attributes.end() ; ++it) {
|
for(map<Name, Attribute*>::const_iterator it=_attributes.begin() ; it!=_attributes.end() ; ++it) {
|
||||||
cout << "| name= " << (*it).first.getString()
|
cout << "| name= " << (*it).first.getString()
|
||||||
<< ", type= " << (*it).second->typeToString((*it).second->getType())
|
<< ", type= " << (*it).second->typeToString()
|
||||||
<< ", value= " << (*it).second->valueAsString() << endl;
|
<< ", value= " << (*it).second->valueAsString() << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,17 @@ using namespace std;
|
||||||
namespace LIB {
|
namespace LIB {
|
||||||
WireLoad::WireLoad(Name name): _name(name), _attributes() {};
|
WireLoad::WireLoad(Name name): _name(name), _attributes() {};
|
||||||
|
|
||||||
|
Attribute* WireLoad::getAttribute(Name attrName) {
|
||||||
|
Attribute* attr = NULL;
|
||||||
|
map<Name, Attribute*>::iterator it = _attributes.find(attrName);
|
||||||
|
if (it == _attributes.end()) {
|
||||||
|
cerr << "[ERROR] WireLoad " << _name.getString() << " has no attribute named " << attrName.getString() << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
attr= (*it).second;
|
||||||
|
return attr;
|
||||||
|
}
|
||||||
|
|
||||||
void WireLoad::addAttribute(Name attrName, Attribute::Type attrType, string& attrValue, const string& attrValue2) {
|
void WireLoad::addAttribute(Name attrName, Attribute::Type attrType, string& attrValue, const string& attrValue2) {
|
||||||
Attribute* attr = new Attribute(attrName, attrType, attrValue, "", attrValue2);
|
Attribute* attr = new Attribute(attrName, attrType, attrValue, "", attrValue2);
|
||||||
map<Name, Attribute*>::iterator it = _attributes.find(attrName);
|
map<Name, Attribute*>::iterator it = _attributes.find(attrName);
|
||||||
|
@ -25,7 +36,7 @@ void WireLoad::print() {
|
||||||
cout << "| Attributes :" << endl;
|
cout << "| Attributes :" << endl;
|
||||||
for(map<Name, Attribute*>::const_iterator it=_attributes.begin() ; it!=_attributes.end() ; ++it) {
|
for(map<Name, Attribute*>::const_iterator it=_attributes.begin() ; it!=_attributes.end() ; ++it) {
|
||||||
cout << "| name= " << (*it).first.getString()
|
cout << "| name= " << (*it).first.getString()
|
||||||
<< ", type= " << (*it).second->typeToString((*it).second->getType())
|
<< ", type= " << (*it).second->typeToString()
|
||||||
<< ", value= " << (*it).second->valueAsString();
|
<< ", value= " << (*it).second->valueAsString();
|
||||||
string value2=(*it).second->secondValueAsString();
|
string value2=(*it).second->secondValueAsString();
|
||||||
if(!value2.empty())
|
if(!value2.empty())
|
||||||
|
|
|
@ -26,12 +26,12 @@ class Attribute {
|
||||||
|
|
||||||
inline const std::string& valueAsString() const;
|
inline const std::string& valueAsString() const;
|
||||||
inline const std::string& secondValueAsString() const;
|
inline const std::string& secondValueAsString() const;
|
||||||
bool valueAsBool() const;
|
bool valueAsBool() const;
|
||||||
int valueAsInt() const;
|
int valueAsInt() const;
|
||||||
double valueAsDouble() const;
|
double valueAsDouble() const;
|
||||||
double secondValueAsDouble() const;
|
double secondValueAsDouble() const;
|
||||||
std::string typeToString(Type type);
|
std::string typeToString();
|
||||||
bool write(std::ofstream &file);
|
bool write(std::ofstream &file);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Name _name;
|
Name _name;
|
||||||
|
|
|
@ -15,8 +15,12 @@ class Cell {
|
||||||
Cell(Name name);
|
Cell(Name name);
|
||||||
|
|
||||||
inline Name getName();
|
inline Name getName();
|
||||||
Pin* getPin(Name pinName);
|
inline std::map<Name, Attribute*> getAttributes();
|
||||||
|
inline std::map<Name, Pin*> getPins();
|
||||||
inline FlipFlop* getFF();
|
inline FlipFlop* getFF();
|
||||||
|
inline Cell* getTestCell();
|
||||||
|
Attribute* getAttribute(Name attrName);
|
||||||
|
Pin* getPin(Name pinName);
|
||||||
|
|
||||||
void addAttribute(Name attrName, Attribute::Type attrType, std::string& attrValue);
|
void addAttribute(Name attrName, Attribute::Type attrType, std::string& attrValue);
|
||||||
void addPin(Name pinName);
|
void addPin(Name pinName);
|
||||||
|
@ -31,11 +35,14 @@ class Cell {
|
||||||
std::map<Name, Attribute*> _attributes;
|
std::map<Name, Attribute*> _attributes;
|
||||||
std::map<Name, Pin*> _pins;
|
std::map<Name, Pin*> _pins;
|
||||||
FlipFlop* _ff;
|
FlipFlop* _ff;
|
||||||
Cell* _test_cell;
|
Cell* _testCell;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline Name Cell::getName() { return _name; };
|
inline Name Cell::getName() { return _name; };
|
||||||
|
inline std::map<Name, Pin*> Cell::getPins() { return _pins; };
|
||||||
|
inline std::map<Name, Attribute*> Cell::getAttributes() { return _attributes; };
|
||||||
inline FlipFlop* Cell::getFF() { return _ff; };
|
inline FlipFlop* Cell::getFF() { return _ff; };
|
||||||
|
inline Cell* Cell::getTestCell() { return _testCell; };
|
||||||
|
|
||||||
} // namespace LIB
|
} // namespace LIB
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -12,6 +12,11 @@ class FlipFlop {
|
||||||
public:
|
public:
|
||||||
FlipFlop(Name noninverting, Name inverting);
|
FlipFlop(Name noninverting, Name inverting);
|
||||||
|
|
||||||
|
inline Name getNonInverting();
|
||||||
|
inline Name getInverting();
|
||||||
|
inline std::map<Name, Attribute*> getAttributes();
|
||||||
|
Attribute* getAttribute(Name attrName);
|
||||||
|
|
||||||
void addAttribute(Name attrName, Attribute::Type attrType, std::string& attrValue);
|
void addAttribute(Name attrName, Attribute::Type attrType, std::string& attrValue);
|
||||||
|
|
||||||
void print();
|
void print();
|
||||||
|
@ -23,5 +28,9 @@ class FlipFlop {
|
||||||
std::map<Name, Attribute*> _attributes;
|
std::map<Name, Attribute*> _attributes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline Name FlipFlop::getNonInverting() { return _noninverting; };
|
||||||
|
inline Name FlipFlop::getInverting() { return _inverting; };
|
||||||
|
inline std::map<Name, Attribute*> FlipFlop::getAttributes() { return _attributes; };
|
||||||
|
|
||||||
} // namespace LIB
|
} // namespace LIB
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,12 +1,3 @@
|
||||||
/*
|
|
||||||
* Name.h
|
|
||||||
* openChams
|
|
||||||
*
|
|
||||||
* Created by damien dupuis on 18/12/09.
|
|
||||||
* Copyright 2009 UPMC / LIP6. All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __LIB_NAME_H__
|
#ifndef __LIB_NAME_H__
|
||||||
#define __LIB_NAME_H__
|
#define __LIB_NAME_H__
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,10 @@ class Pin {
|
||||||
Pin(Name name);
|
Pin(Name name);
|
||||||
|
|
||||||
inline Name getName();
|
inline Name getName();
|
||||||
inline std::vector<Timing*> getTiming();
|
inline std::map<Name, Attribute*> getAttributes();
|
||||||
|
inline std::vector<Timing*> getTimings();
|
||||||
|
Attribute* getAttribute(Name attrName);
|
||||||
|
Timing* getTiming(Name pinName);
|
||||||
|
|
||||||
void addAttribute(Name attrName, Attribute::Type attrType, std::string& attrValue);
|
void addAttribute(Name attrName, Attribute::Type attrType, std::string& attrValue);
|
||||||
void addTiming();
|
void addTiming();
|
||||||
|
@ -30,7 +33,8 @@ class Pin {
|
||||||
};
|
};
|
||||||
|
|
||||||
inline Name Pin::getName() { return _name; };
|
inline Name Pin::getName() { return _name; };
|
||||||
inline std::vector<Timing*> Pin::getTiming() { return _timings; };
|
inline std::map<Name, Attribute*> Pin::getAttributes() { return _attributes; };
|
||||||
|
inline std::vector<Timing*> Pin::getTimings() { return _timings; };
|
||||||
|
|
||||||
} // namespace LIB
|
} // namespace LIB
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -12,6 +12,9 @@ class Timing {
|
||||||
public:
|
public:
|
||||||
Timing();
|
Timing();
|
||||||
|
|
||||||
|
inline std::map<Name, Attribute*> getAttributes();
|
||||||
|
Attribute* getAttribute(Name attrName);
|
||||||
|
|
||||||
void addAttribute(Name attrName, Attribute::Type attrType, std::string& attrValue);
|
void addAttribute(Name attrName, Attribute::Type attrType, std::string& attrValue);
|
||||||
|
|
||||||
void print();
|
void print();
|
||||||
|
@ -21,5 +24,7 @@ class Timing {
|
||||||
std::map<Name, Attribute*> _attributes;
|
std::map<Name, Attribute*> _attributes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline std::map<Name, Attribute*> Timing::getAttributes() { return _attributes; };
|
||||||
|
|
||||||
} // namespace LIB
|
} // namespace LIB
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,6 +11,8 @@ class WireLoad {
|
||||||
WireLoad(Name name);
|
WireLoad(Name name);
|
||||||
|
|
||||||
inline Name getName();
|
inline Name getName();
|
||||||
|
inline std::map<Name, Attribute*> getAttributes();
|
||||||
|
Attribute* getAttribute(Name attrName);
|
||||||
|
|
||||||
void addAttribute(Name attrName, Attribute::Type attrType, std::string& attrValue, const std::string& attrValue2 = "");
|
void addAttribute(Name attrName, Attribute::Type attrType, std::string& attrValue, const std::string& attrValue2 = "");
|
||||||
|
|
||||||
|
@ -23,6 +25,7 @@ class WireLoad {
|
||||||
};
|
};
|
||||||
|
|
||||||
inline Name WireLoad::getName() { return _name; };
|
inline Name WireLoad::getName() { return _name; };
|
||||||
|
inline std::map<Name, Attribute*> WireLoad::getAttributes() { return _attributes; };
|
||||||
|
|
||||||
} // namespace LIB
|
} // namespace LIB
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,6 +13,9 @@ class WireLoadSelection {
|
||||||
public:
|
public:
|
||||||
WireLoadSelection(Name name);
|
WireLoadSelection(Name name);
|
||||||
|
|
||||||
|
inline Name getName();
|
||||||
|
inline std::vector<WireLoadArea*> getWiresLoadArea();
|
||||||
|
|
||||||
void addWireLoadArea(double min, double max, Name name);
|
void addWireLoadArea(double min, double max, Name name);
|
||||||
void print();
|
void print();
|
||||||
bool write(std::ofstream& file);
|
bool write(std::ofstream& file);
|
||||||
|
@ -22,5 +25,8 @@ class WireLoadSelection {
|
||||||
std::vector<WireLoadArea*> _wires_load_area;
|
std::vector<WireLoadArea*> _wires_load_area;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline Name WireLoadSelection::getName() { return _name; };
|
||||||
|
inline std::vector<WireLoadArea*> WireLoadSelection::getWiresLoadArea() { return _wires_load_area; };
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue