Mercurial > repos > blastem
comparison cpu_dsl.py @ 2587:e04c7e753bf6
Implement divs and divu in new CPU core
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 08 Feb 2025 20:04:18 -0800 |
parents | 9e10149c9e10 |
children | 6bca3c28e2ad |
comparison
equal
deleted
inserted
replaced
2586:6c58cadeabe1 | 2587:e04c7e753bf6 |
---|---|
1191 'cmp': Op().addImplementation('c', None, _cmpCImpl), | 1191 'cmp': Op().addImplementation('c', None, _cmpCImpl), |
1192 'sext': Op(_sext).addImplementation('c', 2, _sextCImpl), | 1192 'sext': Op(_sext).addImplementation('c', 2, _sextCImpl), |
1193 'ocall': Op().addImplementation('c', None, lambda prog, params: '\n\t{pre}{fun}({args});'.format( | 1193 'ocall': Op().addImplementation('c', None, lambda prog, params: '\n\t{pre}{fun}({args});'.format( |
1194 pre = prog.prefix, fun = params[0], args = ', '.join(['context'] + [str(p) for p in params[1:]]) | 1194 pre = prog.prefix, fun = params[0], args = ', '.join(['context'] + [str(p) for p in params[1:]]) |
1195 )), | 1195 )), |
1196 'ccall': Op().addImplementation('c', None, lambda prog, params: '\n\t{fun}({args});'.format( | |
1197 pre = prog.prefix, fun = params[0], args = ', '.join([str(p) for p in params[1:]]) | |
1198 )), | |
1196 'pcall': Op().addImplementation('c', None, lambda prog, params: '\n\t(({typ}){fun})({args});'.format( | 1199 'pcall': Op().addImplementation('c', None, lambda prog, params: '\n\t(({typ}){fun})({args});'.format( |
1197 typ = params[1], fun = params[0], args = ', '.join([str(p) for p in params[2:]]) | 1200 typ = params[1], fun = params[0], args = ', '.join([str(p) for p in params[2:]]) |
1198 )), | 1201 )), |
1199 'cycles': Op().addImplementation('c', None, | 1202 'cycles': Op().addImplementation('c', None, |
1200 lambda prog, params: '\n\tcontext->cycles += context->opts->gen.clock_divider * {0};'.format( | 1203 lambda prog, params: '\n\tcontext->cycles += context->opts->gen.clock_divider * {0};'.format( |
1237 param = prog.resolveParam(param, parent, fieldVals, allowConst, isDst) | 1240 param = prog.resolveParam(param, parent, fieldVals, allowConst, isDst) |
1238 | 1241 |
1239 if (not type(param) is int) and len(procParams) != len(self.params) - 1: | 1242 if (not type(param) is int) and len(procParams) != len(self.params) - 1: |
1240 allParamsConst = False | 1243 allParamsConst = False |
1241 procParams.append(param) | 1244 procParams.append(param) |
1245 if prog.needFlagCoalesce: | |
1246 output.append(prog.flags.coalesceFlags(prog, otype)) | |
1247 prog.needFlagCoalesce = False | |
1242 | 1248 |
1243 if self.op == 'meta': | 1249 if self.op == 'meta': |
1244 param,_,index = self.params[1].partition('.') | 1250 param,_,index = self.params[1].partition('.') |
1245 if index: | 1251 if index: |
1246 index = (parent.resolveLocal(index) or index) | 1252 index = (parent.resolveLocal(index) or index) |