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

Split register info class into multiple classes; one per register file #320

Closed raccog closed 8 months ago

raccog commented 9 months ago

Create RegInfoInterface as an abstract class to interface into a single register file. Return a vector of all the RegInfoInterfaces implemented by an ISA.

Also refactored any code that indexes a register so that the register's file type is used in the index.

This includes the command line option --reginit. It now requires the register file type to be specified for each initialized register set. It can be used multiple times to initialize multiple register files. Example:

./Ripes --reginit gpr:1=1,20=0xdeadbeef --reginit csr:1=0xf
mortbopet commented 9 months ago

I understand the intention of the change, but I'm not sure think that (as far as i understand) essentially merging multiple register infos in e.g. RegInfoSet is a proper representation. Each register file is distinct, and i think all places which care about providing a representation of the register files should represent each one as distinct, and not lump them together.

I'd be more in favor of ISAInfoBase returning a list of RegInfoInterface, which each UI element then can use to provide distinct views of each register file: std::vector<RegInfoInterface*> ISAInfoBase::getRegisterInfos()

raccog commented 9 months ago

I'd be more in favor of ISAInfoBase returning a list of RegInfoInterface, which each UI element then can use to provide distinct views of each register file: std::vector<RegInfoInterface*> ISAInfoBase::getRegisterInfos()

@mortbopet This sounds good to me since returning a std::vector<RegInfoInterface*> would serve the same purpose as RegInfoSet by providing a way to iterate over each available register from each register file that an ISA implements.