mortbopet / Ripes

A graphical processor simulator and assembly editor for the RISC-V ISA

Home Page:https://ripes.me/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

mortbopet opened this issue · comments

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.