Skip to content
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

[prim,rtl] Rephrase a term in prim_reg_cdc.sv #25481

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

rswarbrick
Copy link
Contributor

This is trying to remove a coverage item that was a hole for some blocks that I was (wrongly) trying to waive with #25088. I hope this solution will be cleaner.

If DstWrReq is false then the src_update signal cannot be true. This is because it is driven by the src_update_o port on a prim_reg_cdc_arb instance. If DstWrReq is false then the instance wires src_update_o to zero (in the gen_passthru generate block).

This rewrite will behave equivalently in the same way as before but will no longer generate any conditional coverage terms that depend on src_update if DstWrReq is false.

Copy link
Contributor

@matutem matutem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rswarbrick rswarbrick requested a review from vogelpi December 5, 2024 11:30
@rswarbrick
Copy link
Contributor Author

Hi @vogelpi, Would you mind taking a look at this and checking the change is reasonable? If so, I'd really appreciate an explicit "change authorised" comment (and you are in a rather closer timezone than Matute!)

// be copied back.
logic dst_to_src;
if (DstWrReq) begin : gen_wr_req
assign dst_to_src = src_busy_q && src_ack | src_update && !busy;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functionality looks good to me (thanks for the clarifying comment above!) as src_update can only ever be non-zero if DstWrReq is 1.

But:

  • We should convert the bitwise OR | here to a boolean OR || for consistency.
  • src_update and busy are unused in case DstWrReq is 0. The latter is used in an assertion so lint may not realize this, the former should generate a lint error/warning that we should fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Oops about the |: thanks!
  • Good point about the unused signals. I've added an unused_... signal in the obvious way and can see a lint error go away. Thanks!

@vogelpi
Copy link
Contributor

vogelpi commented Dec 5, 2024

CHANGE AUTHORIZED: hw/ip/prim/rtl/prim_reg_cdc.sv

This doesn't implement a functional change but helps to improve coverage.

If DstWrReq is false then the src_update signal cannot be true. This
is because it is driven by the src_update_o port on a prim_reg_cdc_arb
instance. If DstWrReq is false then the instance wires src_update_o to
zero (in the gen_passthru generate block).

This rewrite will behave equivalently in the same way as before but
will no longer generate any conditional coverage terms that depend on
src_update if DstWrReq is false.

Note that if DstWrReq is zero then the src_update and busy signals are
constant zero and are no longer actually used. To avoid a lint error
from the unused signals in this situation, they get "sampled" in the
gen_passthru block.

Signed-off-by: Rupert Swarbrick <[email protected]>
@rswarbrick rswarbrick force-pushed the prim-reg-cdc-coverage branch from 57bccd7 to 7119020 Compare December 5, 2024 18:10
@rswarbrick
Copy link
Contributor Author

CHANGE AUTHORIZED: hw/ip/prim/rtl/prim_reg_cdc.sv

@rswarbrick rswarbrick merged commit 7dea163 into lowRISC:master Dec 5, 2024
37 checks passed
@rswarbrick rswarbrick deleted the prim-reg-cdc-coverage branch December 5, 2024 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants