Netlist Modification Decorator¶
-
class
hal_py.
NetlistModificationDecorator
¶ -
__init__
(self: hal_py.NetlistModificationDecorator, netlist: hal_py.Netlist) → None¶ Construct new NetlistModificationDecorator object.
Parameters: netlist (hal_py.Netlist) – The netlist to operate on.
-
connect_gates
(self: hal_py.NetlistModificationDecorator, src_gate: hal_py.Gate, src_pin: hal_py.GatePin, dst_gate: hal_py.Gate, dst_pin: hal_py.GatePin) → hal_py.Net¶ Connects two gates through the specified pins. If both pins are not yet connected to a net, a new net is created to connect both pins. If one of the pins is already connected to a net, that net is connected to the other pin. If both pins are already connected to a net, an error is returned.
Parameters: - src_gate (hal_py.Gate) – The source gate.
- src_pin (hal_py.GatePin) – The output pin of the source gate.
- dst_gate (hal_py.Gate) – The destination gate.
- dst_pin (hal_py.GatePin) – The input pin of the destination gate.
Returns: The connecting net on success, None otherwise.
Return type: hal_py.Net or None
-
connect_nets
(self: hal_py.NetlistModificationDecorator, master_net: hal_py.Net, slave_net: hal_py.Net) → hal_py.Net¶ Connects (and thereby merges) two nets. All properties of the slave net are transfered to the master net and the slave net is subsequently deleted.
Parameters: - master_net (hal_py.Net) – The net that receives all properties from the slave net.
- slave_net (hal_py.Net) – The net that transfers all properties to the master net and is subsequently deleted.
Returns: The merged net on success, None otherwise.
Return type: hal_py.Net or None
-
delete_modules
(self: hal_py.NetlistModificationDecorator, filter: Callable[[hal_py.Module], bool] = None) → bool¶ Delete all modules in the netlist except the top module. An optional filter can be specified to delete only modules fulfilling a certain condition.
Parameters: filter (lambda) – An optional filter to be applied to the modules before deletion. Returns: True on success, False otherwise. Return type: bool
-
replace_gate
(self: hal_py.NetlistModificationDecorator, gate: hal_py.Gate, target_type: hal_py.GateType, pin_map: Dict[hal_py.GatePin, hal_py.GatePin]) → hal_py.Gate¶ Replace the given gate with a gate of the specified gate type. A map from old to new pins must be provided in order to correctly connect the gates inputs and outputs. A pin can be omitted if no connection at that pin is desired.
Parameters: - gate (hal_py.Gate) – The gate to be replaced.
- target_type (hal_py.GateType) – The gate type of the replacement gate.
- pin_map (dict[hal_py.GatePin,hal_py.GatePin]) – A dict from old to new pins.
Returns: The new gate on success, None otherwise.
Return type: hal_py.Gate or None
-