-
Notifications
You must be signed in to change notification settings - Fork 76
Gate Library
The gate library is a container for all [gate types](Gate Type) that are available within a selected standard cell library. Commonly, such standard cell libraries are proprietary. Hence, HAL only 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 new ones.
In HAL, a gate library comprises a name, the path to its underlying file, and the gate types it contains. 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
New gate types can be added using the add_gate_type
function. Additionally, contains_gate_type
may be used to check whether a gate type is part of the gate library. The function get_gate_types
returns all gate types available in the gate library.
some_gate_type = hal_py.GateType("example_gate_type") # create a new gate type
gl.add_gate_type(some_gate_type) # add a new gate type
gate_types = gl.get_gate_types() # get all gate types of that library
print(gl.contains_gate_type(some_gate_type)) # prints True
Since the gate library keeps track of types that act as Vcc or GND, it checks for each added gate type whether its output function emits a constant 1
or 0
. Hence, using get_vcc_gate_types
and get_vcc_gate_types
the user can retrieve these special gate types separately.