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

[dd, aon_timer cov_closure] CCOV exclusion file for aon_timer #25705

Merged

Conversation

antmarzam
Copy link
Contributor

All the exclusions in this file are unreachable

@antmarzam antmarzam requested a review from a team as a code owner December 19, 2024 11:30
@antmarzam antmarzam requested review from hcallahan-lowrisc, rswarbrick and a team and removed request for a team December 19, 2024 11:30
@antmarzam antmarzam force-pushed the aon_timer_manual_ccov_exclusions branch from 91fbc3f to 268e0fd Compare December 19, 2024 14:27
@antmarzam antmarzam force-pushed the aon_timer_manual_ccov_exclusions branch from 268e0fd to 22abc8c Compare December 19, 2024 14:37
Condition 2 "1682497780" "(dst_req_i && ((!gen_wr_req.dst_req_q)) && gen_wr_req.busy) 1 -1" (2 "101")
CHECKSUM: "2815520955 4109606122"
INSTANCE: tb.dut.u_reg.u_wkup_count_lo_cdc.u_arb
ANNOTATION: "It can't be hit because dst_update_ack won't be set prior to dst_update_req"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is the same comment as the one for line 117?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've created a PR for this: #25814

Copy link
Contributor

@rswarbrick rswarbrick left a comment

Choose a reason for hiding this comment

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

I know that I haven't got to the bottom of the list, but I think there are a few items to work through so far :-)

@antmarzam antmarzam force-pushed the aon_timer_manual_ccov_exclusions branch 2 times, most recently from 71c55ec to d2a959e Compare January 8, 2025 16:02
@rswarbrick
Copy link
Contributor

I think this is easy, but should these two commits be squashed?

antmarzam added a commit to antmarzam/opentitan that referenced this pull request Jan 27, 2025
`      end else if (dst_req_i && busy) begin` is equivalent to
`      end else if (dst_req_i && busy) begin`.

In order to guarantee the above happens an assertion has been added checking:
`dst_req_i |-> !dst_req_q`

The reasoning for the simplification is:

In prim_reg_cdc, we expect to see a request that comes from the SW
as a signal on the src domain (either src_we_i or src_re_i).
This gets synchronised to the destination clock by
u_src_to_dst_req.
This then appears to the arbiter as dst_req_i.
If there is another request in flight (probably an update from HW),
the SW request get stored in the dst_req_q register.
The stored request gets cleared on the first posedge of the dst
clock after the previous request is complete, because it causes
dst_lat_d to be high.
To see dst_req_i && dst_req_q, we would need prim_reg_cdc to
send another request before that happened.
When the first SW request appears in prim_reg_cdc, we set busy
until we see src_ack.
This goes high when the SW request has been synchronised to the
dst clock by u_dst_update_sync.
As such, we can't see another request from prim_reg_cdc before
src_req_q has been cleared. Clearing src_req_q takes exactly one
clock crossing time and allowing prim_reg_cdc to send the second
request takes the same time.

This is part of the efforts to close code coverage for AON timer and taken as
feedback from Rupert in PR:
lowRISC#25705 (comment)

Signed-off-by: Antonio Martinez Zambrana <[email protected]>
antmarzam added a commit to antmarzam/opentitan that referenced this pull request Jan 27, 2025
`      end else if (dst_req_i && busy) begin` is equivalent to
`      end else if (dst_req_i && busy) begin`.

In order to guarantee the above happens an assertion has been added checking:
`dst_req_i |-> !dst_req_q`

The reasoning for the simplification is:

In prim_reg_cdc, we expect to see a request that comes from the SW
as a signal on the src domain (either src_we_i or src_re_i).
This gets synchronised to the destination clock by
u_src_to_dst_req.
This then appears to the arbiter as dst_req_i.
If there is another request in flight (probably an update from HW),
the SW request get stored in the dst_req_q register.
The stored request gets cleared on the first posedge of the dst
clock after the previous request is complete, because it causes
dst_lat_d to be high.
To see dst_req_i && dst_req_q, we would need prim_reg_cdc to
send another request before that happened.
When the first SW request appears in prim_reg_cdc, we set busy
until we see src_ack.
This goes high when the SW request has been synchronised to the
dst clock by u_dst_update_sync.
As such, we can't see another request from prim_reg_cdc before
src_req_q has been cleared. Clearing src_req_q takes exactly one
clock crossing time and allowing prim_reg_cdc to send the second
request takes the same time.

This is part of the efforts to close code coverage for AON timer and taken as
feedback from Rupert in PR:
lowRISC#25705 (comment)

Signed-off-by: Antonio Martinez Zambrana <[email protected]>
antmarzam added a commit to antmarzam/opentitan that referenced this pull request Jan 28, 2025
`end else if (dst_req_i && !dst_req_q && busy) begin` is equivalent to
`end else if (dst_req_i && busy) begin`.

In order to guarantee the above happens an assertion has been added checking:
`dst_req_i |-> !dst_req_q`

The reasoning for the simplification is:

In prim_reg_cdc, we expect to see a request that comes from the SW
as a signal on the src domain (either src_we_i or src_re_i).
This gets synchronised to the destination clock by
u_src_to_dst_req.
This then appears to the arbiter as dst_req_i.
If there is another request in flight (probably an update from HW),
the SW request get stored in the dst_req_q register.
The stored request gets cleared on the first posedge of the dst
clock after the previous request is complete, because it causes
dst_lat_d to be high.
To see dst_req_i && dst_req_q, we would need prim_reg_cdc to
send another request before that happened.
When the first SW request appears in prim_reg_cdc, we set busy
until we see src_ack.
This goes high when the SW request has been synchronised to the
dst clock by u_dst_update_sync.
As such, we can't see another request from prim_reg_cdc before
src_req_q has been cleared. Clearing src_req_q takes exactly one
clock crossing time and allowing prim_reg_cdc to send the second
request takes the same time.

This is part of the efforts to close code coverage for AON timer and taken as
feedback from Rupert in PR:
lowRISC#25705 (comment)

Signed-off-by: Antonio Martinez Zambrana <[email protected]>
rswarbrick pushed a commit that referenced this pull request Jan 29, 2025
`end else if (dst_req_i && !dst_req_q && busy) begin` is equivalent to
`end else if (dst_req_i && busy) begin`.

In order to guarantee the above happens an assertion has been added checking:
`dst_req_i |-> !dst_req_q`

The reasoning for the simplification is:

In prim_reg_cdc, we expect to see a request that comes from the SW
as a signal on the src domain (either src_we_i or src_re_i).
This gets synchronised to the destination clock by
u_src_to_dst_req.
This then appears to the arbiter as dst_req_i.
If there is another request in flight (probably an update from HW),
the SW request get stored in the dst_req_q register.
The stored request gets cleared on the first posedge of the dst
clock after the previous request is complete, because it causes
dst_lat_d to be high.
To see dst_req_i && dst_req_q, we would need prim_reg_cdc to
send another request before that happened.
When the first SW request appears in prim_reg_cdc, we set busy
until we see src_ack.
This goes high when the SW request has been synchronised to the
dst clock by u_dst_update_sync.
As such, we can't see another request from prim_reg_cdc before
src_req_q has been cleared. Clearing src_req_q takes exactly one
clock crossing time and allowing prim_reg_cdc to send the second
request takes the same time.

This is part of the efforts to close code coverage for AON timer and taken as
feedback from Rupert in PR:
#25705 (comment)

Signed-off-by: Antonio Martinez Zambrana <[email protected]>
@antmarzam antmarzam force-pushed the aon_timer_manual_ccov_exclusions branch from d2a959e to a468271 Compare January 29, 2025 17:44
@antmarzam
Copy link
Contributor Author

@rswarbrick I've removed the exclusions that have been addressed via RTL modifications and have squashed both commits together!

Also @vogelpi : Do you mind taking a look at comment it would be helpful to get your two cents on it :)

All the exclusions in this file are unreachable
In addition, rtl exclusions added to config file

Signed-off-by: Antonio Martinez Zambrana <[email protected]>
@antmarzam
Copy link
Contributor Author

@rswarbrick : I've just pushed the changes to removed the exclusion that's no longer needed after your PR #26072 makes it to master

@rswarbrick
Copy link
Contributor

I've just worked through the discussion on this PR and I'm pretty convinced! :-)

@antmarzam: Do you think this exclusion list is correct for the current head of master? If so, I think this should be good to merge.

@antmarzam
Copy link
Contributor Author

Yeah I think it's ready to be merged :)

@rswarbrick
Copy link
Contributor

This is great, thanks!

@rswarbrick rswarbrick merged commit abeb276 into lowRISC:master Jan 31, 2025
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants