2

I would like to get help on how can I get 1 input as a separated line into two different inputs, I wrote this and I would like to have one input going to the second input of the upper gate and the first input in the lower gate

\begin{circuitikz} 
\draw
(0,2) node[xor port] (myxor1) {}
(0,-.7) node[xor port] (myxor2) {}
(2,0.5) node[xor port] (myxor) {}
(myxor1.in 2) node[anchor=east] {A}
(myxor2.in 1) node[anchor=east]  {A}
(myxor1.out) -| (myxor.in 1)
(myxor2.out) -| (myxor.in 2)
;
\end{circuitikz}
1
3

enter image description here

\documentclass[margin=3mm]{standalone}
\usepackage{circuitikz}

\begin{document}
    \begin{circuitikz}
\draw   (0,2) node[xor port] (myxor1) {}
        (0,0) node[xor port] (myxor2) {}
        (2,1) node[xor port] (myxor)  {}
        (myxor1.in 2) |- (myxor2.in 1)
        (myxor1.out) -| (myxor.in 1)
        (myxor2.out) -| (myxor.in 2)
        (myxor.out) -- ++ (1,0) node[right] {$C_i$}
%
        (myxor1.in 2 |- myxor.out) to [short] ++ (-1,0) 
                    node[twoportshape, anchor=right,t=$G_A$] (ga) {}
        (ga.west) to [short] ++ (-1,0) 
                    node[twoportshape, anchor=right,t=$S_A$] (sa) {}
%
        (sa.west) to [short] ++ (-1,0) node[left] (in2) {0}
        (myxor1.in 1) -- (myxor1.in 1 -| in2.east) node[left] (in1) {$C_i$}
        (myxor2.in 2) -- (myxor2.in 2 -| in2.east) node[left] (in3) {0}
        ;
    \end{circuitikz}
\end{document}

Addendum: A version with ieee logic style (as suggested @Rmano):

\documentclass[margin=3mm]{standalone}
\usepackage{circuitikz}

\begin{document}
    \begin{circuitikz}
\ctikzset{logic ports=ieee}
\draw   (0,2) node[xor port] (myxor1) {}
        (0,0) node[xor port] (myxor2) {}
        (3,1) node[xor port] (myxor)  {}
        (myxor1.in 2) -- ++ (-0.5,0) coordinate (aux) |- (myxor2.in 1)
        (myxor.in 1)  -- ++ (-0.5,0) |- (myxor1.out) 
        (myxor.in 2)  -- ++ (-0.5,0) |- (myxor2.out)
        (myxor.out)   -- ++ (1,0) node[right] {$C_i$}
%
        (aux |- myxor.out) to [short] ++ (-0.5,0)
                    node[twoportshape, anchor=right,t=$G_A$] (ga) {}
        (ga.west) to [short] ++ (-0.5,0)
                    node[twoportshape, anchor=right,t=$S_A$] (sa) {}
%
        (sa.west) to [short] ++ (-1,0) node[left] (in2) {0}
        (myxor1.in 1) -- (myxor1.in 1 -| in2.east) node[left] (in1) {$C_i$}
        (myxor2.in 2) -- (myxor2.in 2 -| in2.east) node[left] (in3) {0}
        ;
    \end{circuitikz}
\end{document}

enter image description here

3
  • Notice that with \ctikzset{logic ports=ieee} you will have a look much more similar to the original drawing.
    – Rmano
    Jun 20 '20 at 11:09
  • @Rmano, added is version with ieee style of logic gates. Thank you very much!
    – Zarko
    Jun 20 '20 at 11:35
  • can't upvote more ;-)
    – Rmano
    Jun 20 '20 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.