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

Test generation using cross coverage coverpoints.

Open pawks opened this issue 3 years ago • 0 comments

Summary

Coverpoints spanning across multiple instructions help identify interesting instruction sequences which have architectural significance such as structural hazards and data hazards. CTG lacks the infrastructure necessary to generate such tests. This involves defining the relevant coverpoints using the custom format( cross_comb node defined here) for specifying such coverpoints and employing a constraint solver to produce tests with the relevant instruction sequences.

Changes required

  • Add support to test generator.
  • Add relevant assembly macros necessary to handle most common cases.

Basic example

WAW hazard between an add and a sub instructions which are 3 instructions apart. The instructions in-between are consuming i.e use the result of the add operation as one of the operands.

Coverpoint Definition

add_sub_cwaw:
  cross_comb:
    - "[add : ? : ? : ? : sub] :: [a=rd : ? : ? : ? : ?] :: [? : rs1==a or rs2==a : rs1==a or rs2==a : rs1==a or rs2==a : rd==a]"

Possible assembly sequence

li x3, 152;
li x4, 169;
add x3,x3,x4;
addi x5,x3,1;
mulh x6,x4,x3;
slli x4,x3,25;
sub x3,x5,x6;

pawks avatar Jan 19 '22 08:01 pawks