-
Notifications
You must be signed in to change notification settings - Fork 1
/
commands.tikz
129 lines (102 loc) · 3.91 KB
/
commands.tikz
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
\input{circlething.tex}
\input{box.tex}
\input{connections.tex}
\input{circuit.tex}
\newcommand{\FACTOR}[3]
{
}
\newcommand{\SWITCHUP}[3]
{
\path (#1) coordinate (COORDINATE);
\path (COORDINATE) ++( 0, 0.15) coordinate (POS1);
\path (COORDINATE) ++( 0, -0.15) coordinate (POS2);
\path (COORDINATE) ++( -0.1, 0.145) coordinate (POS3);
\path (COORDINATE) ++( -0.1, 0) coordinate (TEXT);
\path (COORDINATE) ++( 0, 0.2) coordinate (IN#2);
\path (COORDINATE) ++( 0, -0.2) coordinate (OUT#2);
\draw [-] (POS1) -- (IN#2);
\draw [-] (POS2) -- (OUT#2);
\draw [-] (POS2) -- (POS3);
\draw (TEXT) node[draw=none,fill=none, style=left]{ #3 };
}
\newcommand{\SWITCH}[3]
{
\path (#1) coordinate (COORDINATE);
\path (COORDINATE) ++( 0.15, 0) coordinate (POS1);
\path (COORDINATE) ++( -0.15, 0) coordinate (POS2);
\path (COORDINATE) ++( 0.145, 0.1) coordinate (POS3);
\path (COORDINATE) ++( 0, -0.1) coordinate (TEXT);
\path (COORDINATE) ++( 0.2,0) coordinate (IN#2);
\path (COORDINATE) ++( -0.2,0) coordinate (OUT#2);
\draw [-] (POS1) -- (IN#2);
\draw [-] (POS2) -- (OUT#2);
\draw [-] (POS2) -- (POS3);
\draw (TEXT) node[draw=none,fill=none, style=left]{ #3 };
}
\newcommand{\GROUP}[3]
%4 koordinaten: x1,y1,x2,y2, "text"
{
\draw
let
\p1=(#1),
\p2=(#2)
in
[#3] (\x1, \y1) -- (\x2, \y1) -- (\x2, \y2) -- (\x1, \y2) -- (\x1, \y1);
}
\newcommand{\MUX}[2]
{
\path (#1) coordinate (COORDINATE);
\path (COORDINATE) ++(-0.25, 0.5) coordinate (UL);
\path (COORDINATE) ++( 0.25, 0.5) coordinate (UR);
\path (COORDINATE) ++(-0.25, -0.5) coordinate (LL);
\path (COORDINATE) ++( 0.25, -0.5) coordinate (LR);
\path (COORDINATE) ++(0.25, 0) coordinate (_OUT#2);
\path (_OUT#2) ++(0.5,0) coordinate (OUT#2);
\path (COORDINATE) ++(0,0) coordinate (TEXTPOS);
\path (COORDINATE) ++(0, -0.75) coordinate (IND#2);
\path (COORDINATE) ++(-0.5, 0.3) coordinate (IN0#2);
\path (COORDINATE) ++(-0.5, 0.2) coordinate (IN1#2);
\path (COORDINATE) ++(-0.5, 0.1) coordinate (IN2#2);
\path (COORDINATE) ++(-0.5, 0.0) coordinate (IN3#2);
\path (COORDINATE) ++(-0.5,-0.1) coordinate (IN4#2);
\path (COORDINATE) ++(-0.5,-0.2) coordinate (IN5#2);
\path (COORDINATE) ++(-0.5,-0.3) coordinate (IN6#2);
\path (COORDINATE) ++(0, -0.5) coordinate (_IND#2);
\path (COORDINATE) ++(-0.25, 0.3) coordinate (_IN0#2);
\path (COORDINATE) ++(-0.25, 0.2) coordinate (_IN1#2);
\path (COORDINATE) ++(-0.25, 0.1) coordinate (_IN2#2);
\path (COORDINATE) ++(-0.25, 0.0) coordinate (_IN3#2);
\path (COORDINATE) ++(-0.25,-0.1) coordinate (_IN4#2);
\path (COORDINATE) ++(-0.25,-0.2) coordinate (_IN5#2);
\path (COORDINATE) ++(-0.25,-0.3) coordinate (_IN6#2);
\draw [->] (IND#2) -- (_IND#2);
\draw [-] (IN0#2) -- (_IN0#2);
\draw [-] (IN1#2) -- (_IN1#2);
\draw [-] (IN2#2) -- (_IN2#2);
\draw [-] (IN3#2) -- (_IN3#2);
\draw [-] (IN4#2) -- (_IN4#2);
\draw [-] (IN5#2) -- (_IN5#2);
\draw [-] (IN6#2) -- (_IN6#2);
%\draw [-] (IN7#2) -- (_IN7#2);
%\draw [-] (IN8#2) -- (_IN8#2);
\draw [-] (UL) -- (UR);
\draw [-] (UL) -- (LL);
\draw [-] (LR) -- (UR);
\draw [-] (LR) -- (LL);
\draw [-] (_OUT#2) -- (OUT#2);
\draw (TEXTPOS) node[draw=none,fill=none, rotate=90]{ MUX };
}
\newcommand{\DECIDER}[3]
{
\path (#1) coordinate (COORDINATE);
\path (COORDINATE) ++(-.5,-.3) coordinate (tprect1);
\path (COORDINATE) ++( .5, .3) coordinate (tprect2);
\draw (COORDINATE) node[draw=none,fill=none]{#3};
\draw (tprect1) rectangle (tprect2);
\path (COORDINATE) ++( -0.75, 0) coordinate (IN#2);
\path (COORDINATE) ++( 0.75, 0) coordinate (OUT#2);
\path (COORDINATE) ++( -0.5, 0) coordinate (tpinline1);
\path (COORDINATE) ++( 0.5, 0) coordinate (tpoutline1);
\draw [->] (IN#2) -- (tpinline1);
\draw [-] (tpoutline1) -- (OUT#2);
}