optimizing a gate level bcm to the end of the earth and back
1digraph BCD_7Seg {
2 label="BCD to 7-Segment Decoder\n22 gate inputs (8x2-input + 2x3-input)";
3 labelloc="t";
4 fontsize=16;
5 rankdir=LR;
6 splines=ortho;
7 nodesep=0.5;
8 ranksep=1.0;
9
10 subgraph cluster_inputs {
11 label="Inputs";
12 style=dashed;
13 A [shape=circle, style=filled, fillcolor=lightblue, label="A"];
14 B [shape=circle, style=filled, fillcolor=lightblue, label="B"];
15 C [shape=circle, style=filled, fillcolor=lightblue, label="C"];
16 D [shape=circle, style=filled, fillcolor=lightblue, label="D"];
17 nA [shape=circle, style=filled, fillcolor=lightcyan, label="A'"];
18 nB [shape=circle, style=filled, fillcolor=lightcyan, label="B'"];
19 nC [shape=circle, style=filled, fillcolor=lightcyan, label="C'"];
20 nD [shape=circle, style=filled, fillcolor=lightcyan, label="D'"];
21 }
22
23 subgraph cluster_gates {
24 label="Logic Gates";
25 style=dashed;
26 g0 [shape=box, style=filled, fillcolor=peachpuff, label="NOR"];
27 g1 [shape=box, style=filled, fillcolor=lightyellow, label="XOR"];
28 g2 [shape=box, style=filled, fillcolor=lightyellow, label="XOR"];
29 g3 [shape=box, style=filled, fillcolor=palegreen, label="NAND"];
30 g4 [shape=box, style=filled, fillcolor=palegreen, label="NAND"];
31 g5 [shape=box, style=filled, fillcolor=lightsalmon, label="OR"];
32 g6 [shape=box, style=filled, fillcolor=lightgreen, label="AND"];
33 g7 [shape=box, style=filled, fillcolor=lightsalmon, label="OR"];
34 g8 [shape=box, style=filled, fillcolor=coral, label="OR3"];
35 g9 [shape=box, style=filled, fillcolor=plum, label="SPECIAL"];
36 }
37
38 // Connections
39 A -> g0;
40 C -> g0;
41 B -> g1;
42 g0 -> g1;
43 D -> g2;
44 g1 -> g2;
45 B -> g3;
46 g2 -> g3;
47 g1 -> g4;
48 g3 -> g4;
49 g0 -> g5 [taillabel="'"];
50 g2 -> g5;
51 nD -> g6;
52 g5 -> g6;
53 g2 -> g7;
54 g6 -> g7;
55 nA -> g8 [taillabel="'"];
56 g2 -> g8;
57 g6 -> g8;
58 D -> g9;
59 nC -> g9;
60 g2 -> g9;
61
62 subgraph cluster_outputs {
63 label="Outputs";
64 style=dashed;
65 out_a [shape=doublecircle, style=filled, fillcolor=lightpink, label="a"];
66 out_b [shape=doublecircle, style=filled, fillcolor=lightpink, label="b"];
67 out_c [shape=doublecircle, style=filled, fillcolor=lightpink, label="c"];
68 out_d [shape=doublecircle, style=filled, fillcolor=lightpink, label="d"];
69 out_e [shape=doublecircle, style=filled, fillcolor=lightpink, label="e"];
70 out_f [shape=doublecircle, style=filled, fillcolor=lightpink, label="f"];
71 out_g [shape=doublecircle, style=filled, fillcolor=lightpink, label="g"];
72 }
73
74 g5 -> out_a;
75 g3 -> out_b;
76 g8 -> out_c;
77 g7 -> out_d;
78 g6 -> out_e;
79 g9 -> out_f;
80 g4 -> out_g;
81}