def emit_futil(program) -> str: """Lowers a Relay function to a FuTIL program.""" relay_program = relay_transforms(program) visitor = Relay2Futil() main, func_defs = visitor.visit(relay_program) return '\n'.join( (Program(imports=[Import("primitives/std.lib")], components=[main]).doc(), emit_components(func_defs)))
def emit_futil(program) -> str: """Lowers a Relay function to a Calyx program.""" relay_program = relay_transforms(program) visitor = Relay2Futil() main, func_defs = visitor.visit(relay_program) return "\n".join(( Program( imports=[ Import("primitives/std.lib"), Import("primitives/bitnum/math.futil"), ], components=[main], ).doc(), emit_components(func_defs), ))
def emit_calyx(relay_ir) -> str: """Lowers a Relay function to a Calyx program.""" relay_ir = relay_transforms(relay_ir) visitor = Relay2Calyx() main, func_defs = visitor.visit(relay_ir) check_naming_convention(func_defs) return "\n".join( ( Program( imports=[ Import("primitives/std.lib"), Import("primitives/math.futil"), ], components=[main], ).doc(), emit_components(func_defs), ) )