如何用 circuitikz 绘制 8 选 1 多路复用器

如何用 circuitikz 绘制 8 选 1 多路复用器

如何绘制一个带 或tikz的8 选 1 多路复用器circuitikz?下面显示了手绘示例。

多路复用器-8-1

答案1

使用 TiKz:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}
\draw (0,0)coordinate (O)--++(30:1)coordinate (A)--++(90:4)coordinate (B)--++(150:1)coordinate (C)--cycle;
\draw ($(A)!0.5!(B)$)--++(0:1)node[right]{$F$};
\draw ($(O)!0.5!(A)$)--++(-90:1)--++(180:2)node[left]{$b$};
\draw ($(O)!0.25!(A)$)--++(-90:0.5)--++(180:1.75)node[left]{$a$};
\draw ($(O)!0.75!(A)$)--++(-90:1.5)--++(180:2.25)node[left]{$c$};
\foreach \y/\t in {0.1/1,0.2/2,0.3/3,0.4/4,0.5/5,0.6/6,0.7/7,0.8/8} {
\draw ($(C)! \y*1.1 !(O)$)--++(180:1) node[left] {$X \t$};}
\end{tikzpicture}

\end{document}

在此处输入图片描述

答案2

circuits.logic.IEC库提供了一个and gate可为您提供所需数量的输入锚点:

\documentclass{article}
\usepackage{circuitikz}
\usetikzlibrary{circuits.logic.IEC,calc}

\begin{document}

\begin{circuitikz}[circuit logic IEC] 
\node[and gate,inputs={nnnnnnnn},and gate IEC symbol={},text height=3cm,
] (A) {};
\foreach \Valor in {1,...,8}
{
  \draw  ([xshift=-10pt]A.input \Valor) node[left] {$I_{\Valor}$} -- (A.input \Valor);
}
\draw (A.output) -- ++(10pt,0) node[right] {$F$};
\draw ( $ (A.south west)!0.25!(A.south east) $ ) -- ++(-90:0.25) |- ++(-10pt,0) node[left] {$a$};
\draw (A.south) -- ++(-90:0.5) |- ++(-15pt,0) node[left] {$b$};
\draw ( $ (A.south west)!0.75!(A.south east) $ ) -- ++(-90:0.75) |- ++(-20pt,0) node[left] {$c$};
\end{circuitikz}

\end{document}

在此处输入图片描述

相关内容