`riscv_isac/fp_dataset.py` should not have instruction specific knowledge
cmuellner opened this issue · comments
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