Skip to content
Snippets Groups Projects
Commit b8c445b3 authored by Thomas Kramer's avatar Thomas Kramer
Browse files

inspect routing: shift layers for pseudo 3D plotting

parent f2239462
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@ Wrap a graph router and add visual inspection capabilities.
import os
import math
import networkx as nx
from ..layout.layers import layermap
from typing import *
import logging
......@@ -41,7 +42,8 @@ class InspectRouter(GraphRouter):
solutions = self.sub_graphrouter.route(routing_problem)
for routes in solutions:
self._inspect(routes)
if routes:
self._inspect(routes)
yield routes
self.iteration_count += 1
......@@ -53,11 +55,17 @@ class InspectRouter(GraphRouter):
def _plot_to_file(self, routes: Dict[Any, nx.Graph]):
path = os.path.join(self.output_dir, f"routing_iter_{self.iteration_count:04}.png")
# Compute offsets for pseudo 3D plotting.
layer_names = sorted(layermap.keys(), key=lambda n: layermap[n][0])
layer_offset = {n: i for i, n in enumerate(layer_names)}
# Find positions of graph nodes.
pos = dict()
for n in self._graph.nodes():
if not self._is_virtual_node_fn(n):
layer, (x, y) = n
pos[n] = (x, y)
offset = 16*layer_offset[layer]
pos[n] = (x-offset, y+offset)
def hue2rgb(hue: float) -> str:
# Create a HTML color code from a hue value.
......
......@@ -924,6 +924,9 @@ def main():
level=log_level,
filename=args.log)
# Silence very verbose matplotlib.
logging.getLogger("matplotlib").setLevel(logging.WARNING)
# Load netlist of cell
cell_name = args.cell
netlist_path = args.netlist
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment