Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

riscv_isac/fp_dataset.py should not have instruction specific knowledge #68

Open
cmuellner opened this issue Apr 6, 2023 · 0 comments

Comments

@cmuellner
Copy link

The documentation of the FP coverpoint generator functions (riscv_isac.fp_dataset.ibm_b1 and friends) are documented without specific knowledge of the instructions they generate for (see https://riscv-isac.readthedocs.io/en/stable/code.html#module-riscv_isac.fp_dataset).

However, the implementation is full of hard-coded assumptions that enforce different behavior for instructions without good reasons (e.g. if opcode.split('.')[0] in ["fadd","fsub","fmul","fdiv","fsqrt","fmadd","fnmadd","fmsub","fnmsub","fcvt","fmv"]:).

The result is, that the generators are useless for new instructions (Q, Zfh, Zfinx, Zfa, etc.). And adding these new instructions into fp_dataset.py is pointless, because there is no need to do so.

fp_dataset.py should be re-implemented with the following ideas in mind:

  • generators should not know anything about FP instructions
  • specific behavior should be controlled via function parameters, which are properly documented
  • constant should be defined on package level, not repeatedly in functions
  • seed functionality needs to be streamlined (that would also make it consistent)
  • code can be easily written to be compatible with Zfh, F, S, or Q by using simple abstractions (e.g. maxnorm = get_maxnorm(flen))
  • if code is copy-and-pasted from function to function, then it should be moved into its own function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant