gameboy superoptimizer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
1.1 KiB

  1. # gbso
  2. An implementation of the stochastic superoptimization algorithm [STOKE](./docs/asplos13.pdf) for the Sharp LR35902 (also known as GB-Z80).
  3. ## Setup
  4. Make sure you have [Poetry](https://python-poetry.org/) and Python 3.9+ installed. Then run:
  5. ```
  6. $ poetry install
  7. ```
  8. ## Usage
  9. Input programs are specified as a list of CPU instructions. For a list of instructions available to the processor, take a look at [insn.py](./gbso/cpu/insn.py) or a [standard reference](https://gbdev.io/pandocs/CPU_Instruction_Set.html).
  10. Once you have the program specified, call `gbso.optimize.optimize` on the program. A superoptimized, behaviorally equivalent program will be returned. Additional parameters are available to the optimization function to control search.
  11. For a comprehensive example, see [ex.py](./ex.py).
  12. ## TODO
  13. - [ ] Cost penalties for undefined memory/register reads
  14. - [ ] "Improved" equality metric that accounts for correct results in the wrong location
  15. - [ ] Automatic test case generation from counterexamples
  16. - [ ] `DAA` instruction
  17. - [ ] 16-bit memory/register outputs