-
Notifications
You must be signed in to change notification settings - Fork 76
Gate Library
The gate library is a container for all gate types that are available within a selected standard cell library. Commonly, such standard cell libraries are proprietary. HAL comes with a few selected libraries that mainly describe FPGAs. However, the reverse engineer is free to add any library he desires by either using the supplemented gate library parsers or writing a new one for the desired gate library format.
In HAL, a gate library comprises a name, the path to its underlying file, and a collection of gate types. It can be constructed giving just a name and the input path using its constructor GateLibrary
. Access to its name and path are provided by the get_name
and get_path
functions.
gl = GateLibrary("path/to/example_library.lib", "example_library") # construct a new (empty) gate library
name = gl.get_name() # get the name of the gate library
path = gl.get_path() # get the path to the gate library file
It is currently not possible to create new gate types from within Python, but only via the C++ API. However, to operate on existing gate types, diverse functions are provided to the user. For example, contains_gate_type
and contains_gate_type_by_name
may be used to check whether a gate type is part of the gate library. While get_get_type_by_name
may be utilized to retrieve a gate type of the specified name from the gate library (if available), the function get_gate_types
returns all gate types available in the gate library. The latter function additionally allows for a filter condition to be specified, in case the user wants to narrow down the result set.
gl.contains_gate_type(some_gt) # returns True if some_gt exists within the gate library
gl.contains_gate_type_by_name("some_gt") # returns True if a gate type with name "some_gt" exists within the library
gt = gl.get_gate_type_by_name("some_gt") # returns gate type 'some_gt'
gate_types = gl.get_gate_types() # get all gate types of that library
Since the gate library keeps track of types that act as VCC or GND sources, the functions mark_vcc_gate_type
and mark_gnd_gate_type
may be used to declare a gate type to be such a VCC or GND type. Usually, these special gate types are automatically annotated after successful parsing of the gate library. However, manually manipulating the gate library may require additional gate types being marked accordingly. Additionally, using get_vcc_gate_types
and get_vcc_gate_types
, the user can retrieve a list of these special gate types. Each gate library needs to provide at least one VCC and one GND gate type. If no such type is present within the gate library file that is parsed by HAL, a new gate type fulfilling that purpose is created by HAL automatically.