Beispiel #1
0
 def _inspect_system(self):
     if not hasattr(self, 'soc'):
         soc = system.node_at_path('/soc')
         self.soc = soc.container
     if not hasattr(self, 'cpu'):
         cpu = system.node_at_path('/soc/cpu')
         self.cpu = cpu.container
Beispiel #2
0
 def _inspect_system(self):
     if not hasattr(self, 'soc'):
         soc = system.node_at_path('/soc')
         self.soc = soc.container
     if not hasattr(self, 'cpu'):
         cpu = system.node_at_path('/soc/cpu')
         self.cpu = cpu.container
Beispiel #3
0
def simulation_view(node_path):
    print node_path
    node = system.node_at_path(node_path)
    print node
    sim = node.container
    print sim
    node_paths, test = sim()
    root = system.node_at_path('/').container
    root.simulate(node_paths, test, sim.name)
Beispiel #4
0
def simulation_view(node_path):
    print node_path
    node = system.node_at_path(node_path)
    print node
    sim = node.container
    print sim
    node_paths, test = sim()
    root = system.node_at_path('/').container
    root.simulate(node_paths, test, sim.name)
Beispiel #5
0
def resource_tree(node_path):
    node = system.node_at_path(node_path)
    with open(system.name + '-resource-tree.latex', 'w') as f:
        node_name = node.name or 'root'
        print >> f, '\\begin{tikzpicture}[align=center]'
        print >> f, '\\tikzstyle{every node} = [draw];'
        print >> f, '\\node (%(name)s) {%(name_newline)s} [edge from parent fork down]' % {
            'name': node_name,
            'name_newline': node_name.replace('_', '\\\\')
        }

        def print_it(i, n):
            d = {
                'name': n.name,
                'name_newline': n.name.replace('_', '\\\\'),
            }
            if len(n.children) == 0:
                print >> f, '    ' * i, 'child { node (%(name)s) {%(name_newline)s} }' % d
            else:
                print >> f, '    ' * i, 'child { node (%(name)s) {%(name_newline)s}' % d
            for child in n.children.itervalues():
                print_it(i + 1, child)

            if len(n.children) > 0:
                print >> f, '    ' * i, '}'

        for child in node.children.itervalues():
            print_it(1, child)
        print >> f, ';'
        print >> f, '\\end{tikzpicture}'
Beispiel #6
0
 def create_net(cls, self, net, width, depth=1, **kwargs):
     net_class = system.models[self.kwargs['net_class']]
     net_node = net_class.create(self.path, net, width, depth, **kwargs)
     os = system.node_at_path('/')
     path = lambda node, name: '%s#%s' % (node.path, name)
     system.add_edge('CallAttrEdge', path(os, 'interface'),
                     path(net_node, 'os'))
     return net_node
Beispiel #7
0
 def create_net(cls, self, net, width, depth=1, **kwargs):
     net_class = system.models[self.kwargs['net_class']]
     net_node = net_class.create(self.path, net, width, depth, **kwargs)
     os = system.node_at_path('/')
     path = lambda node, name: '%s#%s' % (node.path, name)
     system.add_edge('CallAttrEdge',
         path(os, 'interface'),
         path(net_node, 'os'))
     return net_node
Beispiel #8
0
    def simulate(self, node_paths, script, name):
        self._inspect_system()

        self.cpu.program(script)

        nodes = []
        for node in node_paths:
            nodes.append(system.node_at_path(node).container)
        traceSignals.name = name
        t = traceSignals(simulation, self.soc, nodes)
        s = Simulation(t)
        s.run()
Beispiel #9
0
    def simulate(self, node_paths, script, name):
        self._inspect_system()

        self.cpu.program(script)

        nodes = []
        for node in node_paths:
            nodes.append(system.node_at_path(node).container)
        traceSignals.name = name
        t = traceSignals(simulation, self.soc, nodes)
        s = Simulation(t)
        s.run()
Beispiel #10
0
 def create(cls, parent_path, name, clearn, clk, net_class='DspNet'):
     path = lambda node, name: '%s#%s' % (node.path, name)
     self = system.add_node(parent_path, name, 'DspFlow', {
         'net_class': net_class,
     })
     os = system.node_at_path('/')
     system.add_edge('CallAttrEdge', path(os, 'interface'),
                     path(self, 'os'))
     if clearn:
         system.add_edge('CallAttrEdge', path(clearn, 'signals_dict'),
                         path(self, 'clearn'))
     if clk:
         system.add_edge('CallAttrEdge', path(clk, 'out'),
                         path(self, 'clk'))
     return self
Beispiel #11
0
 def create_and_connect(cls, parent_path, name):
     path = lambda node, name: '%s#%s' % (node.path, name)
     os = system.node_at_path('/')
     self = system.add_node(parent_path, name, 'DspFlowController', {})
     system.add_edge('CallAttrEdge',
         path(os, 'interface'),
         path(self, 'os'))
     dsp = system.add_node(self.path, 'dsp', 'DspFlow', {
         'net_class': 'MemFifoDspNet' })
     system.add_edge('CallAttrEdge',
         path(dsp, 'interface'),
         path(self, 'dsp'))
     system.add_edge('CallAttrEdge',
         path(os, 'interface'),
         path(dsp, 'os'))
     return dsp
Beispiel #12
0
 def create(cls, parent_path, name, clearn, clk, net_class='DspNet'):
     path = lambda node, name: '%s#%s' % (node.path, name)
     self = system.add_node(parent_path, name, 'DspFlow', {
         'net_class': net_class,
     })
     os = system.node_at_path('/')
     system.add_edge('CallAttrEdge',
         path(os, 'interface'),
         path(self, 'os'))
     if clearn:
         system.add_edge('CallAttrEdge',
             path(clearn, 'signals_dict'),
             path(self, 'clearn'))
     if clk:
         system.add_edge('CallAttrEdge',
             path(clk, 'out'),
             path(self, 'clk'))
     return self