- Improvment of parsing examples with examples of maps and vectors.
- No more pprint method in Python, now __repr__method encapsuling new c++ method getString.
This commit is contained in:
parent
2bc62b400b
commit
81d4d455bd
|
@ -14,9 +14,21 @@ int main ( int argc, char * argv[] ) {
|
|||
if ( library ) {
|
||||
// print of the library
|
||||
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;
|
||||
// print of one attribute in particular of a cell
|
||||
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;
|
||||
// print of all the attributes of a cell
|
||||
cout << "Attributes of no2_x1 :" << endl;
|
||||
for(map<LIB::Name, LIB::Attribute*>::const_iterator it=library->getCell(LIB::Name("no2_x1"))->getAttributes().begin() ; it!=library->getCell(LIB::Name("no2_x1"))->getAttributes().end() ; ++it) {
|
||||
cout << " name= " << (*it).first.getString()
|
||||
<< ", type= " << (*it).second->typeToString()
|
||||
<< ", value= " << (*it).second->valueAsString() << endl;
|
||||
}
|
||||
// print of all the timings of a pin
|
||||
cout << "Timing's atributes of pin nq of no2_x1 :" << endl;
|
||||
for (size_t i = 0 ; i < library->getCell(LIB::Name("no2_x1"))->getPin(LIB::Name("nq"))->getTimings().size() ; i++) {
|
||||
library->getCell(LIB::Name("no2_x1"))->getPin(LIB::Name("nq"))->getTimings()[i]->print();
|
||||
}
|
||||
} else {
|
||||
cerr << "library is NULL" << endl;
|
||||
}
|
||||
|
|
|
@ -4,10 +4,20 @@ library = Library.readFromFile("./testParse.lib")
|
|||
|
||||
if ( library ) :
|
||||
# print of the library
|
||||
library.pprint()
|
||||
# print of one attribute in particular
|
||||
print "| area of inv_x1= ", library.getCell("inv_x1").getAttribute("area").valueAsString()
|
||||
print "| timing intrinsic_rise of nq of inv_x1= ", library.getCell("inv_x1").getPin("nq").getTiming("i").getAttribute("intrinsic_rise").valueAsString()
|
||||
print library
|
||||
# print of one attribute in particular of a cell
|
||||
print "Area of inv_x1 :", library.getCell("inv_x1").getAttribute("area").valueAsString()
|
||||
print "Timing intrinsic_rise of nq of inv_x1 :", library.getCell("inv_x1").getPin("nq").getTiming("i").getAttribute("intrinsic_rise").valueAsString()
|
||||
# print of all the attributes of a cell
|
||||
print "Attributes of no2_x1 :"
|
||||
for attr in library.getCell("no2_x1").getAttributes() :
|
||||
print " name=", attr.key, \
|
||||
", type=", attr.value.typeToString(), \
|
||||
", value=", attr.value.valueAsString()
|
||||
# print of all the timings of a pin
|
||||
print "Timing's attributes of pin nq of no2_x1 :"
|
||||
for timing in library.getCell("no2_x1").getPin("nq").getTimings() :
|
||||
print timing
|
||||
else :
|
||||
raise ( "library is NULL" )
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include<iostream>
|
||||
#include<fstream>
|
||||
#include<sstream>
|
||||
using namespace std;
|
||||
|
||||
#include "vlsisapd/liberty/Cell.h"
|
||||
|
@ -60,26 +61,42 @@ void Cell::setTestCell(Cell *cell) {
|
|||
_testCell = cell;
|
||||
}
|
||||
|
||||
void Cell::print() {
|
||||
cout << "| Cell name= " << _name.getString() << endl;
|
||||
const string Cell::getString() const{
|
||||
ostringstream chaine;
|
||||
chaine << "| Cell name= " << _name.getString() << endl;
|
||||
|
||||
// Cell's attributes
|
||||
cout << "| Attributes :" << endl;
|
||||
chaine << "| Attributes :" << endl;
|
||||
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;
|
||||
chaine << "| name= " << (*it).first.getString()
|
||||
<< ", type= " << (*it).second->typeToString()
|
||||
<< ", value= " << (*it).second->valueAsString() << endl;
|
||||
}
|
||||
// Cell's pins
|
||||
for(map<Name, Pin*>::const_iterator it=_pins.begin() ; it!=_pins.end() ; ++it) {
|
||||
(*it).second->print();
|
||||
}
|
||||
// FF
|
||||
if(_ff)
|
||||
_ff->print();
|
||||
if(_ff) {
|
||||
chaine << "| FF noninverting= " << _ff->getNonInverting().getString() << ", inverting= " << _ff->getInverting().getString() << endl;
|
||||
|
||||
// FlipFlop's attributes
|
||||
chaine << "| Attributes :" << endl;
|
||||
for(map<Name, Attribute*>::const_iterator it=_ff->getAttributes().begin() ; it!=_ff->getAttributes().end() ; ++it) {
|
||||
chaine << "| name= " << (*it).first.getString()
|
||||
<< ", type= " << (*it).second->typeToString()
|
||||
<< ", value= " << (*it).second->valueAsString() << endl;
|
||||
}
|
||||
}
|
||||
// test_cell
|
||||
if(_testCell)
|
||||
_testCell->print();
|
||||
chaine << _testCell->getString();
|
||||
|
||||
return chaine.str();
|
||||
}
|
||||
|
||||
void Cell::print() {
|
||||
cout << Cell::getString();
|
||||
}
|
||||
|
||||
bool Cell::write(ofstream &file, bool test) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include<iostream>
|
||||
#include<fstream>
|
||||
#include<sstream>
|
||||
using namespace std;
|
||||
|
||||
#include "vlsisapd/liberty/FlipFlop.h"
|
||||
|
@ -28,16 +29,22 @@ void FlipFlop::addAttribute(Name attrName, Attribute::Type attrType, const strin
|
|||
_attributes[attrName] = attr;
|
||||
}
|
||||
|
||||
void FlipFlop::print() {
|
||||
cout << "| FF noninverting= " << _noninverting.getString() << ", inverting= " << _inverting.getString() << endl;
|
||||
const string FlipFlop::getString() const{
|
||||
ostringstream chaine;
|
||||
chaine << "| FF noninverting= " << _noninverting.getString() << ", inverting= " << _inverting.getString() << endl;
|
||||
|
||||
// FlipFlop's attributes
|
||||
cout << "| Attributes :" << endl;
|
||||
chaine << "| Attributes :" << endl;
|
||||
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;
|
||||
chaine << "| name= " << (*it).first.getString()
|
||||
<< ", type= " << (*it).second->typeToString()
|
||||
<< ", value= " << (*it).second->valueAsString() << endl;
|
||||
}
|
||||
return chaine.str();
|
||||
}
|
||||
|
||||
void FlipFlop::print() {
|
||||
cout << FlipFlop::getString();
|
||||
}
|
||||
|
||||
bool FlipFlop::write(ofstream &file) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include<iostream>
|
||||
#include<fstream>
|
||||
#include<sstream>
|
||||
#include<ctime>
|
||||
using namespace std;
|
||||
|
||||
|
@ -84,84 +85,85 @@ void Library::addCell(Name cellName) {
|
|||
_cells[cellName] = cell;
|
||||
}
|
||||
|
||||
void Library::print() {
|
||||
cout << "+-----------------------------+" << endl
|
||||
<< "| Library : " << _name.getString() << endl;
|
||||
const string Library::getString() const{
|
||||
ostringstream chaine;
|
||||
chaine << "+-----------------------------+" << endl
|
||||
<< "| Library : " << _name.getString() << endl;
|
||||
// Library's attributes
|
||||
cout << "| Attributes :" << endl;
|
||||
chaine << "| Attributes :" << endl;
|
||||
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();
|
||||
chaine << "| name=" << (*it).first.getString()
|
||||
<< ", type=" << (*it).second->typeToString()
|
||||
<< ", value=" << (*it).second->valueAsString();
|
||||
string unit = (*it).second->getUnit();
|
||||
if(!unit.empty())
|
||||
cout << ", unit=" << unit;
|
||||
cout << endl;
|
||||
chaine << ", unit=" << unit;
|
||||
chaine << endl;
|
||||
}
|
||||
|
||||
// WireLoad
|
||||
for(map<Name, WireLoad*>::const_iterator it=_wires_load.begin() ; it!=_wires_load.end() ; ++it) {
|
||||
// (*it).second->print();
|
||||
cout << "| Wireload : " << (*it).first.getString() << endl;
|
||||
chaine << "| Wireload : " << (*it).first.getString() << endl;
|
||||
// Wireload's attributes
|
||||
cout << "| Attributes :" << endl;
|
||||
chaine << "| Attributes :" << endl;
|
||||
for(map<Name, Attribute*>::const_iterator it2=(*it).second->getAttributes().begin() ; it2 != (*it).second->getAttributes().end() ; ++it2) {
|
||||
if ((*it2).second == NULL) {
|
||||
cerr << "NULL attribute !" << endl;
|
||||
exit(12);
|
||||
}
|
||||
cout << "| name=" << (*it2).first.getString()
|
||||
chaine << "| 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;
|
||||
chaine << ", value2=" << value2;
|
||||
chaine << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// WireLoadSelection
|
||||
// _wire_load_selection->print();
|
||||
cout << "| WireLoadSection name= " << _wire_load_selection->getName().getString() << endl;
|
||||
chaine << "| 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;
|
||||
chaine << "| 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
|
||||
for(map<Name, Cell*>::const_iterator it=_cells.begin() ; it!=_cells.end() ; ++it) {
|
||||
// (*it).second->print();
|
||||
cout << "| Cell name= " << (*it).first.getString() << endl;
|
||||
chaine << "| Cell name= " << (*it).first.getString() << endl;
|
||||
|
||||
// Cell's attributes
|
||||
cout << "| Attributes :" << endl;
|
||||
chaine << "| Attributes :" << endl;
|
||||
for(map<Name, Attribute*>::const_iterator it2=(*it).second->getAttributes().begin() ; it2!=(*it).second->getAttributes().end() ; ++it2) {
|
||||
cout << "| name= " << (*it2).first.getString()
|
||||
<< ", type= " << (*it2).second->typeToString()
|
||||
<< ", value= " << (*it2).second->valueAsString() << endl;
|
||||
chaine << "| name= " << (*it2).first.getString()
|
||||
<< ", type= " << (*it2).second->typeToString()
|
||||
<< ", value= " << (*it2).second->valueAsString() << endl;
|
||||
}
|
||||
// Cell's pins
|
||||
for(map<Name, Pin*>::const_iterator it2=(*it).second->getPins().begin() ; it2!=(*it).second->getPins().end() ; ++it2) {
|
||||
// (*it2).second->print();
|
||||
cout << "| Pin name= " << (*it2).first.getString() << endl;
|
||||
chaine << "| Pin name= " << (*it2).first.getString() << endl;
|
||||
// Pin's attributes
|
||||
cout << "| Attributes :" << endl;
|
||||
chaine << "| Attributes :" << endl;
|
||||
for(map<Name, Attribute*>::const_iterator it3=(*it2).second->getAttributes().begin() ; it3!=(*it2).second->getAttributes().end() ; ++it3) {
|
||||
cout << "| name= " << (*it3).first.getString()
|
||||
<< ", type= " << (*it3).second->typeToString()
|
||||
<< ", value= " << (*it3).second->valueAsString() << endl;
|
||||
chaine << "| name= " << (*it3).first.getString()
|
||||
<< ", type= " << (*it3).second->typeToString()
|
||||
<< ", value= " << (*it3).second->valueAsString() << endl;
|
||||
}
|
||||
// Timing
|
||||
for (size_t i = 0 ; i < (*it2).second->getTimings().size() ; i++) {
|
||||
// Timing's attributes
|
||||
cout << "| Timing's attributes :" << endl;
|
||||
chaine << "| Timing's attributes :" << endl;
|
||||
for(map<Name, Attribute*>::const_iterator it3=(*it2).second->getTimings()[i]->getAttributes().begin() ; it3!=(*it2).second->getTimings()[i]->getAttributes().end() ; ++it3) {
|
||||
cout << "| name= " << (*it3).first.getString()
|
||||
<< ", type= " << (*it3).second->typeToString()
|
||||
<< ", value= " << (*it3).second->valueAsString() << endl;
|
||||
chaine << "| name= " << (*it3).first.getString()
|
||||
<< ", type= " << (*it3).second->typeToString()
|
||||
<< ", value= " << (*it3).second->valueAsString() << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -169,12 +171,12 @@ void Library::print() {
|
|||
// if(_ff)
|
||||
// _ff->print();
|
||||
if((*it).second->getFF()) {
|
||||
cout << "| FF noninverting= " << (*it).second->getFF()->getNonInverting().getString() << ", inverting= " << (*it).second->getFF()->getInverting().getString() << endl;
|
||||
cout << "| Attributes :" << endl;
|
||||
chaine << "| FF noninverting= " << (*it).second->getFF()->getNonInverting().getString() << ", inverting= " << (*it).second->getFF()->getInverting().getString() << endl;
|
||||
chaine << "| Attributes :" << endl;
|
||||
for(map<Name, Attribute*>::const_iterator it2=(*it).second->getFF()->getAttributes().begin() ; it2!=(*it).second->getFF()->getAttributes().end() ; ++it2) {
|
||||
cout << "| name= " << (*it2).first.getString()
|
||||
<< ", type= " << (*it2).second->typeToString()
|
||||
<< ", value= " << (*it2).second->valueAsString() << endl;
|
||||
chaine << "| name= " << (*it2).first.getString()
|
||||
<< ", type= " << (*it2).second->typeToString()
|
||||
<< ", value= " << (*it2).second->valueAsString() << endl;
|
||||
}
|
||||
}
|
||||
// test_cell
|
||||
|
@ -182,34 +184,34 @@ void Library::print() {
|
|||
// _testCell->print();
|
||||
Cell* testCell = (*it).second->getTestCell();
|
||||
if(testCell) {
|
||||
cout << "| Test Cell" << endl;
|
||||
chaine << "| Test Cell" << endl;
|
||||
|
||||
// Cell's attributes
|
||||
cout << "| Attributes :" << endl;
|
||||
chaine << "| Attributes :" << endl;
|
||||
for(map<Name, Attribute*>::const_iterator it2=testCell->getAttributes().begin() ; it2!=testCell->getAttributes().end() ; ++it2) {
|
||||
cout << "| name= " << (*it2).first.getString()
|
||||
<< ", type= " << (*it2).second->typeToString()
|
||||
<< ", value= " << (*it2).second->valueAsString() << endl;
|
||||
chaine << "| name= " << (*it2).first.getString()
|
||||
<< ", type= " << (*it2).second->typeToString()
|
||||
<< ", value= " << (*it2).second->valueAsString() << endl;
|
||||
}
|
||||
// Cell's pins
|
||||
for(map<Name, Pin*>::const_iterator it2=(*it).second->getPins().begin() ; it2!=(*it).second->getPins().end() ; ++it2) {
|
||||
// (*it2).second->print();
|
||||
cout << "| Pin name= " << (*it2).first.getString() << endl;
|
||||
chaine << "| Pin name= " << (*it2).first.getString() << endl;
|
||||
// Pin's attributes
|
||||
cout << "| Attributes :" << endl;
|
||||
chaine << "| Attributes :" << endl;
|
||||
for(map<Name, Attribute*>::const_iterator it3=(*it2).second->getAttributes().begin() ; it3!=(*it2).second->getAttributes().end() ; ++it3) {
|
||||
cout << "| name= " << (*it3).first.getString()
|
||||
<< ", type= " << (*it3).second->typeToString()
|
||||
<< ", value= " << (*it3).second->valueAsString() << endl;
|
||||
chaine << "| name= " << (*it3).first.getString()
|
||||
<< ", type= " << (*it3).second->typeToString()
|
||||
<< ", value= " << (*it3).second->valueAsString() << endl;
|
||||
}
|
||||
// Timing
|
||||
for (size_t i = 0 ; i < (*it2).second->getTimings().size() ; i++) {
|
||||
// Timing's attributes
|
||||
cout << "| Timing's attributes :" << endl;
|
||||
chaine << "| Timing's attributes :" << endl;
|
||||
for(map<Name, Attribute*>::const_iterator it3=(*it2).second->getTimings()[i]->getAttributes().begin() ; it3!=(*it2).second->getTimings()[i]->getAttributes().end() ; ++it3) {
|
||||
cout << "| name= " << (*it3).first.getString()
|
||||
<< ", type= " << (*it3).second->typeToString()
|
||||
<< ", value= " << (*it3).second->valueAsString() << endl;
|
||||
chaine << "| name= " << (*it3).first.getString()
|
||||
<< ", type= " << (*it3).second->typeToString()
|
||||
<< ", value= " << (*it3).second->valueAsString() << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -217,18 +219,23 @@ void Library::print() {
|
|||
// if(_ff)
|
||||
// _ff->print();
|
||||
if((*it).second->getFF()) {
|
||||
cout << "| FF noninverting= " << (*it).second->getFF()->getNonInverting().getString() << ", inverting= " << (*it).second->getFF()->getInverting().getString() << endl;
|
||||
cout << "| Attributes :" << endl;
|
||||
chaine << "| FF noninverting= " << (*it).second->getFF()->getNonInverting().getString() << ", inverting= " << (*it).second->getFF()->getInverting().getString() << endl;
|
||||
chaine << "| Attributes :" << endl;
|
||||
for(map<Name, Attribute*>::const_iterator it2=(*it).second->getFF()->getAttributes().begin() ; it2!=(*it).second->getFF()->getAttributes().end() ; ++it2) {
|
||||
cout << "| name= " << (*it2).first.getString()
|
||||
<< ", type= " << (*it2).second->typeToString()
|
||||
<< ", value= " << (*it2).second->valueAsString() << endl;
|
||||
chaine << "| name= " << (*it2).first.getString()
|
||||
<< ", type= " << (*it2).second->typeToString()
|
||||
<< ", value= " << (*it2).second->valueAsString() << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cout << "+-----------------------------+" << endl;
|
||||
};
|
||||
chaine << "+-----------------------------+" << endl;
|
||||
return chaine.str();
|
||||
}
|
||||
|
||||
void Library::print() {
|
||||
cout << Library::getString();
|
||||
}
|
||||
|
||||
bool Library::writeToFile(string filename) {
|
||||
time_t curtime = time(0);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include<iostream>
|
||||
#include<fstream>
|
||||
#include<sstream>
|
||||
using namespace std;
|
||||
|
||||
#include "vlsisapd/liberty/Timing.h"
|
||||
|
@ -44,20 +45,31 @@ void Pin::addTiming() {
|
|||
_timings.push_back(timing);
|
||||
}
|
||||
|
||||
void Pin::print() {
|
||||
cout << "| Pin name= " << _name.getString() << endl;
|
||||
const string Pin::getString() const{
|
||||
ostringstream chaine;
|
||||
chaine << "| Pin name= " << _name.getString() << endl;
|
||||
|
||||
// Pin's attributes
|
||||
cout << "| Attributes :" << endl;
|
||||
chaine << "| Attributes :" << endl;
|
||||
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;
|
||||
chaine << "| name= " << (*it).first.getString()
|
||||
<< ", type= " << (*it).second->typeToString()
|
||||
<< ", value= " << (*it).second->valueAsString() << endl;
|
||||
}
|
||||
// Timing
|
||||
for (size_t i = 0 ; i < _timings.size() ; i++) {
|
||||
_timings[i]->print();
|
||||
chaine << "| Timing's attributes :" << endl;
|
||||
for(map<Name, Attribute*>::const_iterator it=_timings[i]->getAttributes().begin() ; it!=_timings[i]->getAttributes().end() ; ++it) {
|
||||
chaine << "| name= " + (*it).first.getString()
|
||||
<< ", type= " + (*it).second->typeToString()
|
||||
<< ", value= " + (*it).second->valueAsString() << endl;
|
||||
}
|
||||
}
|
||||
return chaine.str();
|
||||
}
|
||||
|
||||
void Pin::print() {
|
||||
cout << Pin::getString();
|
||||
}
|
||||
|
||||
bool Pin::write(ofstream &file) {
|
||||
|
|
|
@ -88,7 +88,7 @@ BOOST_PYTHON_MODULE(LIBERTY) {
|
|||
|
||||
// class Liberty::WireLoad
|
||||
//////////////////////////
|
||||
class_<WireLoad>("WireLoad", init<Name>())
|
||||
class_<WireLoad, WireLoad*>("WireLoad", init<Name>())
|
||||
// properties
|
||||
.add_property("name", &WireLoad::getName) // no setter => readonly
|
||||
// accessors
|
||||
|
@ -97,13 +97,13 @@ BOOST_PYTHON_MODULE(LIBERTY) {
|
|||
// modifiers
|
||||
.def("addAttribute", &WireLoad::addAttribute, addAttribute_overloads())
|
||||
// miscellaneous
|
||||
.def("pprint", &WireLoad::print)
|
||||
.def("__repr__", &WireLoad::getString)
|
||||
.def("write", &WireLoad::write)
|
||||
;
|
||||
|
||||
// class Liberty::WireLoadArea
|
||||
//////////////////////////////
|
||||
class_<WireLoadArea>("WireLoadArea", init<double, double, Name>())
|
||||
class_<WireLoadArea, WireLoadArea*>("WireLoadArea", init<double, double, Name>())
|
||||
// properties
|
||||
.add_property("min", &WireLoadArea::getMin) // no setter => readonly
|
||||
.add_property("max", &WireLoadArea::getMax) // no setter => readonly
|
||||
|
@ -114,7 +114,7 @@ BOOST_PYTHON_MODULE(LIBERTY) {
|
|||
|
||||
// class Liberty::WireLoadSelection
|
||||
///////////////////////////////////
|
||||
class_<WireLoadSelection>("WireLoadSelection", init<Name>())
|
||||
class_<WireLoadSelection, WireLoadSelection*>("WireLoadSelection", init<Name>())
|
||||
// properties
|
||||
.add_property("name", &WireLoadSelection::getName) // no setter => readonly
|
||||
// accessors
|
||||
|
@ -122,13 +122,13 @@ BOOST_PYTHON_MODULE(LIBERTY) {
|
|||
// modifiers
|
||||
.def("addWireLoadArea", &WireLoadSelection::addWireLoadArea)
|
||||
// miscellaneous
|
||||
.def("pprint", &WireLoadSelection::print)
|
||||
.def("__repr__", &WireLoadSelection::getString)
|
||||
.def("write", &WireLoadSelection::write)
|
||||
;
|
||||
|
||||
// class Liberty::Cell
|
||||
//////////////////////
|
||||
class_<Cell>("Cell", init<Name>())
|
||||
class_<Cell, Cell*>("Cell", init<Name>())
|
||||
// properties
|
||||
.add_property("name", &Cell::getName) // no setter => readonly
|
||||
// accessors
|
||||
|
@ -144,13 +144,13 @@ BOOST_PYTHON_MODULE(LIBERTY) {
|
|||
.def("addFF", &Cell::addFF)
|
||||
.def("setTestCell", &Cell::setTestCell)
|
||||
// miscellaneous
|
||||
.def("pprint", &Cell::print)
|
||||
.def("__repr__", &Cell::getString)
|
||||
.def("write", &Cell::write)
|
||||
;
|
||||
|
||||
// class Liberty::Pin
|
||||
/////////////////////
|
||||
class_<Pin>("Pin", init<Name>())
|
||||
class_<Pin, Pin*>("Pin", init<Name>())
|
||||
// properties
|
||||
.add_property("name", &Pin::getName) // no setter => readonly
|
||||
// accessors
|
||||
|
@ -162,26 +162,26 @@ BOOST_PYTHON_MODULE(LIBERTY) {
|
|||
.def("addAttribute", &Pin::addAttribute)
|
||||
.def("addTiming", &Pin::addTiming)
|
||||
// miscellaneous
|
||||
.def("pprint", &Pin::print)
|
||||
.def("__repr__", &Pin::getString)
|
||||
.def("write", &Pin::write)
|
||||
;
|
||||
|
||||
// class Liberty::Timing
|
||||
////////////////////////
|
||||
class_<Timing>("Timing", init<>())
|
||||
class_<Timing, Timing*>("Timing", init<>())
|
||||
// accessors
|
||||
.def("getAttributes", &Timing::getAttributes, return_internal_reference<>())
|
||||
.def("getAttribute", &Timing::getAttribute, return_value_policy<reference_existing_object>())
|
||||
// modifiers
|
||||
.def("addAttribute", &Timing::addAttribute)
|
||||
// miscellaneous
|
||||
.def("pprint", &Timing::print)
|
||||
.def("__repr__", &Timing::getString)
|
||||
.def("write", &Timing::write)
|
||||
;
|
||||
|
||||
// class Liberty::FlipFlop
|
||||
//////////////////////////
|
||||
class_<FlipFlop>("FlipFlop", init<Name, Name>())
|
||||
class_<FlipFlop, FlipFlop*>("FlipFlop", init<Name, Name>())
|
||||
// properties
|
||||
.add_property("noninverting", &FlipFlop::getNonInverting) // no setter => readonly
|
||||
.add_property("inverting", &FlipFlop::getInverting) // no setter => readonly
|
||||
|
@ -191,13 +191,13 @@ BOOST_PYTHON_MODULE(LIBERTY) {
|
|||
// modifiers
|
||||
.def("addAttribute", &FlipFlop::addAttribute)
|
||||
// miscellaneous
|
||||
.def("pprint", &FlipFlop::print)
|
||||
.def("__repr__", &FlipFlop::getString)
|
||||
.def("write", &FlipFlop::write)
|
||||
;
|
||||
|
||||
// class Liberty::Library
|
||||
/////////////////////////
|
||||
class_<Library>("Library", init<Name>())
|
||||
class_<Library, Library*>("Library", init<Name>())
|
||||
// properties
|
||||
.add_property("name", &Library::getName) // no setter => readonly
|
||||
// accessors
|
||||
|
@ -214,7 +214,7 @@ BOOST_PYTHON_MODULE(LIBERTY) {
|
|||
.def("addWireLoadSelection", &Library::addWireLoadSelection)
|
||||
.def("addCell", &Library::addCell)
|
||||
// miscellaneous
|
||||
.def("pprint", &Library::print ) // "print" does not work in Python
|
||||
.def("__repr__", &Library::getString)
|
||||
.def("readFromFile", &Library::readFromFile, return_value_policy<reference_existing_object>())
|
||||
.staticmethod("readFromFile")
|
||||
.def("writeToFile", &Library::writeToFile)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include<iostream>
|
||||
#include<fstream>
|
||||
#include<sstream>
|
||||
using namespace std;
|
||||
|
||||
#include "vlsisapd/liberty/Timing.h"
|
||||
|
@ -28,14 +29,20 @@ void Timing::addAttribute(Name attrName, Attribute::Type attrType, const string&
|
|||
_attributes[attrName] = attr;
|
||||
}
|
||||
|
||||
void Timing::print() {
|
||||
const string Timing::getString() const{
|
||||
// Timing's attributes
|
||||
cout << "| Timing's attributes :" << endl;
|
||||
ostringstream chaine;
|
||||
chaine << "| Timing's attributes :" << endl;
|
||||
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;
|
||||
chaine << "| name= " + (*it).first.getString()
|
||||
<< ", type= " + (*it).second->typeToString()
|
||||
<< ", value= " + (*it).second->valueAsString() << endl;
|
||||
}
|
||||
return chaine.str();
|
||||
}
|
||||
|
||||
void Timing::print() {
|
||||
cout << Timing::getString();
|
||||
}
|
||||
|
||||
bool Timing::write(ofstream &file) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include<iostream>
|
||||
#include<fstream>
|
||||
#include<sstream>
|
||||
using namespace std;
|
||||
|
||||
#include "vlsisapd/liberty/WireLoad.h"
|
||||
|
@ -28,19 +29,25 @@ void WireLoad::addAttribute(Name attrName, Attribute::Type attrType, const strin
|
|||
_attributes[attrName] = attr;
|
||||
}
|
||||
|
||||
void WireLoad::print() {
|
||||
const string WireLoad::getString() const{
|
||||
ostringstream chaine;
|
||||
// WireLoad's attributes
|
||||
cout << "| Wireload : " << _name.getString() << endl;
|
||||
cout << "| Attributes :" << endl;
|
||||
chaine << "| Wireload : " << _name.getString() << endl
|
||||
<< "| Attributes :" << endl;
|
||||
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();
|
||||
chaine << "| name= " << (*it).first.getString()
|
||||
<< ", type= " << (*it).second->typeToString()
|
||||
<< ", value= " << (*it).second->valueAsString();
|
||||
string value2=(*it).second->secondValueAsString();
|
||||
if(!value2.empty())
|
||||
cout << ", value2= " << value2;
|
||||
cout << endl;
|
||||
chaine << ", value2= " << value2;
|
||||
chaine << endl;
|
||||
}
|
||||
return chaine.str();
|
||||
}
|
||||
|
||||
void WireLoad::print() {
|
||||
cout << WireLoad::getString();
|
||||
}
|
||||
|
||||
bool WireLoad::write(ofstream &file) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include<iostream>
|
||||
#include<fstream>
|
||||
#include<sstream>
|
||||
using namespace std;
|
||||
|
||||
#include "vlsisapd/liberty/WireLoadArea.h"
|
||||
|
@ -13,14 +14,20 @@ void WireLoadSelection::addWireLoadArea(double min, double max, Name name) {
|
|||
_wires_load_area.push_back(area);
|
||||
}
|
||||
|
||||
void WireLoadSelection::print() {
|
||||
cout << "| WireLoadSection name= " << _name.getString() << endl;
|
||||
const string WireLoadSelection::getString() const{
|
||||
ostringstream chaine;
|
||||
chaine << "| WireLoadSection name= " << _name.getString() << endl;
|
||||
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;
|
||||
chaine << "| wire_load_from_area name= " << _wires_load_area[i]->getName().getString()
|
||||
<< ", min= " << _wires_load_area[i]->getMin()
|
||||
<< ", max= " << _wires_load_area[i]->getMax()
|
||||
<< endl;
|
||||
}
|
||||
return chaine.str();
|
||||
}
|
||||
|
||||
void WireLoadSelection::print() {
|
||||
cout << WireLoadSelection::getString();
|
||||
}
|
||||
|
||||
bool WireLoadSelection::write(ofstream& file) {
|
||||
|
|
|
@ -26,6 +26,7 @@ class Cell {
|
|||
void addFF(Name noninverting, Name inverting);
|
||||
void setTestCell(Cell *cell);
|
||||
|
||||
const std::string getString()const;
|
||||
void print();
|
||||
bool write(std::ofstream &file, bool test=false);
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ class FlipFlop {
|
|||
|
||||
void addAttribute(Name attrName, Attribute::Type attrType, const std::string& attrValue);
|
||||
|
||||
const std::string getString()const;
|
||||
void print();
|
||||
bool write(std::ofstream &file);
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ class Library {
|
|||
void addWireLoadSelection(Name wireLoadSelectionName);
|
||||
void addCell(Name cellName);
|
||||
|
||||
const std::string getString()const;
|
||||
void print();
|
||||
|
||||
static Library* readFromFile(std::string);
|
||||
|
|
|
@ -22,6 +22,7 @@ class Pin {
|
|||
void addAttribute(Name attrName, Attribute::Type attrType, const std::string& attrValue);
|
||||
void addTiming();
|
||||
|
||||
const std::string getString()const;
|
||||
void print();
|
||||
bool write(std::ofstream &file);
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ class Timing {
|
|||
|
||||
void addAttribute(Name attrName, Attribute::Type attrType, const std::string& attrValue);
|
||||
|
||||
const std::string getString() const;
|
||||
void print();
|
||||
bool write(std::ofstream &file);
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ class WireLoad {
|
|||
|
||||
void addAttribute(Name attrName, Attribute::Type attrType, const std::string& attrValue, const std::string& attrValue2 = "");
|
||||
|
||||
const std::string getString()const;
|
||||
void print();
|
||||
bool write(std::ofstream &file);
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@ class WireLoadSelection {
|
|||
inline std::vector<WireLoadArea*>& getWiresLoadArea();
|
||||
|
||||
void addWireLoadArea(double min, double max, Name name);
|
||||
|
||||
const std::string getString()const;
|
||||
void print();
|
||||
bool write(std::ofstream& file);
|
||||
|
||||
|
|
Loading…
Reference in New Issue