Debian Codegraph @

texmf-dist/doc/latex/circuit-macros/examples/ex08.m4

raw
1 .PS
2 # ex08.m4
3 log_init
4
5 define(`del',`L_unit*5/2')
6
7 # Input labels
8 C: grid_(0,0); "\sf C sp_" rjust at C
9 DE: C+grid_(0,AND_ht*7/4)
10 A0: DE+grid_(0,BUF_ht*3/2); "\sf A0 sp_" rjust at A0
11 A1: A0+grid_(0,BUF_ht*3/2); "\sf A1 sp_" rjust at A1
12 A2: A1+grid_(0,BUF_ht*3/2); "\sf A2 sp_" rjust at A2
13 move to (-0.2,0) # Lettering within the global object
14
15 # Buffer strings
16 for_(1,3,1,
17 `line right 3*del from A`'eval(3-m4x)
18 B`'eval(2*m4x-1): NOT_gate; line right 2*del
19 T`'m4x: last line.c
20 B`'eval(2*m4x): BUFFER_gate(,N) ')
21
22 B7: BUFFER_gate at (B1,C)
23
24 G1: NOR_gate with .Out at (B1.Out,DE)
25 G2: NOR_gate at (B2+grid_(N_rad,0),G1-grid_(0,AND_ht))
26 G3: AND_gate(4) with .In1 at (G2.Out+(9*del,0),A2)
27 G5: AND_gate(4) with .In4 at (G3.In1,G2.Out)
28 G6: AND_gate at G5+grid_(AND_wd,AND_ht*3/4)+(del*2,0)
29 G4: NOR_gate with .In1 at (G6.Out,G3)+(2*del,0)
30 G7: NOR_gate with .In2 at (G4.In2,G5.Out)
31
32 # Output to other latches
33 TOL: (G2.Out,C)+(4*del,-4*L_unit)
34 move to TOL+(3*del,-del/3) ; {move down 0.15}
35 "\sf {\sl To other latches}" below
36
37 # Remaining input lines
38 line from G1.In1 to (DE,G1.In1); "\sf D sp_" rjust
39 line from G1.In2 to (DE,G1.In2); "\sf E sp_" rjust
40 dot(at G1.In2-(del,0)); line to (Here,G2.In2) then to G2.In2
41 line from C to B7.In1
42
43 # Connect Bi, and connect to output bus
44 for_(1,3,1,
45 `dot(at T`'m4x.c) ; line down (A2.y-A1.y)/2
46 line to (TOL-(m4x*del,0),Here) ; arrow to (Here,TOL) ')
47
48 # G1 to G2
49 dot(at (T1.c,G1)); line to (Here,G2.In1) then to G2.In1
50
51 # Upper And inputs to output bus
52 for_(1,4,1,
53 `line left eval(5-m4x)*del from G3.In`'m4x
54 arrow to (Here,TOL) ')
55
56 line from B2.Out to (G3.In1,B2)-(4*del,0) ; dot
57 line from B4.Out to (G3.In2,B4)-(3*del,0) ; dot
58 line from B6.Out to (G3.In3,B6)-(2*del,0) ; dot
59 line from G1.Out to (G3.In4,G1)-(del,0) ; dot
60
61 # Lower And inputs
62 line left 4*del from G5.In1 ; dot
63 line left 3*del from G5.In2 ; dot
64 line left 2*del from G5.In3 ; dot
65 line from G2.Out to G5.In4 ; dot(at (TOL,Here)) ; arrow to (Here,TOL)
66
67 # Fix up G4, G6, G7
68 line from G3.Out to G4.In1
69 line right del from G4.Out
70 {dot; line right del ; "\sf sp_ Q7" ljust; move right 0.2 } # letters in object
71 line down 2*del then to G6.In1+(-del,del)
72 line to (Here,G6.In1) then to G6.In1
73 line from G4.In2 to (G6.In1+(-del,0),G4.In2)
74 line down del then to G7.Out+(del,2*del)
75 line to (Here,G7) then to G7.Out
76 line from G6.Out right del ; line to (Here,G7.In1) then to G7.In1
77 line from G5.Out to G7.In2
78 line left del from G6.In2 ; arrow to (Here,TOL)
79 dot(at (Here,C)) ; line to B7.Out
80
81 .PE