| 1 |
.PS |
| 2 |
# `AlogixDPV.m4' |
| 3 |
log_init(svg_font(sans-serif,10.5bp__)) |
| 4 |
|
| 5 |
# A modest expression in default form |
| 6 |
A: Autologix( |
| 7 |
Nand(And(Or(A,C),Or(B,~C),Or(~A,B,C)),Ck); |
| 8 |
Nand(~A,B)@with .n at last [].s+(0,-2bp__)) |
| 9 |
"svg_it(Out1)" at A.Out1 ljust |
| 10 |
"svg_it(Out2)" at A.Out2 ljust |
| 11 |
Loopover_(`v_', `"svg_it(v_)" at A.In`'v_ above ', A,B,C,Ck) |
| 12 |
move left 0.2 from A.w |
| 13 |
"svg_tt(`Autologix(')" wid 68bp__ with .w at A.sw+(0,-0.15) |
| 14 |
"svg_tt(`Nand(And(Or(A,C),Or(B,~C),Or(~A,B,C)),Ck);')" \ |
| 15 |
wid 305bp__ with .w at last "".w+(0.2,-0.18) |
| 16 |
"svg_tt(`Nand(~A,B)@with .n at last [].s+(0,-2bp__))')"\ |
| 17 |
wid 313bp__ with .w at last "".w+(0,-0.18) |
| 18 |
|
| 19 |
# Draw a tree of gates only. The ~ has been |
| 20 |
# replaced by NOT gates. |
| 21 |
B: Autologix(Or(And(B,Not(C)),And(Not(A),B,C)),N, shaded "lightblue" ) \ |
| 22 |
with .sw at A.e+(1.3,-0.5) |
| 23 |
"svg_it(Out)" at B.Out above ljust |
| 24 |
"svg_tt(`Autologix(Or(And(B,Not(C)),')" wid 165bp__ \ |
| 25 |
with .w at B.sw+(-0.6,-0.15) |
| 26 |
"svg_tt(`And(Not(A),B,C)),N,')" wid 122bp__ with .w at last "".w+(1.1,-0.18) |
| 27 |
"svg_tt(`shaded \"lightblue\")')" wid 120bp__ \ |
| 28 |
with .w at last "".w+(0,-0.18) |
| 29 |
for_(1,4,1,`"svg_it(B.In`'m4x)" at B.In`'m4x rjust') |
| 30 |
"svg_it(B.In5)" at B.In5+(0,-1.5bp__) rjust |
| 31 |
|
| 32 |
# Here is how to include an arbitrary circuit |
| 33 |
# that is not one of the standard gates. |
| 34 |
# First, define the circuit with a name ending |
| 35 |
# in _gate. Make sure its inputs are on the left |
| 36 |
# and named In1, In2, ... and the output Out |
| 37 |
# is on the right. |
| 38 |
define(`SR_gate',`[ |
| 39 |
S: NOR_gate |
| 40 |
R: NOR_gate at S+(0,-L_unit*(AND_ht+4)) |
| 41 |
w = (S.Out.x-R.In1.x)/3 |
| 42 |
v = 2*L_unit |
| 43 |
line right_ dimen_/2 from S.Out |
| 44 |
Out: Here |
| 45 |
TR: R.In1-(v,0) |
| 46 |
line from S.Out+(v,0) down w*3/2 then left S.Out.x-TR.x+v down w \ |
| 47 |
then to TR then to R.In1 |
| 48 |
TS: S.In2-(v,0); |
| 49 |
line from R.Out right v then up w*3/2 then left R.Out.x-TS.x+v up w \ |
| 50 |
then to TS then to S.In2 |
| 51 |
In1: S.In1 |
| 52 |
In2: R.In2 ]') |
| 53 |
# Now define the function by which the circuit |
| 54 |
# will be invoked: |
| 55 |
define(`SRff',`_AutoGate(SR,$@)') |
| 56 |
|
| 57 |
# You are done. Here is an example: |
| 58 |
G: [ |
| 59 |
F: Autologix(SRff(And(x,y),Nand(x,y)),LRV) |
| 60 |
|
| 61 |
"svg_it(x)" at F.Inx rjust |
| 62 |
"svg_it(y)" at F.Iny rjust |
| 63 |
"svg_it(Out)" at F.Out ljust |
| 64 |
] with .sw at A.n+(0.5,-0.25) |
| 65 |
"svg_tt(`Autologix(SRff(And(x,y),Nand(x,y)),LRV)')" wid 285pt__ \ |
| 66 |
with .w at last [].sw+(0,-10pt__) |
| 67 |
|
| 68 |
undefine(`extras') |
| 69 |
#efine(`extras') |
| 70 |
|
| 71 |
ifdef(`extras',` |
| 72 |
Q1: Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D))) \ |
| 73 |
with .nw at A.sw+(0,-61bp__) |
| 74 |
Loopover_(`x',`"x" wid 7bp__ at last [].In`'x above',A,B,C,D) |
| 75 |
|
| 76 |
"svg_tt(`Q1: Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),options)')" \ |
| 77 |
wid 363bp__ with .nw at Q1.sw+(0,-10bp__) |
| 78 |
"svg_tt(`Loopover_(`x',`\"svg_it(x)\" at last [].In`'x above',A,B,C,D)')" \ |
| 79 |
wid 431bp__ with .nw at last "".sw+(0,-5bp__) |
| 80 |
|
| 81 |
Q2: Autologix(Nor(Nor(A,And(B,~C)),Nand(Not(B),D)),V) \ |
| 82 |
with .nw at last "".sw+(0,-16bp__) |
| 83 |
Loopover_(`x',`"x" at last [].In`'x above',A,B,C,D) |
| 84 |
"V" at last [].se above rjust |
| 85 |
|
| 86 |
Q3: Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),R) \ |
| 87 |
with .nw at last [].sw+(0,-0.2) |
| 88 |
Loopover_(`x',`"x" at last [].In`'x above',A,B,C,D) |
| 89 |
"R" at last [].se above rjust |
| 90 |
|
| 91 |
Q4: Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),RV) \ |
| 92 |
with .nw at last [].sw+(0,-0.2) |
| 93 |
Loopover_(`x',`"x" at last [].In`'x above',A,B,C,D) |
| 94 |
"RV" at last [].se above rjust |
| 95 |
|
| 96 |
Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),LRV) \ |
| 97 |
with .Out at Q4.Out+(3.5,0) |
| 98 |
Loopover_(`x',`"x" at last [].In`'x rjust',A,B,C,D) |
| 99 |
"LRV" at last [].se above rjust |
| 100 |
|
| 101 |
Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),LR;offset=-L_unit*1.5) \ |
| 102 |
with .Out at Q3.Out+(3.5,0) |
| 103 |
Loopover_(`x',`"x" at last [].In`'x rjust',A,B,C,D) |
| 104 |
"LR" at last [].se above rjust |
| 105 |
|
| 106 |
Autologix(Nor(Nor(A,And(B,~C)),Nand(Not(B),D)),LV;offset=L_unit*2) \ |
| 107 |
with .Out at Q2.Out+(3.5,0) |
| 108 |
Loopover_(`x',`"x" at last [].In`'x rjust',A,B,C,D) |
| 109 |
"LV" at last [].se above rjust |
| 110 |
|
| 111 |
Autologix(Nor(Nor(A,And(B,C)),Nand(Not(B),D)),L) \ |
| 112 |
with .Out at Q1.Out+(3.5,0) |
| 113 |
Loopover_(`x',`"x" at last [].In`'x rjust',A,B,C,D) |
| 114 |
"L" at last [].se above rjust |
| 115 |
') |
| 116 |
|
| 117 |
command "</g>" # end font |
| 118 |
.PE |