def vrewrite(ctx, body): index = {} for name, v in ctx.scope.items(): if not isinstance(v, ir.Variable): continue index[name] = v.dtype if typeof(v.dtype, ir.IntfType): index[f'{name}_s'] = v.dtype.dtype else: if v.reg: index[f'{name}_next'] = v.dtype return rewrite(body, index)
def generate(self, template_env, outdir): ctx = self.module_context(template_env) module = template_env.render_local(self.impl_path, self.impl_basename, self.module_context(template_env)) if template_env.lang == 'v': index = {} for intf in ctx['intfs']: index[intf['name']] = Intf(intf['type']) index[f'{intf["name"]}_s'] = intf['type'] module = rewrite(module, index) save_file(self.file_basename, outdir, module)
def generate(self, template_env, outdir): ctx = self.module_context(template_env) module = template_env.render_local(self.impl_path, self.impl_basename, self.module_context(template_env)) if template_env.lang == 'v': index = {} for intf in ctx['intfs']: from pygears.hls import ir direction = ir.IntfType.iin if intf['modport'] == 'consumer' else ir.IntfType.iout index[intf['name']] = ir.IntfType[intf['type'], direction] index[f'{intf["name"]}_s'] = intf['type'] module = rewrite(module, index) save_file(self.file_basename, outdir, module)