Mercurial > repos > blastem
comparison cpu_dsl.py @ 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 | 5dbc453cd345 |
comparison
equal
deleted
inserted
replaced
1615:28f80d1b343e | 1616:8c78543c4783 |
---|---|
564 | 564 |
565 | 565 |
566 def _geuCImpl(prog, parent, fieldVals, output): | 566 def _geuCImpl(prog, parent, fieldVals, output): |
567 if prog.lastOp.op == 'cmp': | 567 if prog.lastOp.op == 'cmp': |
568 output.pop() | 568 output.pop() |
569 params = prog.lastOp.params | 569 params = [prog.resolveParam(p, parent, fieldVals) for p in prog.lastOp.params] |
570 for i in range(0, len(params)): | 570 return '\n\tif ({a} >= {b}) '.format(a=params[1], b = params[0]) + '{' |
571 params[i] = prog.resolveParam(params[i], parent, fieldVals) | |
572 return '\n\tif ({a} >= {b}) '.format(a=params[0], b = params[1]) + '{' | |
573 else: | 571 else: |
574 raise ion(">=U not implemented in the general case yet") | 572 raise ion(">=U not implemented in the general case yet") |
575 | 573 |
576 _ifCmpImpl = { | 574 _ifCmpImpl = { |
577 'c': { | 575 'c': { |