sail-riscv
sail-riscv copied to clipboard
Refactor `haveExt()` & `sys_enable_ext()` functions
I think the haveExtension() functions are a bit confusingly named. It's unclear whether they mean that the CPU supports the extension, or if it is currently enabled (which are not necessarily the same if you have writeable misa). I believe the answer is the latter, and there are a few sys_enable_extension() functions which actually dictate whether the extension is supported. That function only exists for some extensions though.
This is confusing. I think we should do the following:
- Rename all
haveExtension()functions toextensionEnabled(). - Rename all
sys_enable_extension()functions tosys_support_extension()orsys_extension_supported(). - Add
sys_extension_supported()functions corresponding to all thehaveExtension()functions, so they are 1:1. Initially we can just hard-code the result rather than adding CLI arguments. - Update
legalize_misa()to use thesys_extension_supported()functions (even if they are hard-coded totrue).