Chat
Welcome to Flux
Treat Flux like your intern. Tell it what you'd like to build and it'll get to work. You can also ask it questions, brainstorm ideas, and teach it your preferences. Learn More
Ready.
Python
import matplotlib.pyplot as plt import networkx as nx # Creación del grafo G = nx.DiGraph() # Añadir nodos para las entradas inputs = ['x2', 'x1', 'x0', 'y2', 'y1', 'y0'] G.add_nodes_from(inputs) # Añadir nodos para XOR gates xor_gates = ['XOR1', 'XOR2', 'XOR3'] G.add_nodes_from(xor_gates) G.add_edges_from([('x2', 'XOR1'), ('y2', 'XOR1'), ('x1', 'XOR2'), ('y1', 'XOR2'), ('x0', 'XOR3'), ('y0', 'XOR3')]) # Añadir nodos para NOT gates not_gates = ['NOT1', 'NOT2', 'NOT3'] G.add_nodes_from(not_gates) G.add_edges_from([('XOR1', 'NOT1'), ('XOR2', 'NOT2'), ('XOR3', 'NOT3')]) # Añadir nodo para AND gate de igualdad G.add_node('AND1') G.add_edges_from([('NOT1', 'AND1'), ('NOT2', 'AND1'), ('NOT3', 'AND1')]) # Añadir nodos para NOT gates adicionales not_add_gates = ['NOT4', 'NOT5', 'NOT6'] G.add_nodes_from(not_add_gates) G.add_edges_from([('y2', 'NOT4'), ('y1', 'NOT5'), ('y0', 'NOT6')]) # Añadir nodos para AND gates de mayor que gt_and_gates = ['AND2', 'AND3', 'AND4'] G.add_nodes_from(gt_and_gates) G.add_edges_from([('x2', 'AND2'), ('NOT4', 'AND2'), ('x2', 'AND3'), ('y2', 'AND3'), ('x1', 'AND3'), ('NOT5', 'AND3'), ('x2', 'AND4'), ('y2', 'AND4'), ('x1', 'AND4'), ('y1', 'AND4'), ('x0', 'AND4'), ('NOT6', 'AND4')]) # Añadir nodo para OR gate de mayor que G.add_node('OR1') G.add_edges_from([('AND2', 'OR1'), ('AND3', 'OR1'), ('AND4', 'OR1')]) # Añadir nodos para AND gates de menor que lt_and_gates = ['AND5', 'AND6', 'AND7'] G.add_nodes_from(lt_and_gates) G.add_edges_from([('y2', 'AND5'), ('NOT1', 'AND5'), ('x2', 'AND6'), ('y2', 'AND6'), ('y1', 'AND6'), ('NOT2', 'AND6'), ('x2', 'AND7'), ('y2', 'AND7'), ('x1', 'AND7'), ('y1', 'AND7'), ('y0', 'AND7'), ('x0', 'AND7')]) # Añadir nodo para OR gate de menor que G.add_node('OR2') G.add_edges_from([('AND5', 'OR2'), ('AND6', 'OR2'), ('AND7', 'OR2')]) # Añadir nodos de salida output_leds = ['S1', 'S0'] G.add_nodes_from(output_leds) G.add_edges_from([('AND1', 'S1'), ('OR1', 'S1'), ('OR2', 'S0')]) # Posiciones pos = { 'x2': (0, 10), 'x1': (0, 8), 'x0': (0, 6), 'y2': (0, 4), 'y1': (0, 2), 'y0': (0, 0), 'XOR1': (1, 9), 'XOR2': (1, 6), 'XOR3': (1, 3), 'NOT1': (2, 9), 'NOT2': (2, 6), 'NOT3': (2, 3), 'AND1': (3, 8), 'NOT4': (2, 4), 'NOT5': (2, 2), 'NOT6': (2, 0), 'AND2': (3, 7), 'AND3': (4, 7), 'AND4': (5, 7), 'OR1': (6, 7), 'AND5': (3, 5), 'AND6': (4, 5), 'AND7': (5, 5), 'OR2': (6, 5), 'S1': (7, 7), 'S0': (7, 5), } # Dibujar el grafo plt.figure(figsize=(12, 8)) nx.draw(G, pos, with_labels=True, node_size=3000, node_color='skyblue', font_size=10, font_weight='bold', arrows=True) plt.title('Diagrama Lógico del Comparador Binario de 3 bits') plt.show()

Image

Image
Reviews
Comparador Binario de 3 Bits
Properties
Properties describe core aspects of the project.
Pricing & Availability
Distributor | Qty 1 |
|---|
Assets
No assets added.
Controls
Welcome 👋
Flux helps you build PCBs faster with an AI teammate!
Create your account to collaborate, stay updated, fork your own version, and get instant answers from our AI agent.
davidguerrero-07
copilot