Gate
- class hal_py.Gate
Bases:
hal_py.DataContainerGate 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
Trueon success,Falseotherwise.- Return type
- property boolean_functions
A dictionary from function name to raw 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.
- delete_parameter(self: hal_py.DataContainer, name: str) bool
Delete an explicitly stored parameter value, if any.
- 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 raw Boolean function specified by the given name without inlining or net substitution. This name can for example be an
outputpin of the gate or any other user-defined function name. For full control over inlining and net substitution useget_boolean_functionwithinlinedandsubstitute_nets.- param str name
The name. If empty, the first output pin is used.
- returns
The Boolean function on success, an empty Boolean function otherwise.
- rtype
hal_py.BooleanFunction
get_boolean_function(self: hal_py.Gate, name: str, inlined: bool, substitute_nets: bool) -> Optional[hal::BooleanFunction]
Get the Boolean function specified by the given name, with full error reporting. When
inlinedisTrue,internalandoutputpin variables are recursively substituted with their definitions, and any gate-instance parameter values are reduced. Whensubstitute_netsisTrue, the remaining input pin variables are additionally substituted with variable names derived from the fan-in nets usingBooleanFunctionNetDecorator.substitute_netsrequiresinlinedto beTrue; passingsubstitute_nets=Truewithinlined=FalsereturnsNone.- param str name
The name. Must not be empty.
- param bool inlined
Set
Trueto inlineinternalandoutputpins and reduce parameter-conditional expressions.- param bool substitute_nets
Set
Trueto substitute input pin variables with fan-in net variables. Requiresinlined=Trueand every input pin to have a connected net.- returns
The Boolean function on success,
Noneotherwise.- rtype
hal_py.BooleanFunction or None
get_boolean_function(self: hal_py.Gate, pin: hal_py.GatePin = None) -> hal::BooleanFunction
Get the raw Boolean function corresponding to the given
outputpin without inlining or net substitution. IfpinisNone, the Boolean function of the firstoutputpin is returned. For full control over inlining and net substitution useget_boolean_functionwithinlinedandsubstitute_nets.- param hal_py.GatePin pin
The pin.
- 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, inlined: bool, substitute_nets: bool) -> Optional[hal::BooleanFunction]
Get the Boolean function corresponding to the given
outputpin, with full error reporting. WheninlinedisTrue,internalandoutputpin variables are recursively substituted with their definitions, and any gate-instance parameter values are reduced. Whensubstitute_netsisTrue, the remaining input pin variables are additionally substituted with variable names derived from the fan-in nets usingBooleanFunctionNetDecorator.substitute_netsrequiresinlinedto beTrue; passingsubstitute_nets=Truewithinlined=FalsereturnsNone. ReturnsNoneifpinisNone.- param hal_py.GatePin pin
The output pin.
- param bool inlined
Set
Trueto inlineinternalandoutputpins and reduce parameter-conditional expressions.- param bool substitute_nets
Set
Trueto substitute input pin variables with fan-in net variables. Requiresinlined=Trueand every input pin to have a connected net.- returns
The Boolean function on success,
Noneotherwise.- rtype
hal_py.BooleanFunction or None
- get_boolean_functions(*args, **kwargs)
Overloaded function.
get_boolean_functions(self: hal_py.Gate, only_custom_functions: bool = False) -> Dict[str, hal::BooleanFunction]
Get a dictionary from function name to raw Boolean function for all boolean functions associated with this gate. For full control over inlining and net substitution use
get_boolean_functionswithinlinedandsubstitute_nets.- param bool only_custom_functions
Set
Trueto get only Boolean functions that are local to the gate,Falseotherwise.- returns
A dict from function name to function on success, an empty dict otherwise.
- rtype
dict[str,hal_py.BooleanFunction]
get_boolean_functions(self: hal_py.Gate, only_custom_functions: bool, inlined: bool, substitute_nets: bool) -> Optional[Dict[str, hal::BooleanFunction]]
Get a dictionary from function name to Boolean function for all boolean functions associated with this gate. When
inlinedisTrue,internalandoutputpin variables are recursively substituted with their definitions, and gate-instance parameter values are reduced. Whensubstitute_netsisTrue, the remaining input pin variables are additionally substituted with variable names derived from the fan-in nets.substitute_netsrequiresinlinedto beTrue. Aborts on the first failure and returnsNone.- param bool only_custom_functions
If
True, returns only functions set viaadd_boolean_function().- param bool inlined
Set
Trueto inlineinternalandoutputpins and reduce parameter-conditional expressions.- param bool substitute_nets
Set
Trueto substitute input pin variables with fan-in net variables. Requiresinlined=True.- returns
A map from function name to function on success,
Noneotherwise.- rtype
dict[str,hal_py.BooleanFunction] or None
- 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,
Noneotherwise.- 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,
Noneotherwise.- 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,
Noneotherwise.- 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,
Noneotherwise.- 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,
Noneotherwise.- 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,
Noneotherwise.- 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,
Noneotherwise.- 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,
Noneotherwise.- 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,
Noneotherwise.- 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,
Noneotherwise.- 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,
Noneis returned.- Returns
The grouping.
- Return type
- get_id(self: hal_py.Gate) int
Get the unique ID of the gate.
- Returns
The unique id.
- Return type
- 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
Trueto include indirect parents as well,Falseotherwise.
- 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_parameter_declaration(self: hal_py.DataContainer, name: str) Optional[hal_py.Parameter]
Get the full declaration of a typed parameter.
- get_parameter_value(*args, **kwargs)
Overloaded function.
get_parameter_value(self: hal_py.DataContainer, name: str) -> Optional[str]
Get the value of a typed parameter. Returns the explicitly-stored value or
Noneif the parameter does not exist.- param str name
The parameter name.
- returns
The value string on success,
Noneotherwise.- rtype
str or None
get_parameter_value(self: hal_py.DataContainer, name: hal_py.Parameter) -> Optional[str]
Get the value of a typed parameter. Returns the explicitly-stored value or
Noneif the parameter does not exist.- param hal_py.Parameter param
The parameter.
- returns
The value string on success,
Noneotherwise.- rtype
str or None
- get_parameters(self: hal_py.DataContainer) Dict[str, Tuple[hal_py.Parameter, str]]
Get all explicitly stored parameter values as a dict from
nameto (declaration, value).
- 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,
Noneotherwise.- 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,
Noneotherwise.- 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 predecessor endpoints.
- 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,
Noneotherwise.- 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,
Noneotherwise.- 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 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 predecessor gates.
- 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 gates.
- Return type
- has_boolean_function(*args, **kwargs)
Overloaded function.
has_boolean_function(self: hal_py.Gate, name: str) -> bool
Check whether the gate has a Boolean function with the given name, i.e., whether
get_boolean_functionfinds one. This name can for example be an output pin of the gate or any other user-defined function name. Every LUT output pin has a Boolean function, even if the LUT is not configured.- param str name
The name.
- returns
Trueif the gate has a Boolean function with that name,Falseotherwise.- rtype
bool
has_boolean_function(self: hal_py.Gate, pin: hal_py.GatePin) -> bool
Check whether the gate has a Boolean function for the given output pin, i.e., whether
get_boolean_functionfinds one. If pin isNone, the first output pin is checked. Every LUT output pin has a Boolean function, even if the LUT is not configured.- param hal_py.GatePin pin
The pin.
- returns
Trueif the gate has a Boolean function for the pin,Falseotherwise.- rtype
bool
- 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
Trueif valid location data is available,Falseotherwise.- Return type
- has_parameter(*args, **kwargs)
Overloaded function.
has_parameter(self: hal_py.DataContainer, name: str) -> bool
Check whether a parameter with the given name exists and has an explicitly stored value.
- param str name
The parameter name.
- returns
Trueif the parameter is explicitly set,Falseotherwise.- rtype
bool
has_parameter(self: hal_py.DataContainer, param: hal_py.Parameter) -> bool
Check whether a parameter exists and has an explicitly stored value.
- param hal_py.Parameter param
The parameter.
- returns
Trueif the parameter is explicitly set,Falseotherwise.- rtype
bool
- 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
Trueif the net is a fan-in of the gate,Falseotherwise.- 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
Trueif the net is a fan-out of the gate,Falseotherwise.- Return type
- is_gnd_gate(self: hal_py.Gate) bool
Checks whether this gate is a global gnd gate.
- Returns
Trueif the gate is a global gnd gate,Falseotherwise.- Return type
- is_vcc_gate(self: hal_py.Gate) bool
Checks whether this gate is a global vcc gate.
- Returns
Trueif the gate is a global vcc gate,Falseotherwise.- 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
Trueon success,Falseotherwise.- Return type
- mark_vcc_gate(self: hal_py.Gate) bool
Mark this gate as a global vcc gate.
- Returns
Trueon success,Falseotherwise.- 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 parameters
All explicitly stored parameter values as a dict from
nameto (declaration, value).
- 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
Trueon success,Falseotherwise.- Return type
- 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.
- set_parameter(self: hal_py.DataContainer, param: hal_py.Parameter, value: str) bool
Set (or overwrite) the value of a typed parameter as a string. The value is validated, normalized, and stored; any existing entry with the same name is replaced.
- 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
Trueon success,Falseotherwise.- Return type
- unmark_vcc_gate(self: hal_py.Gate) bool
Unmark this gate as a global vcc gate.
- Returns
Trueon success,Falseotherwise.- Return type