Support for pseudo-instructions.
pawks opened this issue · comments
Problem
All coverpoints are currently defined over the opcode
field in the cgf. Since isac deals with the mnemonics of the instruction rather than the actual encoding, dealing with pseudo-instructions needs additional thought. The same instruction instance of the base op should satisfy/trigger the coverpoints of both the base op and the pseudo instruction for accurate coverage reporting.
Potential Solution
To support this, the nodes in the cgf will have to undergo a overhaul. The opcode
field can be renamed to mnemonics
and 2 new fields base_op
and p_op_cond
are added to the covergroups. The base_op
and p_op_cond
are optional fields which specify the base operation and the condition over the different fields of the instruction, which when satisfied results in the instruction being recognised as the pseudo op. For example, zext.h
is a pseudo op of pack
in RV64 and packw
in RV32 with the rs2
field hardwired to x0
. The nodes for zext.h
will be expressed as follows:
zext.h_32:
config:
- check ISA:=regex(.*RV32.*B.*)
- check ISA:=regex(.*RV32.*Zbb.*)
mnemonics:
zext.h: 0
base_op: packw
p_op_cond: rs2 == x0
...
zext.h_64:
config:
- check ISA:=regex(.*RV64.*B.*)
- check ISA:=regex(.*RV64.*Zbb.*)
mnemonics:
zext.h: 0
base_op: pack
p_op_cond: rs2 == x0
...
Schema
- The
p_op_cond
node is relevant only if thebase_op
node has been defined. Otherwise both the nodes remain empty. - The
mnemonics
node is allowed to have multiple entries only if thebase_op
node is empty. This introduces a restriction that a pseudo-op cannot be combined with other instructions into a single covergroup.
Changes required
- This change will need an overhaul of all the cgfs defined so far( a simple replace of
opcode
withmnemonics
). - Changes in ISAC and CTG to support this.
Caveats
- Pseudo-ops cannot be combined with other instructions in a covergroup
- Decoder always detects an encoding as the relevant base-op(i.e
pack
even if the encoding satisfies conditions forzext.h
). - Coverpoints are defined over the fields of the
base_op
always.
In the interest of backward compatibility, the opcode
node should also be supported in the cgfs(with a deprecation warning). Possibly as a part of the normalise
function, so that the older cgfs can still be used with isac.