Debian Codegraph @

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

raw
1 .PS
2 # ex21.m4
3 log_init
4 iflatex(`textoffset = 1bp__; ifpsfrag(,`latexcommand({\sf)') ')
5
6 dy = 0.2
7 ddy = 1.8*dy
8
9 D: FlipFlop(D)
10 `"\tt FlipFlop(D)"' at last [].s+(0,-ddy) above
11 T: FlipFlop( T) with .Chip.sw at last [].se + (0.4,0)
12 `"\tt FlipFlop(T)"' at last [].s+(0,-ddy) above
13 RS: FlipFlop(RS) with .Chip.sw at last [].se + (0.4,0)
14 `"\tt FlipFlop(RS)"' at last [].s+(0,-ddy) above
15 JK: FlipFlop(JK) with .Chip.sw at last [].se + (0.4,0)
16 `"\tt FlipFlop(JK)"' at last [].s+(0,-dy) above
17
18 # Test 3: synchronous 3-bit counter
19 define(`counterFF',``$1':FlipFlop(JK) `$2'
20 "\sf\scriptsize `$1'" at `$1'.Chip.sw below ljust
21 "\sf\scriptsize $`'1$" at `$1'.PinCLR.end above
22 "\sf\scriptsize $`'1$" at `$1'.PinPR.end below')
23
24 [
25 right_
26 counterFF(FF0)
27 counterFF(FF1,with .Chip at FF0.Chip+(-28*L_unit,0))
28 counterFF(FF2,with .Chip at FF1.Chip+(-28*L_unit,0))
29 "\sf\scriptsize $1$sp_" at FF0.PinJ.end rjust
30 "\sf\scriptsize $1$sp_" at FF0.PinK.end rjust
31 Dc: FF2.Chip.sw+(-9*L_unit,-7*L_unit)
32 Bot: Dc+(0,-3*L_unit)
33
34 left_
35 AndG: AND_gate at FF1.Chip.nw+(4*L_unit,12*L_unit)
36 right_
37
38 line from FF2.PinCK.end left 3*L_unit
39 line to (Here,Dc); dot
40 line from FF1.PinCK.end left 3*L_unit
41 line to (Here,Dc); dot
42 line from FF0.PinCK.end left 3*L_unit
43 line to (Here,Dc) then to Dc
44 "\sf\scriptsize $D_C$ sp_" rjust
45
46 line from FF2.PinK.end to FF2.PinJ.end; dot
47 line to (Here,AndG.Out) then to AndG.Out
48
49 line from FF1.PinK.end to FF1.PinJ.end; dot
50 line to (Here,FF1.PinCLR.end+(0,3*L_unit))
51 line to (AndG.In2+(6*L_unit,0),Here) then to AndG.In2+(6*L_unit,0); dot
52
53 line from FF0.PinQ.end right 0.1; dot
54 line from AndG.In2 to (Here,AndG.In2) then to (Here,Bot); "$D_{00}$" below
55
56 line right 0.1 from FF1.PinQ.end; dot
57 line from AndG.In1 to (Here,AndG.In1) then to (Here,Bot); "$D_{01}$" below
58
59 line right 0.1 from FF2.PinQ.end
60 line to (Here,Bot); "$D_{02}$" below
61 ] with .n at 0.5<2nd[].s,3rd[].s> - (0,0.4)
62
63 iflatex(ifpsfrag(,`latexcommand(})'))
64 .PE