Skip to content

Endpoint

julianspeith edited this page Aug 17, 2026 · 10 revisions

An endpoint represents the point where a net connects to a gate. Each endpoint comprises the associated gate, the respective pin of the gate, and the connected net. In addition, it distinguishes between inputs (destinations) and outputs (sources).

Endpoints exist because "gate A is connected to gate B" is rarely enough information. What you usually need to know is through which pin: a net arriving at a flip-flop's clock pin means something entirely different from the same net arriving at its data or reset pin. An endpoint is the triple (gate, pin, net) that captures this, and it is why HAL's traversal functions return endpoints rather than plain gates.

Endpoint information

New endpoints can only be created by assigning new sources and destinations to nets, see Net. Access to the gate, pin, and net is provided by get_gate, get_pin, and get_net. To figure out whether an endpoint is a source or a destination, the functions is_source_pin and is_destination_pin are provided. All of these are also available as read-only properties (gate, pin, net, source_pin, destination_pin).

Note that get_pin returns a GatePin object, not a string. Call get_name() on it to obtain the pin name, or get_type() to obtain its pin type — the latter being what makes endpoints powerful.

net = netlist.get_net_by_id(3)          # get the net with ID 3
e = net.get_sources()[0]                # get the first source endpoint of the net
print(e.get_gate().get_name())          # print the name of the associated gate
print(e.get_pin().get_name())           # print the name of the pin
print(e.get_net().get_name())           # print the name of the connected net
e.is_source_pin()                       # returns True

Working with endpoints

Endpoints are returned by the traversal functions of gates (get_predecessors, get_successors, get_fan_in_endpoints, get_fan_out_endpoints) and nets (get_sources, get_destinations). Filtering them by pin type is one of the most useful operations in HAL, because it lets you distinguish a signal's role from its mere presence:

# find every flip-flop clocked by this net
for ep in net.get_destinations():
    if ep.get_pin().get_type() == hal_py.PinType.clock:
        print(ep.get_gate().get_name(), "is clocked by", net.get_name())

# what drives the reset of this flip-flop?
for ep in ff.get_fan_in_endpoints():
    if ep.get_pin().get_type() == hal_py.PinType.reset:
        print("reset driven by net", ep.get_net().get_name())

Most traversal functions accept a filter directly, so the loops above can usually be written more compactly:

clocked = net.get_destinations(lambda ep: ep.get_pin().get_type() == hal_py.PinType.clock)

See Gate Type for the complete list of available pin types and directions.

See also

  • Net — the sources and destinations that endpoints represent
  • Gate — the gate side of an endpoint, and its pins
  • Gate Type — pin types such as clock or enable that endpoint filters match on
  • Decorators — traversal built on top of endpoint filters

Clone this wiki locally