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