changeset 1616:8c78543c4783

Fix implementation cmp+condition version of if in CPU DSL
author Michael Pavone <pavone@retrodev.com>
date Tue, 25 Sep 2018 09:33:46 -0700
parents 28f80d1b343e
children 5e04f9f8bd85
files cpu_dsl.py
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/cpu_dsl.py	Mon Sep 24 19:09:16 2018 -0700
+++ b/cpu_dsl.py	Tue Sep 25 09:33:46 2018 -0700
@@ -566,10 +566,8 @@
 def _geuCImpl(prog, parent, fieldVals, output):
 	if prog.lastOp.op == 'cmp':
 		output.pop()
-		params = prog.lastOp.params
-		for i in range(0, len(params)):
-			params[i] = prog.resolveParam(params[i], parent, fieldVals)
-		return '\n\tif ({a} >= {b}) '.format(a=params[0], b = params[1]) + '{'
+		params = [prog.resolveParam(p, parent, fieldVals) for p in prog.lastOp.params]
+		return '\n\tif ({a} >= {b}) '.format(a=params[1], b = params[0]) + '{'
 	else:
 		raise ion(">=U not implemented in the general case yet")