-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathhalfadder1_example00.tex
More file actions
60 lines (42 loc) · 1019 Bytes
/
halfadder1_example00.tex
File metadata and controls
60 lines (42 loc) · 1019 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
\begin{circuitikz}
% Gates:
\draw
(4,2) node[xor port](xorGate) {} % xor gate
(4.2,3.0) node[left] {$XOR$} % XOR label
(4,0) node[and port](andGate) {} % AND gate
(4.2,-1.0) node[left] {$AND$} % AND label
;
% Input nodes:
\draw
(0,2.27) node[ocirc](ainput) {} % A node
(0,2.3) node[left] {{\color{red}$A = 0$}} % A label
(0,1.72) node[ocirc](binput) {} % B node
(0,1.72) node[left] {{\color{red}$B = 0$}} % B label
;
% Output nodes:
\draw
(5,2) node[ocirc](snode) {} % S node
;
\draw (xorGate.out) to (snode) % S output wiring
;
\draw (5,2) node[right] {{\color{red}$Sum$}} % S label
;
\draw
(5,0) node[ocirc](cnode) {} % C node
(andGate.out) to (cnode) % C output wiring
(5,0) node[right] {{\color{red}$Carry$}} % C label
;
% Nets:
\draw (ainput) -- (xorGate.in 1) % xor A wiring
;
\draw (binput) -- (xorGate.in 2) % xor B wiring
;
\draw (1.5,1.72) |- (andGate.in 1)
;
\draw (1,2.27) |- (andGate.in 2)
;
\draw (1,2.27) node[circ] {}
;
\draw (1.5,1.72) node[circ] {}
;
\end{circuitikz}