frm coverpoints: sweep all 5 fcsr.frm values for dyn rounding mode#1467
frm coverpoints: sweep all 5 fcsr.frm values for dyn rounding mode#1467Aditya Amol Kuchekar (dev-aditya-hub) wants to merge 1 commit into
Conversation
|
Unless I am missing something, I think we want to test all 5 possible values for the dynamic rounding mode field. While 0 is the default, it is still a valid value that we want to make sure we test. With the randomization, we will be testing all 5 values, and I don't see a reason to constrain it to just an FRM value of 4. |
08df1c6 to
8860071
Compare
|
Fair point pinning to 4 was throwing away coverage of the other four values just to defeat the rne-collision. I've reworked the patch (force-pushed 8860071) so that the dyn case is expanded into 5 explicit |
…riscv#1469) ## Summary `make_fs1_edges`, `make_fs2_edges`, and `make_fs3_edges` in `cp_fp_reg_edges.py` were near-duplicates. The `cross_frm` branch was only ever added to fs1, so `cp_fs2_edges_frm` and `cp_fs3_edges_frm` would silently fall through to a single frm mode if any testplan ever opted into them. Pulled the shared body into `_make_fs_edges(operand, ...)` and reduced each public generator to a one-line dispatch. The helper handles edge-set selection, the `_frm` cross, and the bin-name / description formatting. ## Why - Three copies of the same logic were drifting. fs1 already gained `cross_frm` support; fs2 and fs3 didn't. - One source of truth means the next change (new operand, new frm behavior, new edge category) lands in one place by construction. ## Behavior - `cp_fs1_edges*` — output unchanged. - `cp_fs2_edges` / `cp_fs3_edges` (no `_frm`) — output unchanged; `frm_mode=None` reproduces the same `bin_name` and `desc` as before. - `cp_fs2_edges_frm` / `cp_fs3_edges_frm` — now functional; sweep all six rounding modes, mirroring fs1. ## Notes - This revision drops the `csr_frm_val=4` dyn-mode pin per @jordancarlin's review comment. That change is being handled separately on riscv#1467, where the discussion of how to address the random-rne collision belongs. - Net diff: -42 / +19 in the only file touched. - No public API change; `add_coverpoint_generator` registrations are unchanged. --------- Co-authored-by: Aditya Amol Kuchekar <adityakuchekar0077@gmail.com> Co-authored-by: David Harris <74973295+davidharrishmc@users.noreply.github.com>
…riscv#1469) ## Summary `make_fs1_edges`, `make_fs2_edges`, and `make_fs3_edges` in `cp_fp_reg_edges.py` were near-duplicates. The `cross_frm` branch was only ever added to fs1, so `cp_fs2_edges_frm` and `cp_fs3_edges_frm` would silently fall through to a single frm mode if any testplan ever opted into them. Pulled the shared body into `_make_fs_edges(operand, ...)` and reduced each public generator to a one-line dispatch. The helper handles edge-set selection, the `_frm` cross, and the bin-name / description formatting. ## Why - Three copies of the same logic were drifting. fs1 already gained `cross_frm` support; fs2 and fs3 didn't. - One source of truth means the next change (new operand, new frm behavior, new edge category) lands in one place by construction. ## Behavior - `cp_fs1_edges*` — output unchanged. - `cp_fs2_edges` / `cp_fs3_edges` (no `_frm`) — output unchanged; `frm_mode=None` reproduces the same `bin_name` and `desc` as before. - `cp_fs2_edges_frm` / `cp_fs3_edges_frm` — now functional; sweep all six rounding modes, mirroring fs1. ## Notes - This revision drops the `csr_frm_val=4` dyn-mode pin per @jordancarlin's review comment. That change is being handled separately on riscv#1467, where the discussion of how to address the random-rne collision belongs. - Net diff: -42 / +19 in the only file touched. - No public API change; `add_coverpoint_generator` registrations are unchanged. --------- Co-authored-by: Aditya Amol Kuchekar <adityakuchekar0077@gmail.com> Co-authored-by: David Harris <74973295+davidharrishmc@users.noreply.github.com>
|
The sweep through all of the legal |
Summary
For the
dynrounding-mode case, the four frm-bearing coverpoint generators previously calledgenerate_random_params(..., frm=\"dyn\")without specifyingcsr_frm_val.formatters/params.pythen filled it in withrandom_range(0, 4). That meant any individual instruction got exactly one randomly-chosenfcsr.frmvalue, and 1-in-5 of those landed onrne— which is also the power-on default — so a DUT that ignoresfcsr.frmentirely would silently pass.This PR replaces the single random pick with an explicit sweep of all five legal
fcsr.frmvalues (0..4) for thedynmode. Static modes are unchanged —csr_frm_valis left asNonefor them, which is identical to the old behavior since the formatter only consults it whenfrm == \"dyn\".Change shape
The
frm_modestuple is replaced with afrm_variantslist of(frm_mode, csr_frm_val)pairs:fcsr.frmvaluerdn,rmm,rne,rtz,rup, each withcsr_frm_val=NoneBin names and descriptions include the
fcsr.frmvalue when present, so the dyn entries stay distinct in the signature region.Touched call sites:
cp_frm.py—make_frmcp_fp_reg_edges.py—make_fs1_edgescr_fp_reg_edges.py—make_cr_fs1_fs2_edgesandmake_cr_fs1_fs3_edgesWhat this replaces
The earlier revision of this PR pinned
csr_frm_val=4to defeat the rne-default collision. Jordan Carlin (@jordancarlin) pointed out that this gave up coverage of the other four legal values for the sake of catching one bug class. This revision keeps that bug class caught and restores deterministic coverage of all five values.Cost
For each affected coverpoint, the dyn case grows from 1 testcase to 5. Static modes are unchanged. Net effect per coverpoint invocation: +4 testcases. The cross-product generators (
cr_fs1_fs2_edges_frm,cr_fs1_fs3_edges_frm) feel this most, since the+4multiplies through the edge × edge cross. If that growth is a concern, happy to gate the dyn-expansion behind a flag or trim the static-mode set.Risk
dynmodes,csr_frm_val=Noneis passed; identical to the prior behavior.dyn, the formatter now emits a deterministicfsrmi <csr_val>per testcase rather than a random one.params.pyor other shared infrastructure.