[Tex/LaTex] Circuitikz ‘parallel’ logic gate wiring

circuitikz

So I'm trying to draw the following circuit (Which looks like a half adder) using circuitikz.

correct non-overlapping inputs

However, my code is producing the below diagram.

Overlapping inputs to second logic gate

\begin{circuitikz}
\draw (0, 4)node[xor port] (xorone){}
(0, 2)node[and port] (and){}
(xorone.in 1) node[left=0.5cm](a) {A}
(xorone.in 2) node[left=0.5cm](b) {B}

(a) -| (xorone.in 1)
(b) -| (xorone.in 2)
(a) -| (and.in 1)
(b) -| (and.in 2);  
\end{circuitikz}

Is there any way I can make the two wires connecting the gates in 'parallel' not overlap?

Best Answer

Usually one adds branch points where wires connect, either with to[short,o-*] or node[circ] and node[ocirc]. I specified point (branch) midway between (b.east) and (xorone.in 2).

Note: circuitikz always loads the calc library.

\documentclass[border=1pt]{standalone}
\usepackage{circuitikz}

\begin{document}
\begin{circuitikz}
\draw (0, 4)node[xor port] (xorone){}
(0, 2)node[and port] (and){}
(xorone.in 1) node[left=0.5cm](a) {A}
(xorone.in 2) node[left=0.5cm](b) {B}

(a.east) to[short,-*] (xorone.in 1) |- (and.in 1)
(b.east) to[short,-*] ($(b.east)!.5!(xorone.in 2)$) coordinate (branch)
    -- (xorone.in 2)
(branch) |- (and.in 2);  
\end{circuitikz}
\end{document} 

demo