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))
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()
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)
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
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))