-
Notifications
You must be signed in to change notification settings - Fork 199
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
Missing coverage in the div-01.s testcase #306
Comments
this requires updates to specific nodes in the dataset.cgf so that the same scenarios can be applied across other instructions as well. |
@pawks I dont think there is yet any functionality in riscv-ctg to check direct/numeric values to |
CTG is a directed test generator which uses the coverpoints as constraints. The coverpoints are always defined over the source registers. You can always decompose a |
@pawks There needs to be support for checking whether or not a register is |
I believe the kind of coverpoints you are mentioning are already supported. Did you face any errors or issues when you tried to run the tool with these coverpoints? |
Yes. There is support for checking the values of registers (like whats stored in them), but i have not yet found any support for checking the register names (like whether or not the register is x0 or x1). I believe |
I don't think it has been resolved. |
Can you tell me which source register you are referring to? |
Both of them. There should be separate cases for rs1 = x0 (the dividend) and rs2 = x0 (the divisor), as a divide of 0 has defined behavior in the specification, and of divide by 0 is well understood to be 0: |
@ssecatchseagate in response to your (following) first comment, the conditions were updated in the dataset.cgf as were exactly told by you.
But after seeing your most recent comment, I see that you wanted to do more like following:
This covers the case when dividend is zero and also covers when divisor is zero and these conditions are checked in both the cases of rd (when Please add up if I am missing something. |
Correct, that is probably more complete. However, I didn't see those cases in the div-01.S pointed to in the PR. Maybe I'm missing it in the code, can you identify it for me. This is all I could see locate from https://github.com/riscv-non-isa/riscv-arch-test/blob/f56b5649b2c7adbbf06c5e3d8f065d300e7459bb/riscv-test-suite/rv32i_m/M/src/div-01.S rs1 == x0 & rd == x0 from before: rs2 == x0, rs1 and rd some other value. This is new, and replaces an older ==x0 check that was in the first 10 instruction sequences in the repo. |
@ssecatchseagate You were right, all the coverpoints are not getting used to generate the tests. Usually, it is expected from the riscv-ctg to generate all the tests depending upon the coverpoints in @pawks I have added the coverpoints inside
Above coverpoints are related directly to the production of tests of this issue. I have also tried adding them as following:
Both of the above are an example of using escape characters in yaml script and have the same behavior. Now, there are two problems which are associated with this type of cgf format:
Command Used:
Error Log:
Now if I disable multiprocessing by replacing the line 129 and 130 of ctg.py for better debugging the error with following lines:
the error log becomes as follows:
And on checking the type of |
@ssecatchseagate. @neelgala, @allenjbaum, @alitariq4589, @UmerShahidengr |
The div-01 testcase has 32 initial operations where the registers are scrambled for rd, rs1, and rs2.
There are an additional 557 operations that use x12 for rd, x10 for rs1, and x11 for rs2.
I believe that this setup does not fully meet coverage, which also implies that the functional coverage for this operation needs to be updated.
These two operations appear in the first 32 register scrambling choices:
div zero,zero,s10
div a7,tp,zero
while rd == rs1 == x0 is a necessary bin, there should also be
rd == x0 != rs1 to ensure that divides never write to x0
and possibly
rs1 == x0 != rd to ensure that divides will accept a dividend register x0 and calculate it properly
Note that there are already several testcases for a dividend value of 0, just not one for a dividend register of x0 that doesn't "write" to x0:
inst_10:
// rs1==x7, rs2==x13, rd==x20, rs1_val == 0, rs2_val == -9
// opcode: div ; op1:x7; op2:x13; dest:x20; op1val:0x0; op2val:-0x9
TEST_RR_OP(div, x20, x7, x13, 0x0, 0x0, -0x9, x2, 40, x8)
And as far as I can tell, that first one is the only testcase that validates that rs1 == rd, which given that they are both x0, does not really cover this case.
inst_0:
// rs1 == rd != rs2, rs1==x0, rs2==x26, rd==x0, rs1_val > 0 and rs2_val > 0, rs1_val != rs2_val, rs2_val == 262144
// opcode: div ; op1:x0; op2:x26; dest:x0; op1val:0x0; op2val:0x40000
TEST_RR_OP(div, x0, x0, x26, 0, 0x0, 0x40000, x2, 0, x8)
I believe the coverage needs to be update to be something more like:
rs1 == rd != rs2; rd != x0
rs1 == rd != rs2; rd == x0
rs1 == x0 != rd
rd == x0 != rs1
The text was updated successfully, but these errors were encountered: