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

Test generation for CSR testing.

Open pawks opened this issue 3 years ago • 2 comments

Summary

The csr coverpoints (csr_comb node defined here) in the CGF correspond to the values present in the CSR. These kinds of tests would try to set the CSR to a particular value either by writing to them or by executing code which causes the CSR to change due to a side effect, interrupts and exceptions. The tests will have to propagate the CSR values to the signature. CTG does not support generating tests for these coverpoints in its current state. Each csr(or csr type) will have to be handled independently.

Changes required

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

Basic example

A coverpoint corresponding to the C bit in misa register:

c_misa:
  opcode:
    c.add: 0
  csr_comb:
    'misa & 0x4 == 0': 0

Assembly Test

la x4, signature_addr
addi x1,x1,0
csrr x2,misa
li x3,~0x4
and x2,x2,x3
csrw misa,x2
c.add x1,x3
c.nop
nop
sw x1, 0(x4)

pawks avatar Jan 19 '22 11:01 pawks

Hi @pawks I want to work on this issue. can you please assign this to me ?

bilalsakhawat avatar Jan 20 '22 15:01 bilalsakhawat

Thanks!

bilalsakhawat avatar Jan 20 '22 18:01 bilalsakhawat