Example #1
0
def dot_create_nodes(simNode, callgraph):
    if isRoot(simNode):
        label = "root"
    else:
        label = simNode._name
    full_path = re.sub('\.', '_', simNode.path())
    # add class name under the label
    label = "\"" + label + " \\n: " + simNode.__class__.__name__ + "\""

    # each component is a sub-graph (cluster)
    cluster = dot_create_cluster(simNode, full_path, label)

    # create nodes per port
    for port_name in simNode._ports.keys():
        port = simNode._port_refs.get(port_name, None)
        if port != None:
            full_port_name = full_path + "_" + port_name
            port_node = dot_create_node(simNode, full_port_name, port_name)
            cluster.add_node(port_node)

    # recurse to children
    if simNode._children:
        for c in simNode._children:
            child = simNode._children[c]
            if isSimObjectVector(child):
                for obj in child:
                    dot_create_nodes(obj, cluster)
            else:
                dot_create_nodes(child, cluster)

    callgraph.add_subgraph(cluster)
Example #2
0
def dot_create_nodes(simNode, callgraph):
    if isRoot(simNode):
        label = "root"
    else:
        label = simNode._name
    full_path = re.sub('\.', '_', simNode.path())
    # add class name under the label
    label = "\"" + label + " \\n: " + simNode.__class__.__name__ + "\""

    # each component is a sub-graph (cluster)
    cluster = dot_create_cluster(simNode, full_path, label)

    # create nodes per port
    for port_name in simNode._ports.keys():
        port = simNode._port_refs.get(port_name, None)
        if port != None:
            full_port_name = full_path + "_" + port_name
            port_node = dot_create_node(simNode, full_port_name, port_name)
            cluster.add_node(port_node)

    # recurse to children
    if simNode._children:
        for c in simNode._children:
            child = simNode._children[c]
            if isSimObjectVector(child):
                for obj in child:
                    dot_create_nodes(obj, cluster)
            else:
                dot_create_nodes(child, cluster)

    callgraph.add_subgraph(cluster)
Example #3
0
def simnode_children(simNode):
    for child in simNode._children.itervalues():
        if isNullPointer(child):
            continue
        if isSimObjectVector(child):
            for obj in child:
                if not isNullPointer(obj):
                    yield obj
        else:
            yield child
Example #4
0
def simnode_children(simNode):
    for child in simNode._children.itervalues():
        if isNullPointer(child):
            continue
        if isSimObjectVector(child):
            for obj in child:
                if not isNullPointer(obj):
                    yield obj
        else:
            yield child
Example #5
0
def dot_create_edges(simNode, callgraph):
    for port_name in simNode._ports.keys():
        port = simNode._port_refs.get(port_name, None)
        if port != None:
            full_path = re.sub('\.', '_', simNode.path())
            full_port_name = full_path + "_" + port_name
            port_node = dot_create_node(simNode, full_port_name, port_name)
            # create edges
            if type(port) is m5.params.PortRef:
                dot_add_edge(simNode, callgraph, full_port_name, port)
            else:
                for p in port.elements:
                    dot_add_edge(simNode, callgraph, full_port_name, p)

    # recurse to children
    if simNode._children:
        for c in simNode._children:
            child = simNode._children[c]
            if isSimObjectVector(child):
                for obj in child:
                    dot_create_edges(obj, callgraph)
            else:
                dot_create_edges(child, callgraph)
Example #6
0
def dot_create_edges(simNode, callgraph):
    for port_name in simNode._ports.keys():
        port = simNode._port_refs.get(port_name, None)
        if port != None:
            full_path = re.sub('\.', '_', simNode.path())
            full_port_name = full_path + "_" + port_name
            port_node = dot_create_node(simNode, full_port_name, port_name)
            # create edges
            if isinstance(port, PortRef):
                dot_add_edge(simNode, callgraph, full_port_name, port)
            else:
                for p in port.elements:
                    dot_add_edge(simNode, callgraph, full_port_name, p)

    # recurse to children
    if simNode._children:
        for c in simNode._children:
            child = simNode._children[c]
            if isSimObjectVector(child):
                for obj in child:
                    dot_create_edges(obj, callgraph)
            else:
                dot_create_edges(child, callgraph)
Example #7
0
def dot_create_dvfs_nodes(simNode, callgraph, domain=None):
    if isRoot(simNode):
        label = "root"
    else:
        label = simNode._name
    full_path = re.sub('\.', '_', simNode.path())
    # add class name under the label
    label = "\"" + label + " \\n: " + simNode.__class__.__name__ + "\""

    # each component is a sub-graph (cluster)
    cluster = dot_create_cluster(simNode, full_path, label)

    # create nodes per port
    for port_name in simNode._ports.keys():
        port = simNode._port_refs.get(port_name, None)
        if port != None:
            full_port_name = full_path + "_" + port_name
            port_node = dot_create_node(simNode, full_port_name, port_name)
            cluster.add_node(port_node)

    # Dictionary of DVFS domains
    dvfs_domains = {}

    # recurse to children
    if simNode._children:
        for c in simNode._children:
            child = simNode._children[c]
            if isSimObjectVector(child):
                for obj in child:
                    try:
                        c_dom = obj.__getattr__('clk_domain')
                        v_dom = c_dom.__getattr__('voltage_domain')
                    except AttributeError:
                        # Just re-use the domain from above
                        c_dom = domain
                        v_dom = c_dom.__getattr__('voltage_domain')
                        pass

                    if c_dom == domain or c_dom == None:
                        dot_create_dvfs_nodes(obj, cluster, domain)
                    else:
                        if c_dom not in dvfs_domains:
                            dvfs_cluster = dot_add_clk_domain(c_dom, v_dom)
                            dvfs_domains[c_dom] = dvfs_cluster
                        else:
                            dvfs_cluster = dvfs_domains[c_dom]
                        dot_create_dvfs_nodes(obj, dvfs_cluster, c_dom)
            else:
                try:
                    c_dom = child.__getattr__('clk_domain')
                    v_dom = c_dom.__getattr__('voltage_domain')
                except AttributeError:
                    # Just re-use the domain from above
                    c_dom = domain
                    v_dom = c_dom.__getattr__('voltage_domain')
                    pass

                if c_dom == domain or c_dom == None:
                    dot_create_dvfs_nodes(child, cluster, domain)
                else:
                    if c_dom not in dvfs_domains:
                        dvfs_cluster = dot_add_clk_domain(c_dom, v_dom)
                        dvfs_domains[c_dom] = dvfs_cluster
                    else:
                        dvfs_cluster = dvfs_domains[c_dom]
                    dot_create_dvfs_nodes(child, dvfs_cluster, c_dom)

    for key in dvfs_domains:
        cluster.add_subgraph(dvfs_domains[key])

    callgraph.add_subgraph(cluster)
Example #8
0
def dot_create_dvfs_nodes(simNode, callgraph, domain=None):
    if isRoot(simNode):
        label = "root"
    else:
        label = simNode._name
    full_path = re.sub('\.', '_', simNode.path())
    # add class name under the label
    label = "\"" + label + " \\n: " + simNode.__class__.__name__ + "\""

    # each component is a sub-graph (cluster)
    cluster = dot_create_cluster(simNode, full_path, label)

    # create nodes per port
    for port_name in simNode._ports.keys():
        port = simNode._port_refs.get(port_name, None)
        if port != None:
            full_port_name = full_path + "_" + port_name
            port_node = dot_create_node(simNode, full_port_name, port_name)
            cluster.add_node(port_node)

    # Dictionary of DVFS domains
    dvfs_domains = {}

    # recurse to children
    if simNode._children:
        for c in simNode._children:
            child = simNode._children[c]
            if isSimObjectVector(child):
                for obj in child:
                    try:
                        c_dom = obj.__getattr__('clk_domain')
                        v_dom = c_dom.__getattr__('voltage_domain')
                    except AttributeError:
                        # Just re-use the domain from above
                        c_dom = domain
                        v_dom = c_dom.__getattr__('voltage_domain')
                        pass

                    if c_dom == domain or c_dom == None:
                        dot_create_dvfs_nodes(obj, cluster, domain)
                    else:
                        if c_dom not in dvfs_domains:
                            dvfs_cluster = dot_add_clk_domain(c_dom, v_dom)
                            dvfs_domains[c_dom] = dvfs_cluster
                        else:
                            dvfs_cluster = dvfs_domains[c_dom]
                        dot_create_dvfs_nodes(obj, dvfs_cluster, c_dom)
            else:
                try:
                    c_dom = child.__getattr__('clk_domain')
                    v_dom = c_dom.__getattr__('voltage_domain')
                except AttributeError:
                    # Just re-use the domain from above
                    c_dom = domain
                    v_dom = c_dom.__getattr__('voltage_domain')
                    pass

                if c_dom == domain or c_dom == None:
                    dot_create_dvfs_nodes(child, cluster, domain)
                else:
                    if c_dom not in dvfs_domains:
                        dvfs_cluster = dot_add_clk_domain(c_dom, v_dom)
                        dvfs_domains[c_dom] = dvfs_cluster
                    else:
                        dvfs_cluster = dvfs_domains[c_dom]
                    dot_create_dvfs_nodes(child, dvfs_cluster, c_dom)

    for key in dvfs_domains:
        cluster.add_subgraph(dvfs_domains[key])

    callgraph.add_subgraph(cluster)