使用 Circuitikz 的布尔电路

使用 Circuitikz 的布尔电路

我想获得帮助,如何将 1 个输入作为分隔线分成两个不同的输入,我写了这个,我想让一个输入进入上门的第二个输入,第一个输入进入下门

\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

在此处输入图片描述

\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}

附录: 具有 ieee 逻辑风格的版本(如@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}

在此处输入图片描述

相关内容