News for hackers. Stuff that matters.
Re:I don't know how CPUs work so I simulated one in code by leoh on Monday August 05, 2024 @05:58PM (#41166007)
If, for fun, I wanted to train an ML model on a ton of CPU instructions (which each predicted state/label being the state of the registers), does anyone have any clue how to gather that kind of data?
Re:I don't know how CPUs work so I simulated one in code by 01HNNWZ0MV43FF on Monday August 05, 2024 @06:06PM (#41166057)
Maybe a game console emulator?
Re:I don't know how CPUs work so I simulated one in code by jakeinspace on Monday August 05, 2024 @08:38PM (#41166873)
QEMU isn’t cycle-accurate, but would be a good start (and probably good enough). Just run some benchmarks and whatnot there, and use a tracing tool like Cannoli to capture instructions.

If you need real instructions (without an emulator like qemu doing its own translation and messing up timing), you could use a simulator like Gem5. That’s a bit more work and a lot more compute per simulated instruction.