Skip to content
Snippets Groups Projects
Commit 98f072ff authored by Dominik Thoennes's avatar Dominik Thoennes
Browse files

some fixes for hyteg

parent f8ea9fc4
No related branches found
No related tags found
1 merge request!149WIP: Hyteg
Pipeline #29145 failed
...@@ -228,7 +228,8 @@ class CBackend: ...@@ -228,7 +228,8 @@ class CBackend:
def _print_LoopOverCoordinate(self, node): def _print_LoopOverCoordinate(self, node):
counter_symbol = node.loop_counter_name counter_symbol = node.loop_counter_name
start = f"int {counter_symbol} = {self.sympy_printer.doprint(node.start)}" start = f"int {counter_symbol} = {self.sympy_printer.doprint(node.start)}"
condition = f"{counter_symbol} < {self.sympy_printer.doprint(node.stop)}" condition = f"{self.sympy_printer.doprint(node.relational(node.loop_counter_symbol, node.stop))}"
#condition = f"{counter_symbol} < {self.sympy_printer.doprint(node.stop)}"
update = f"{counter_symbol} += {self.sympy_printer.doprint(node.step)}" update = f"{counter_symbol} += {self.sympy_printer.doprint(node.step)}"
loop_str = f"for ({start}; {condition}; {update})" loop_str = f"for ({start}; {condition}; {update})"
...@@ -412,6 +413,8 @@ class CustomSympyPrinter(CCodePrinter): ...@@ -412,6 +413,8 @@ class CustomSympyPrinter(CCodePrinter):
return f"(1 << ({self._print(expr.args[0])}))" return f"(1 << ({self._print(expr.args[0])}))"
elif expr.func == int_div: elif expr.func == int_div:
return f"(({self._print(expr.args[0])}) / ({self._print(expr.args[1])}))" return f"(({self._print(expr.args[0])}) / ({self._print(expr.args[1])}))"
elif expr.func == post_increment:
return f"({self._print(expr.args[0])})"
else: else:
name = expr.name if hasattr(expr, 'name') else expr.__class__.__name__ name = expr.name if hasattr(expr, 'name') else expr.__class__.__name__
arg_str = ', '.join(self._print(a) for a in expr.args) arg_str = ', '.join(self._print(a) for a in expr.args)
......
...@@ -59,7 +59,11 @@ class int_div(IntegerFunctionTwoArgsMixIn): ...@@ -59,7 +59,11 @@ class int_div(IntegerFunctionTwoArgsMixIn):
# noinspection PyPep8Naming # noinspection PyPep8Naming
class int_power_of_2(IntegerFunctionTwoArgsMixIn): class int_power_of_2(sp.Function):
pass
# noinspection PyPep8Naming
class post_increment(sp.Function):
pass pass
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment