URL
https://opencores.org/ocsvn/nocmodel/nocmodel/trunk
[/] [nocmodel/] [trunk/] [nocmodel/] [noc_guilib.py] - Diff between revs 2 and 3
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 2 |
Rev 3 |
Line 38... |
Line 38... |
|
|
This module declares functions to draw graphical representations of
|
This module declares functions to draw graphical representations of
|
NoCmodel objects.
|
NoCmodel objects.
|
|
|
"""
|
"""
|
|
try:
|
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
|
has_matplotlib = True
|
|
except:
|
|
print("Matplotlib package not found. Drawing functions will not work.")
|
|
has_matplotlib = False
|
|
|
import networkx as nx
|
import networkx as nx
|
|
|
from noc_base import *
|
from noc_base import *
|
|
|
def draw_noc(noc, rectangular=True, nodepos=None):
|
def draw_noc(noc, rectangular=True, nodepos=None):
|
Line 56... |
Line 61... |
having coord_x and coord_y attributes. If false, expect router's
|
having coord_x and coord_y attributes. If false, expect router's
|
positions in nodepos argument
|
positions in nodepos argument
|
* nodepos: Optional dictionary where keys are router's indexes and values
|
* nodepos: Optional dictionary where keys are router's indexes and values
|
are tuples with x and y positions.
|
are tuples with x and y positions.
|
"""
|
"""
|
|
if not has_matplotlib:
|
|
print("Function not available")
|
|
return None
|
|
|
# node positions
|
# node positions
|
if rectangular:
|
if rectangular:
|
if nodepos == None:
|
if nodepos == None:
|
nodepos = {}
|
nodepos = {}
|
for i in noc.router_list():
|
for i in noc.router_list():
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.