2010-10-08 06:22:59 -05:00
# include <iostream>
# include <string>
using namespace std ;
# include "vlsisapd/liberty/Name.h"
# include "vlsisapd/liberty/Library.h"
2010-10-14 06:01:16 -05:00
# include "vlsisapd/liberty/Cell.h"
# include "vlsisapd/liberty/Pin.h"
# include "vlsisapd/liberty/Timing.h"
2010-10-08 06:22:59 -05:00
int main ( int argc , char * argv [ ] ) {
2010-10-08 06:47:06 -05:00
LIB : : Library * library = LIB : : Library : : readFromFile ( " ./testParse.lib " ) ;
2010-10-08 06:22:59 -05:00
if ( library ) {
2010-10-11 06:45:38 -05:00
// print of the library
2010-10-08 06:22:59 -05:00
library - > print ( ) ;
2010-10-15 06:13:53 -05:00
// 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 ( ) ;
}
2010-10-08 06:22:59 -05:00
} else {
cerr < < " library is NULL " < < endl ;
}
return 0 ;
}