Skip to content

Commit

Permalink
remove unnecessary logic
Browse files Browse the repository at this point in the history
  • Loading branch information
cdonovick committed Sep 25, 2019
1 parent cd15fb3 commit 3c128a7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions magma/syntax/combinational.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ def rewrite(self, tree: ast.AST, env: ast_tools.SymbolTable,
tree, env, metadata = ast_tools.passes.ssa().rewrite(
tree, env, metadata)

phi_name = ast_tools.gen_free_name(tree, env,
"magma_combinational_phi")

if "mux" not in env:
from mantle import mux
Expand All @@ -151,13 +149,13 @@ def rewrite(self, tree: ast.AST, env: ast_tools.SymbolTable,
else:
mux_name = "mux"

phi_name = "magma_combinational_phi"
def phi(cond, arg0, arg1):
if all(isinstance(arg, tuple) for arg in (arg0, arg1)):
return tuple(phi(cond, *zipped) for zipped in zip(arg0,
arg1))
return env[mux_name]([arg1, arg0], cond)

env.locals[phi_name] = phi
tree, env, metadata = ast_tools.passes.if_to_phi(phi_name).rewrite(
tree, env, metadata = ast_tools.passes.if_to_phi(phi, phi_name).rewrite(
tree, env, metadata)
return _combinational(tree, env, metadata)

0 comments on commit 3c128a7

Please sign in to comment.