mortbopet / Ripes

A graphical processor simulator and assembly editor for the RISC-V ISA
https://ripes.me/
MIT License
2.49k stars 270 forks source link

Investigation: Does templating the entire assembler infra on register width really matter? #311

Closed mortbopet closed 9 months ago

mortbopet commented 11 months ago

Currently, all of the assembler and related logic is templated on types that match the register width of the target architecture (e.g. uint32_t for 32-bit, uint64_t for 64-bit) - and someplace also instruction width.

This absolutely infects all of the related code, which usually is an indication that it's not a good design pattern, e.g.: https://github.com/mortbopet/Ripes/blob/master/src/assembler/assembler.h#L61-L76

It would be interesting to see whether providing register width dynamically would only be a neglible slowdown as opposed to the current implementation. If so, I personally think it's a valid tradeoff, given that we can simplify a bunch of code and remove templates.

mortbopet commented 9 months ago

Fixed in 2a042c9