optimizing a gate level bcm to the end of the earth and back
at main 82 lines 2.8 kB view raw
1digraph BCD_7Seg { 2 label="BCD to 7-Segment Decoder\n23 gate inputs (7x2-input + 3x3-input)\nUsing: AND, OR, XOR, NAND, NOR"; 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=lightyellow, label="XOR"]; 27 g1 [shape=box, style=filled, fillcolor=lightsalmon, label="OR"]; 28 g2 [shape=box, style=filled, fillcolor=lightyellow, label="XOR"]; 29 g3 [shape=box, style=filled, fillcolor=lightsalmon, label="OR"]; 30 g4 [shape=box, style=filled, fillcolor=lightgreen, label="AND"]; 31 g5 [shape=box, style=filled, fillcolor=lightsalmon, label="OR"]; 32 g6 [shape=box, style=filled, fillcolor=palegreen, label="NAND"]; 33 g7 [shape=box, style=filled, fillcolor=coral, label="OR3"]; 34 g8 [shape=box, style=filled, fillcolor=khaki, label="XOR3"]; 35 g9 [shape=box, style=filled, fillcolor=khaki, label="XOR3"]; 36 } 37 38 // Connections 39 A -> g0; 40 C -> g0; 41 nD -> g1; 42 g0 -> g1; 43 B -> g2; 44 g1 -> g2; 45 g0 -> g3; 46 g2 -> g3; 47 nD -> g4; 48 g3 -> g4; 49 g2 -> g5; 50 g4 -> g5; 51 B -> g6; 52 g5 -> g6; 53 B -> g7; 54 D -> g7; 55 nC -> g7; 56 nC -> g8; 57 g1 -> g8; 58 g6 -> g8; 59 g0 -> g9; 60 g1 -> g9; 61 g5 -> g9; 62 63 subgraph cluster_outputs { 64 label="Outputs"; 65 style=dashed; 66 out_a [shape=doublecircle, style=filled, fillcolor=lightpink, label="a"]; 67 out_b [shape=doublecircle, style=filled, fillcolor=lightpink, label="b"]; 68 out_c [shape=doublecircle, style=filled, fillcolor=lightpink, label="c"]; 69 out_d [shape=doublecircle, style=filled, fillcolor=lightpink, label="d"]; 70 out_e [shape=doublecircle, style=filled, fillcolor=lightpink, label="e"]; 71 out_f [shape=doublecircle, style=filled, fillcolor=lightpink, label="f"]; 72 out_g [shape=doublecircle, style=filled, fillcolor=lightpink, label="g"]; 73 } 74 75 g3 -> out_a; 76 g6 -> out_b; 77 g7 -> out_c; 78 g5 -> out_d; 79 g4 -> out_e; 80 g8 -> out_f; 81 g9 -> out_g; 82}