Gate
- class hal_py.Gate
Bases:
hal_py.DataContainer
Gate class containing information about a gate including its location, functions, and module.
- add_boolean_function(self: hal_py.Gate, name: str, func: hal::BooleanFunction) bool
Add a Boolean function with the given name to the gate.
- Parameters
name (str) – The name.
func (hal_py.BooleanFunction) – The function.
- Returns
True on success, False otherwise.
- Return type
- property boolean_functions
A dictionary from function name to Boolean function for all boolean functions associated with this gate.
- Return type
- property data
A dict from ((1) category, (2) key) to ((1) type, (2) value) containing all stored data entries.
- delete_data(self: hal_py.DataContainer, category: str, key: str, log_with_info_level: bool = False) bool
Delete a data entry.
- property fan_in_endpoints
A list of all fan-in endpoints of the gate, i.e., all endpoints associated with an input pin of the gate.
- Type
- property fan_in_nets
A list of all fan-in nets of the gate, i.e., all nets that are connected to one of the input pins.
- Type
- property fan_out_endpoints
A list of all fan-out endpoints of the gate, i.e., all endpoints associated with an output pin of the gate.
- Type
- property fan_out_nets
A list of all fan-out nets of the gate, i.e., all nets that are connected to one of the output pins.
- Type
- get_boolean_function(*args, **kwargs)
Overloaded function.
get_boolean_function(self: hal_py.Gate, name: str) -> hal::BooleanFunction
Get the Boolean function specified by the given name. This name can for example be an output pin of the gate or any other user-defined function name.
- param str name
The name.
- returns
The Boolean function on success, an empty Boolean function otherwise.
- rtype
hal_py.BooleanFunction
get_boolean_function(self: hal_py.Gate, pin: hal_py.GatePin = None) -> hal::BooleanFunction
Get the Boolean function corresponding to the given output pin. If pin is None, the Boolean function of the first output pin is returned.
- param hal_py.GatePin pin
The pin.
- returns
The Boolean function on success, an empty Boolean function otherwise.
- rtype
hal_py.BooleanFunction
- get_boolean_functions(self: hal_py.Gate, only_custom_functions: bool = False) Dict[str, hal::BooleanFunction]
Get a dictionary from function name to Boolean function for all boolean functions associated with this gate.
- Parameters
only_custom_functions (bool) – If true, this returns only the functions which were set via
add_boolean_function()
.- Returns
A map from function name to function.
- Return type
- get_data(self: hal_py.DataContainer, category: str, key: str) Tuple[str, str]
Get the data entry specified by the given category and key.
- get_data_map(self: hal_py.DataContainer) Dict[Tuple[str, str], Tuple[str, str]]
Get a dict from ((1) category, (2) key) to ((1) type, (2) value) containing all stored data entries.
- get_fan_in_endpoint(*args, **kwargs)
Overloaded function.
get_fan_in_endpoint(self: hal_py.Gate, pin_name: str) -> hal_py.Endpoint
Get the fan-in endpoint corresponding to the input pin specified by name.
- param str pin_name
The input pin name.
- returns
The endpoint on success, None otherwise.
- rtype
hal_py.Endpoint or None
get_fan_in_endpoint(self: hal_py.Gate, pin: hal_py.GatePin) -> hal_py.Endpoint
Get the fan-in endpoint corresponding to the specified input pin.
- param hal_py.GatePin pin
The input pin.
- returns
The endpoint on success, None otherwise.
- rtype
hal_py.Endpoint or None
get_fan_in_endpoint(self: hal_py.Gate, net: hal::Net) -> hal_py.Endpoint
Get the fan-in endpoint connected to the specified input net.
- param hal_py.Net net
The input net.
- returns
The endpoint on success, None otherwise.
- rtype
hal_py.Endpoint or None
- get_fan_in_endpoints(*args, **kwargs)
Overloaded function.
get_fan_in_endpoints(self: hal_py.Gate) -> List[hal_py.Endpoint]
Get a list of all fan-in endpoints of the gate, i.e., all endpoints associated with an input pin of the gate.
- returns
A list of all fan-in endpoints.
- rtype
list[hal_py.Endpoint]
get_fan_in_endpoints(self: hal_py.Gate, filter: Callable[[hal_py.Endpoint], bool]) -> List[hal_py.Endpoint]
Get a list of all fan-in endpoints of the gate, i.e., all endpoints associated with an input pin of the gate. The filter is evaluated on every candidate such that the result only contains those matching the specified condition.
- param lambda filter
Filter function to be evaluated on each endpoint.
- returns
A list of all fan-in endpoints.
- rtype
list[hal_py.Endpoint]
- get_fan_in_net(*args, **kwargs)
Overloaded function.
get_fan_in_net(self: hal_py.Gate, pin_name: str) -> hal::Net
Get the fan-in net corresponding to the input pin specified by name.
- param str pin_name
The input pin name.
- returns
The fan-in net on success, None otherwise.
- rtype
hal_py.Net or None
get_fan_in_net(self: hal_py.Gate, pin: hal_py.GatePin) -> hal::Net
Get the fan-in net corresponding to the specified input pin.
- param hal_py.GatePin pin
The input pin.
- returns
The fan-in net on success, None otherwise.
- rtype
hal_py.Net or None
- get_fan_in_nets(*args, **kwargs)
Overloaded function.
get_fan_in_nets(self: hal_py.Gate) -> List[hal::Net]
Get a list of all fan-in nets of the gate, i.e., all nets that are connected to one of the input pins.
- returns
A list of all fan-in nets.
- rtype
list[hal_py.Net]
get_fan_in_nets(self: hal_py.Gate, filter: Callable[[hal::Net], bool]) -> List[hal::Net]
Get a list of all fan-in nets of the gate, i.e., all nets that are connected to one of the input pins. The filter is evaluated on every candidate such that the result only contains those matching the specified condition.
- param lambda filter
Filter function to be evaluated on each net.
- returns
A list of all fan-in nets.
- rtype
list[hal_py.Net]
- get_fan_out_endpoint(*args, **kwargs)
Overloaded function.
get_fan_out_endpoint(self: hal_py.Gate, pin_name: str) -> hal_py.Endpoint
Get the fan-out endpoint corresponding to the output pin specified by name.
- param str pin_name
The output pin name.
- returns
The endpoint on success, None otherwise.
- rtype
hal_py.Endpoint or None
get_fan_out_endpoint(self: hal_py.Gate, pin: hal_py.GatePin) -> hal_py.Endpoint
Get the fan-out endpoint corresponding to the specified output pin.
- param hal_py.GatePin pin
The output pin.
- returns
The endpoint on success, None otherwise.
- rtype
hal_py.Endpoint or None
get_fan_out_endpoint(self: hal_py.Gate, net: hal::Net) -> hal_py.Endpoint
Get the fan-out endpoint connected to the specified output net.
- param hal_py.Net net
The output net.
- returns
The endpoint on success, None otherwise.
- rtype
hal_py.Endpoint or None
- get_fan_out_endpoints(*args, **kwargs)
Overloaded function.
get_fan_out_endpoints(self: hal_py.Gate) -> List[hal_py.Endpoint]
Get a list of all fan-out endpoints of the gate, i.e., all endpoints associated with an output pin of the gate.
- returns
A list of all fan-out endpoints.
- rtype
list[hal_py.Endpoint]
get_fan_out_endpoints(self: hal_py.Gate, filter: Callable[[hal_py.Endpoint], bool]) -> List[hal_py.Endpoint]
Get a list of all fan-out endpoints of the gate, i.e., all endpoints associated with an output pin of the gate. The filter is evaluated on every candidate such that the result only contains those matching the specified condition.
- param lambda filter
Filter function to be evaluated on each endpoint.
- returns
A list of all fan-out endpoints.
- rtype
list[hal_py.Endpoint]
- get_fan_out_net(*args, **kwargs)
Overloaded function.
get_fan_out_net(self: hal_py.Gate, pin_name: str) -> hal::Net
Get the fan-out net corresponding to the output pin specified by name.
- param str pin_name
The output pin name.
- returns
The fan-out net on success, None otherwise.
- rtype
hal_py.Net or None
get_fan_out_net(self: hal_py.Gate, pin: hal_py.GatePin) -> hal::Net
Get the fan-out net corresponding to the specified output pin.
- param hal_py.GatePin pin
The output pin.
- returns
The fan-out net on success, None otherwise.
- rtype
hal_py.Net or None
- get_fan_out_nets(*args, **kwargs)
Overloaded function.
get_fan_out_nets(self: hal_py.Gate) -> List[hal::Net]
Get a list of all fan-out nets of the gate, i.e., all nets that are connected to one of the output pins.
- returns
A list of all fan-out nets.
- rtype
list[hal_py.Net]
get_fan_out_nets(self: hal_py.Gate, filter: Callable[[hal::Net], bool]) -> List[hal::Net]
Get a list of all fan-out nets of the gate, i.e., all nets that are connected to one of the output pins. The filter is evaluated on every candidate such that the result only contains those matching the specified condition.
- param lambda filter
Filter function to be evaluated on each net.
- returns
A list of all fan-out nets.
- rtype
list[hal_py.Net]
- get_grouping(self: hal_py.Gate) hal::Grouping
Gets the grouping in which this gate is contained. If no grouping contains this gate, None is returned.
- Returns
The grouping.
- Return type
- get_id(self: hal_py.Gate) int
Get the unique ID of the gate.
- Returns
The unique id.
- Type
- get_init_data(self: hal_py.Gate) List[str]
Get the INIT data of the gate, if available. An error is returned in case the gate does not hold any INIT data.
- get_location(self: hal_py.Gate) Tuple[int, int]
Get the physical location of the gate in the layout. If no valid physical location coordinate is assigned, a negative value is returned for the respective coordinate.
- get_location_x(self: hal_py.Gate) int
Get the physical location x-coordinate of the gate in the layout. If no valid physical location x-coordinate is assigned, a negative value is returned.
- Returns
The gate’s x-coordinate.
- Return type
- get_location_y(self: hal_py.Gate) int
Get the physical location y-coordinate of the gate in the layout. If no valid physical location y-coordinate is assigned, a negative value is returned.
- Returns
The gate’s y-coordinate.
- Return type
- get_module(self: hal_py.Gate) hal::Module
Get the module which contains this gate.
- Returns
The module.
- Return type
- get_modules(self: hal_py.Gate, filter: Callable[[hal::Module], bool] = None, recursive: bool = True) List[hal::Module]
Get all modules that contain this gate, either directly or as parent of another module. If recursive is set to True, indirect parent modules are also included. Otherwise, only the module containing the gate directly is returned. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
- Parameters
filter (lambda) – An optional filter.
recursive (bool) – Set True to include indirect parents as well, False otherwise.
- Returns
A list of modules.
- Return type
- get_name(self: hal_py.Gate) str
Get the name of the gate.
- Returns
The name.
- Return type
- get_netlist(self: hal_py.Gate) hal_py.Netlist
Get the netlist this gate is associated with.
- Returns
The netlist.
- Return type
- get_predecessor(*args, **kwargs)
Overloaded function.
get_predecessor(self: hal_py.Gate, pin_name: str) -> hal_py.Endpoint
Get a single direct predecessor endpoint that is connected to the input pin specified by name. Fails if there are no or more than one predecessors.
- param str pin_name
The input pin name.
- returns
The predecessor endpoint on success, None otherwise.
- rtype
hal_py.Endpoint or None
get_predecessor(self: hal_py.Gate, pin: hal_py.GatePin) -> hal_py.Endpoint
Get a single direct predecessor endpoint that is connected to the specified input pin. Fails if there are no or more than one predecessors.
- param hal_py.GatePin pin
The input pin.
- returns
The predecessor endpoint on success, None otherwise.
- rtype
hal_py.Endpoint or None
- get_predecessors(self: hal_py.Gate, filter: Callable[[hal_py.GatePin, hal_py.Endpoint], bool] = None) List[hal_py.Endpoint]
Get a list of all direct predecessor endpoints of the gate, i.e., all predecessor endpoints that are connected to an input pin of the gate. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
- Parameters
filter (lambda) – An optional filter being evaluated on the gate’s input pin as well as the predecessor endpoint.
- Returns
A list of predecessors endpoints.
- Return type
- get_resolved_boolean_function(self: hal_py.Gate, pin: hal_py.GatePin, use_net_variables: bool = False) Optional[hal::BooleanFunction]
Get the resolved Boolean function corresponding to the given output pin, i.e., a Boolean function that only depends on input pins (or nets) and no internal or output pins. If fan-in nets are used to derive variable names, the variable names are generated using the
BooleanFunctionNetDecorator
.- Parameters
pin (hal_py.GatePin) – The output pin.
use_net_variables (bool) – Set
True
to use variable names derived from fan-in nets of the gate,False
to use input pin names instead. Defaults toFalse
.
- Returns
The Boolean function on success,
None
otherwise.- Return type
- get_successor(*args, **kwargs)
Overloaded function.
get_successor(self: hal_py.Gate, pin_name: str) -> hal_py.Endpoint
Get a single direct successor endpoint that is connected to the output pin specified by name. Fails if there are no or more than one successors.
- param str pin_name
The output pin name.
- returns
The successor endpoint on success, None otherwise.
- rtype
hal_py.Endpoint or None
get_successor(self: hal_py.Gate, pin: hal_py.GatePin) -> hal_py.Endpoint
Get a single direct successor endpoint that is connected to the output pin specified by name. Fails if there are no or more than one successors.
- param hal_py.GatePin pin
The output pin.
- returns
The successor endpoint on success, None otherwise.
- rtype
hal_py.Endpoint or None
- get_successors(self: hal_py.Gate, filter: Callable[[hal_py.GatePin, hal_py.Endpoint], bool] = None) List[hal_py.Endpoint]
Get a list of all direct successor endpoints of the gate, i.e., all successor endpoints that are connected to an output pin of the gate. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
- Parameters
filter (lambda) – An optional filter being evaluated on the gate’s output pin as well as the successor endpoint.
- Returns
A list of successor endpoints.
- Return type
- get_type(self: hal_py.Gate) hal_py.GateType
Get the type of the gate.
- Returns
The gate’s type.
- Return type
hal_py.Gate_type
- get_unique_predecessors(self: hal_py.Gate, filter: Callable[[hal_py.GatePin, hal_py.Endpoint], bool] = None) List[hal_py.Gate]
Get a list of all unique predecessor gates of the gate. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
- Parameters
filter (lambda) – An optional filter being evaluated on the gate’s input pin as well as the predecessor endpoint.
- Returns
A list of unique predecessors endpoints.
- Return type
- get_unique_successors(self: hal_py.Gate, filter: Callable[[hal_py.GatePin, hal_py.Endpoint], bool] = None) List[hal_py.Gate]
Get a list of all unique successor gates of the gate. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
- Parameters
filter (lambda) – An optional filter being evaluated on the gate’s output pin as well as the successor endpoint.
- Returns
A list of unique successor endpoints.
- Return type
- has_data(self: hal_py.DataContainer, category: str, key: str) bool
Determine whether an entry of given category and key exists.
- has_location(self: hal_py.Gate) bool
Checks whether the gate’s location in the layout is available.
- Returns
True if valid location data is available, false otherwise.
- Return type
- is_fan_in_net(self: hal_py.Gate, net: hal::Net) bool
Check whether the given net is a fan-in of the gate.
- Parameters
net (hal_py.Net) – The net.
- Returns
True if the net is a fan-in of the gate, False otherwise.
- Return type
- is_fan_out_net(self: hal_py.Gate, net: hal::Net) bool
Check whether the given net is a fan-out of the gate.
- Parameters
net (hal_py.Net) – The net.
- Returns
True if the net is a fan-out of the gate, False otherwise.
- Return type
- is_gnd_gate(self: hal_py.Gate) bool
Checks whether this gate is a global gnd gate.
- Returns
True if the gate is a global gnd gate, False otherwise.
- Return type
- is_vcc_gate(self: hal_py.Gate) bool
Checks whether this gate is a global vcc gate.
- Returns
True if the gate is a global vcc gate, False otherwise.
- Return type
- property location
The physical location of the gate in the layout. Only positive values are valid, negative values will be regarded as no location assigned.
- property location_x
The x-coordinate of the physical location of the gate in the layout. Only positive values are valid, negative values will be regarded as no location assigned.
- Type
- property location_y
The y-coordinate of the physical location of the gate in the layout. Only positive values are valid, negative values will be regarded as no location assigned.
- Type
- mark_gnd_gate(self: hal_py.Gate) bool
Mark this gate as a global gnd gate.
- Returns
True on success, False otherwise.
- Return type
- mark_vcc_gate(self: hal_py.Gate) bool
Mark this gate as a global vcc gate.
- Returns
True on success, False otherwise.
- Return type
- property module
The module in which contains this gate.
- Type
- property modules
A list of all modules that contain this gate, either directly or as parent of another module.
- Type
- property netlist
The netlist this gate is associated with.
- Type
- property predecessors
A list of all direct predecessor endpoints of the gate, i.e., all predecessor endpoints that are connected to an input pin of the gate.
- Type
- set_data(self: hal_py.DataContainer, category: str, key: str, data_type: str, value: str, log_with_info_level: bool = False) bool
Add a data entry.<br> May overwrite an existing entry.
- Parameters
- Returns
True on success, false otherwise.
- Return type
- set_init_data(self: hal_py.Gate, init_data: List[str]) bool
Set the INIT data of the gate, if available. An error is returned in case the gate does not hold any INIT data.
- set_location(self: hal_py.Gate, location: Tuple[int, int]) None
Set the physical location of the gate in the layout. Only positive coordinates are valid, negative values will be regarded as no location assigned.
- set_location_x(self: hal_py.Gate, x: int) None
Set the physical location x-coordinate of the gate in the layout. Only positive values are valid, negative values will be regarded as no location assigned.
- Parameters
x (int) – The gate’s x-coordinate.
- set_location_y(self: hal_py.Gate, y: int) None
Set the physical location y-coordinate of the gate in the layout. Only positive values are valid, negative values will be regarded as no location assigned.
- Parameters
y (int) – The gate’s y-coordinate.
- set_name(self: hal_py.Gate, name: str) None
Set the name of the gate.
- Parameters
name (str) – The new name.
- property successors
A list of all direct successor endpoints of the gate, i.e., all successor endpoints that are connected to an output pin of the gate.
- Type
- property type
The type of the gate
- Type
hal_py.Gate_type
- property unique_predecessors
A list of all unique predecessor gates of the gate.
- Type
- property unique_successors
A list of all unique successor gates of the gate.
- Type
- unmark_gnd_gate(self: hal_py.Gate) bool
Unmark this gate as a global gnd gate.
- Returns
True on success, False otherwise.
- Return type
- unmark_vcc_gate(self: hal_py.Gate) bool
Unmark this gate as a global vcc gate.
- Returns
True on success, False otherwise.
- Return type