-
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 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
To create a new gate type, the function create_gate_type
can be called on the gate library. When creating a new gate type, its properties need to be specified at time of creation. For more on gate type properties, see gate types. The functions 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.
new_gt = gl.create_gate_type("new_gt", set([hal_py.GateTypeProperty.combinational])) # creates a new combinational gate type
gl.contains_gate_type(new_gt) # returns True
gl.contains_gate_type_by_name("new_gt") # returns True
gl.contains_gate_type_by_name("invalid_gt") # returns False
gt = gl.get_gate_type_by_name("new_gt") # returns gate type 'new_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, this is automatically detected after parsing of the gate library, however manually manipulating the gate library may require additional gate types being marked accordingly. Hence, using get_vcc_gate_types
and get_vcc_gate_types
, the user can retrieve these special gate types separately. 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.