Connecting logic gates