Пример #1
0
 def load_plugins_info(self):
     import plugins
     from util import SortedDict
     self.plugins = SortedDict()
     self.enabled_plugins = SortedDict()
     for plugin in plugins.plugin_list:
         self.plugins[plugin.name] = plugin
         if plugin.enabled:
             self.enabled_plugins[plugin.name] = plugin
Пример #2
0
class TopicToc(Toc):
    title = "ASN Standards Documents"
    topics = SortedDict()

    def addEntry(self, docInfo):
        Toc.addEntry(self, docInfo)
        topic = docInfo.topic
        if not topic in self.topics.keys():
            self.topics[topic] = []
        self.topics[topic].append(makeKey(docInfo))
        self.writeXml()

    def getTocHtml(self):
        html = DIV()
        for topic in self.topics.keys():
            html.append(
                DIV(B(self.helper.getTopic(topic)), klass="topic-header"))
            toc = UL()
            print "topic items"
            topic_keys = self.topics[topic]
            topic_keys.sort()
            for key in topic_keys:

                # url = key + ".html"
                # inktext = "%s (%s)" % (self.helper.getAuthor(docInfo.author), docInfo.created)
                # href = Href (url, inktext,
                # title=docInfo.title,
                # target="content")
                print "\tkey: ", key
                link = self.getLink(key)
                toc.append(LI(link, klass="toc-link", id=key))
            html.append(toc)
        return html
Пример #3
0
    def __init__(self, modules, nets, name=''):
        super().__init__(name)
        self._modules = set()
        self._nets = set()

        mods = SortedDict()
        for mod_name,args in modules.items():
            mod = Module(mod_name, args['type'], args['conf'])
            self.modules.add(mod)
            mods[mod_name] = mod

        for src_name, src_port, dst_name, dst_port, width in nets:
            src = mods[src_name]
            dst = mods[dst_name]
            self.nets.add(Net(src, src_port, dst, dst_port, width))
Пример #4
0
def load_core(file, *libs):
    context = coreir.Context()
    for lib in libs:
        context.load_library(lib)

    top_module = context.load_from_file(file)
    top_def = top_module.definition
    modules = SortedDict()

    for inst in top_def.instances:
        inst_name = inst.selectpath[0]
        inst_type = inst.module_name

        modules[inst_name] = dict()

        if inst_type[:2] == 'PE':
            modules[inst_name]['type'] = 'PE'
            modules[inst_name]['conf'] = inst.get_config_value('op')

        elif inst_type[:5] == 'Const':
            modules[inst_name]['type'] = 'Const'
            modules[inst_name]['conf'] = inst.get_config_value('value')

        elif inst_type[:2] == 'IO':
            modules[inst_name]['type'] = 'IO'
            modules[inst_name]['conf'] = inst.get_config_value('mode')

        elif inst_type[:3] == 'Reg':
            modules[inst_name]['type'] = 'Reg'
            modules[inst_name]['conf'] = None

        elif inst_type[:3] == 'Mem':
            modules[inst_name]['type'] = 'Mem'
            modules[inst_name]['conf'] = inst.get_config_value('mode')

        else:
            raise ValueError(
                "Unknown module_name '{}' expected <'PE', 'Const', 'IO', 'Reg', 'Mem'>"
                .format(inst_type))

    nets = set()
    for con in top_def.connections:
        v1 = con.first.selectpath
        v2 = con.second.selectpath

        if 'out' in v1:
            src = v1
            dst = v2
        else:
            src = v2
            dst = v1

        src_name = src[0]
        dst_name = dst[0]
        src_port = PORT_TRANSLATION[modules[src_name]['type']][','.join(
            src[1:])]
        dst_port = PORT_TRANSLATION[modules[dst_name]['type']][','.join(
            dst[1:])]
        width = 16

        net = (src_name, src_port, dst_name, dst_port, width)
        nets.add(net)

    return modules, nets