Exemplo n.º 1
0
 def init(self, pragma_registry):
     config.set_roccc_root(os.environ["ROCCC_ROOT"])
     mkdir_safe(os.path.join(poroto_config.gen_path, '.ROCCC'))
     intrinsics.remove_all()
     function.function_instance_generator = RocccFunctionInstance
     pragma_registry.add_pragma_type('roccc',
                                     RocccPragmaHandler(self.debug))
Exemplo n.º 2
0
 def generate(self, *klist):
     if len(klist) > 1:
         out_file_name = os.path.join(*klist)
     else:
         out_file_name = klist[0]
     mkdir_safe(os.path.dirname(out_file_name))
     out = open(out_file_name, 'w')
     for line in self.template:
         for (key, value) in self.map.iteritems():
             tag = "%%%" + key + "%%%"
             if tag in line:
                 if isinstance(value, list):
                     line = ""
                     for item in value:
                         print >> out, item
                 else:
                     try:
                         line = string.replace(line, tag, str(value))
                     except TypeError:
                         print "Tag '%s' has not a string value '%s'" % (
                             tag, value)
                         raise Exception("Invalid tag value")
         print >> out, line,
     out.close()
Exemplo n.º 3
0
from poroto.roccc.tool import invoke_roccc
from poroto.roccc import config
from poroto.common import mkdir_safe
import os
import sys

config.set_roccc_root(os.environ["ROCCC_ROOT"])
name = sys.argv[1]
filename = sys.argv[2]
type = sys.argv[3]
if type == 'system':
    options = [
        'MultiplyByConstElimination',
        'DivisionByConstElimination',
    ]
else:
    options = [
        'MultiplyByConstElimination', 'DivisionByConstElimination', 'Export',
        'FullyUnroll'
    ]
print "Generating %s %s (%s)" % (type, name, filename)
mkdir_safe('.ROCCC')
invoke_roccc(name, '.', filename, options, config.default_lo_options,
             config.default_timing_options)
Exemplo n.º 4
0
 def generate(self, designer):
     mkdir_safe(os.path.join(gen_path, ipcore_path, "%s_brom" % self.name))
     self.generateCoe()
     self.generateXco(designer)
     return self.latency
Exemplo n.º 5
0
 def generate(self, designer):
     self.xco_template = FileTemplate('bram.xco')
     mkdir_safe(os.path.join(gen_path, ipcore_path, "%s_bram" % self.name))
     self.generateXco()
     designer.add_file(ipcore_path, "%s_bram/%s_bram.xco" % (self.name, self.name))