The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Liberty::Parser - Parser for Synopsys Liberty(.lib).

VERSION

Version 0.03

SYNOPSIS

  use Liberty::Parser;
  my $parser = new Liberty::Parser;
  my $library_group  = $parser->read_file("standard_cell.lib");

  my $lib_name = $parser->get_group_name($library_group);
  print "Library Name: $lib_name\n";
  print $parser->get_attr_with_value($library_group,"nom_temperature");

DESCRIPTION

Liberty::Parser is indeed a Perl wrapper for a Liberty Parser which is written in C from Synopsys's Open Liberty Project.

Liberty::Parser harnesses Open Libety Project with Perl through the help of SWIG (www.swig.org) and implemented many handy functions to make information extracting from Liberty can be easily accomplished.

To get Liberty::Parser work, you have to download liberty_parse from Open Liberty Project. Compile the C source into linked library then put the linked library at somewhere it can be found through the environment variable LD_LIBRARY_PATH. Please follow the guide in the INSTALLATION section of README.

BASIC FUNTIONS

new

To new a Liberty::Parser object.

read_file

read_file :*group : (string filename)

Read the liberty format file and return a group handle.

locate_cell

locate_cell : *group : (*group, string cell_name)

Return the handle of group type `cell'.

locate_port

locate_port : *group : (*group, string port_name) Return the handle of group type `port'.

locate_group

locate_group : *group : (*group, string group_name) Return the handle of group type `cell'.

locate_group_by_type

  $parser->locate_group_by_type($g, $type_name);

locate_cell_arc

  $parser->locate_cell_arc($g, $type_name);

get_group_name

get_group_name : string : (*group) Return the group name while input a group handle. Example:

  print $p->get_group_name($g_func);

get_group_names

get_group_names : array : (*group G) Return the handle of group type `cell'. Example:

 my @j = $p->get_group_names ($f_cell);
 dump_array(\@j);

get_groups_by_type

Return the handle of group type `cell'. Example:

 my @j = $p->get_groups_by_type($group, $type_name);

get_group_type

get_group_type : string : (*group G) Return the type name of the group G. Example:

 print $p->get_group_type($g);

get_attr_name

get_attr_name : string : (*attr A) Return the attribute name while input a attribute handle.

get_attr_type

Return the attribute type while input a attribute handle.

 get_attr_type : string : (*attr A)

get_value_type

get_value_type : string : (*attr)

Return the value type of attribute A.

get_simple_attr_value

  $parser->get_simple_attr_value($group, $attr_name);

get_attr_with_value

get_attr_with_value : string : (*group, string attr_name) Return a string with attriubte name and attribute value.

get_lookup_table_index_1

 input1: 
 input2: 
 return: 2D array
 Ex:
 $parser->get_lookup_table_index($group);

get_lookup_table_index_2

 input1: 
 input2: 
 return: 2D array
 Ex:
 $parser->get_lookup_table_index_2($group);

get_lookup_table

 input1: 
 input2: 
 return: 2D array
 Ex:
 $parser->get_lookup_table($group);

get_lookup_table_center

 input1: timing type group
 input2: cell_rise, cell_fall...
 return: number
 Ex:
 $rise = $parser->get_lookup_table_array($timing_group, "cell_rise");

get_lookup_table_center

 input1: timing type group
 input2: cell_rise, cell_fall...
 return: number
 Ex:
 $rise = $parser->get_lookup_table_center($timing_group, "cell_rise");
 input1: a reference to timing group
 input2: pin name as string
 return: 1 or 0
 Ex:
 $parser->check_related_pin($timing_group, $pin_name);

check_group_type

 input: pin, timing, cell_rise, cell_fall, ...
 return: 1 or 0
 Ex:
 $parser->check_group_type($group, "pin");

print_attrs : void : (*group G) Print all attributes of a group G.

Print timing arc of group G(must be a pin type group.) Example:

 $parser->print_timing_arc($pin_group);

print_groups : void : (*group G) Print groups contained in group G in format "type:name". Example:

 $p->print_groups($g);

get_cell_delay

 $parser->get_cell_delay($pin_group);

is_var

is_var : Return the handle of group type `cell'.

COMPLEX FUNTIONS

extract_group

extract_group : string : (*group G, int indent) Return the whole content of the group G.

extract_group_1

extract_group_1 : string : (*group G, int indent) Return the "surface" of the group G.

all_attrs

all_attrs : string : (*group G, int indent) Return the handle of group type `cell'.

PRIMITIVE FUNCTIONS

  lib_PICreateGroup
  lib_GroupCreateAttr
  lib_AttrGetAttrType
  lib_AttrGetName
  lib_ComplexAttrAddInt32Value
  lib_ComplexAttrAddStringValue
  lib_ComplexAttrAddBooleanValue
  lib_ComplexAttrAddFloat64Value
  lib_ComplexAttrAddExprValue
  lib_ComplexAttrGetValues
  lib_IterNextComplex
  lib_ComplexValGetValueType
  lib_ComplexValGetInt32Value
  lib_ComplexValGetFloat64Value
  lib_ComplexValGetStringValue
  lib_ComplexValGetBooleanValue
  lib_ComplexValGetExprValue
  lib_SimpleAttrGetValueType
  lib_SimpleAttrGetInt32Value
  lib_SimpleAttrGetFloat64Value
  lib_SimpleAttrGetStringValue
  lib_SimpleAttrGetBooleanValue
  lib_SimpleAttrGetExprValue
  lib_SimpleAttrSetInt32Value
  lib_SimpleAttrSetBooleanValue
  lib_SimpleAttrSetFloat64Value
  lib_SimpleAttrSetStringValue
  lib_SimpleAttrSetExprValue
  lib_SimpleAttrGetIsVar
  lib_SimpleAttrSetIsVar
  lib_ExprDestroy
  lib_CreateExpr
  lib_CreateBooleanValExpr
  lib_CreateDoubleValExpr
  lib_CreateStringValExpr
  lib_CreateIntValExpr
  lib_CreateBinaryOpExpr
  lib_CreateUnaryOpExpr
  lib_ExprToString
  lib_ExprGetType
  lib_ValExprGetValueType
  lib_IntValExprGetInt
  lib_DoubleValExprGetDouble
  lib_BooleanValExprGetBoolean
  lib_StringValExprGetString
  lib_OpExprGetLeftExpr
  lib_OpExprGetRightExpr
  lib_GroupCreateDefine
  lib_DefineGetInfo
  lib_DefineGetName
  lib_DefineGetAllowedGroupName
  lib_DefineGetValueType
  lib_GroupCreateGroup
  lib_GroupGetGroupType
  lib_GroupGetComment
  lib_GroupSetComment
  lib_AttrGetComment
  lib_AttrSetComment
  lib_DefineGetComment
  lib_DefineSetComment
  lib_GroupAddName
  lib_GroupDeleteName
  lib_PIFindGroupByName
  lib_GroupFindGroupByName
  lib_GroupFindAttrByName
  lib_GroupFindDefineByName
  lib_PIFindDefineByName
  lib_PIGetGroups
  lib_GroupGetGroups
  lib_GroupGetNames
  lib_GroupGetAttrs
  lib_GroupGetDefines
  lib_IterNextGroup
  lib_IterNextName
  lib_IterNextAttr
  lib_IterNextDefine
  lib_IterQuit
  lib_ObjectDelete
  lib_PIGetErrorText
  lib_PIGetNullId
  lib_PIInit
  lib_PIQuit
  lib_ObjectGetObjectType
  lib_ObjectGetOwner
  lib_ObjectIsNull
  lib_ObjectIsSame
  lib_ObjectIsUsable
  lib_ObjectSetFileName
  lib_ObjectSetLineNo
  lib_ObjectGetLineNo
  lib_ObjectGetFileName
  lib_ReadLibertyFile
  lib_WriteLibertyFile
  lib_CheckLibertyLibrary
  lib_PIGetTraceMode
  lib_PIUnSetTraceMode
  lib_PISetTraceMode
  lib_PISetDebugMode
  lib_PIUnSetDebugMode
  lib_PIGetDebugMode
  lib_PISetNocheckMode
  lib_PIUnSetNocheckMode
  lib_PIGetNocheckMode
  lib_GroupMoveAfter
  lib_GroupMoveBefore

SEE ALSO

OpenSource Liberty Project

http://www.opensourceliberty.org

AUTHOR

yorkwu, <yorkwuo@gmail.com>

COPYRIGHT AND LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.