sail-riscv icon indicating copy to clipboard operation
sail-riscv copied to clipboard

Refactor `haveExt()` & `sys_enable_ext()` functions

Open Timmmm opened this issue 1 year ago • 11 comments

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:

  1. Rename all haveExtension() functions to extensionEnabled().
  2. Rename all sys_enable_extension() functions to sys_support_extension() or sys_extension_supported().
  3. Add sys_extension_supported() functions corresponding to all the haveExtension() functions, so they are 1:1. Initially we can just hard-code the result rather than adding CLI arguments.
  4. Update legalize_misa() to use the sys_extension_supported() functions (even if they are hard-coded to true).

Timmmm avatar Jun 14 '24 08:06 Timmmm