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

[kmac,dv] Check FIFO empty interrupt #23942

Merged
merged 2 commits into from
Jul 27, 2024

Conversation

martin-velay
Copy link
Contributor

@martin-velay martin-velay commented Jul 5, 2024

Linked to this issue #22341

I am not sure it works well yet. I have only checked it for one test, and it seems good from what I've seen.
This check is not modeling the FIFO level, instead it is using the FIFO empty/full from the DUT through a backdoor access. Then it does a prediction on the FIFO empty interrupt as described in the KMAC register doc.

@martin-velay martin-velay requested a review from a team as a code owner July 5, 2024 16:10
@martin-velay martin-velay requested review from rswarbrick and vogelpi and removed request for a team July 5, 2024 16:10
@martin-velay martin-velay marked this pull request as draft July 5, 2024 16:11
@martin-velay martin-velay self-assigned this Jul 5, 2024
@martin-velay martin-velay added Component:DV DV issue: testbench, test case, etc. IP:kmac labels Jul 5, 2024
@martin-velay martin-velay force-pushed the kmac_fifo_empty branch 2 times, most recently from d777849 to f1560b6 Compare July 9, 2024 10:24
@martin-velay martin-velay force-pushed the kmac_fifo_empty branch 4 times, most recently from 2b700a8 to af37ff6 Compare July 22, 2024 09:42
@martin-velay martin-velay marked this pull request as ready for review July 22, 2024 09:49
@martin-velay
Copy link
Contributor Author

Hi @rswarbrick, @andreaskurth and @vogelpi,
This PR is ready to be reviewed.

Thanks in advance!

Copy link
Contributor

@vogelpi vogelpi left a comment

Choose a reason for hiding this comment

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

Thanks @martin-velay for your work on this! The PR looks good to me. I think I can follow and understand the code and it looks right to me. But I am obviously no DV expert.

Great catch also on the Xcelium-specific fixes btw!

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.

Thanks for this work. It looks generally sensible but (since I'm reading it carefully) I think there are ways the first change could be a bit simpler. Of course, it's always possible that I've missed something: give me a shout if so!

hw/ip/kmac/dv/env/kmac_scoreboard.sv Outdated Show resolved Hide resolved
hw/ip/kmac/dv/env/kmac_scoreboard.sv Show resolved Hide resolved
hw/ip/kmac/dv/env/kmac_scoreboard.sv Outdated Show resolved Hide resolved
hw/ip/kmac/dv/env/kmac_scoreboard.sv Show resolved Hide resolved
Comment on lines +1220 to +1216
fork begin
predict_fifo_empty_intr();
end join_none
Copy link
Contributor

Choose a reason for hiding this comment

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

If I understand correctly, this will be firing off a new process on each negedge of the clock. Can we restructure slightly so that predict_fifo_empty_intr gets split into two pieces? The first could return instantly. This would be enough for updating intr_fifo_empty_allowed (which is what we really need in the loop here).

Then we could fire off the second half and update fifo_empty outside of this loop?

I think this will also get rid of the second wait_clks line in the loop.

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'll need time to re-run the simulation over the night then, to be sure it's not breaking anything as this was a bit tricky to get it to work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rswarbrick
When you suggest to move the "second half and update fifo_empty outside of this loop", I guess you are referring to the do...while(...) loop? If yes, this will cause to not check the FIFO full interrupt when it's actually the most important. I think I should keep the check on each clock cycles when intr_fifo_empty_allowed or msgfifo_access are high.

If that's OK, this PR could be merged now as the other comments have been already addressed.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not personally a fan of the approach this code takes. In particular, I really don't like the background process we fire off when updating intr_fifo_empty (because I worry that it ends up hard to reason about - what happens if there's a reset?) I'm willing to believe the code works, and I'm glad. And I hope I never have to maintain it :-)

Let's forget my restructuring notes: it's your code, not mine! I'm happy that the code looks correct: let's merge it.

hw/ip/kmac/dv/env/kmac_scoreboard.sv Show resolved Hide resolved
hw/ip/kmac/dv/env/kmac_scoreboard.sv Outdated Show resolved Hide resolved
hw/ip/kmac/dv/env/kmac_scoreboard.sv Show resolved Hide resolved
hw/ip/kmac/dv/env/kmac_scoreboard.sv Outdated Show resolved Hide resolved
hw/ip/kmac/dv/env/kmac_scoreboard.sv Show resolved Hide resolved
  - Linked to this issue lowRISC#22341

Signed-off-by: Martin Velay <[email protected]>
  - Use SV string function "len" outside of the constraints
  - Wait EDN request without using DV_SPINWAIT macro, as get() method
    from UVM TLM interface is blocking by natur

Signed-off-by: Martin Velay <[email protected]>
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.

Thanks for all the responses to the review comments. Let's take this.

@rswarbrick
Copy link
Contributor

Merging despite the CI failure: it's pretty clearly an IT issue and not caused by this PR.

                Building SW image "//sw/device/tests:plic_sw_irq_test_sim_dv".
                Building "//sw/device/tests:plic_sw_irq_test_sim_dv" on network connected machine.
                Building with command: ./bazelisk.sh build  --define DISABLE_VERILATOR_BUILD=true --//hw/ip/otp_ctrl/data:img_seed=1 //sw/device/tests:plic_sw_irq_test_sim_dv
                Opening zip "/root/.cache/bazelisk/downloads/bazelbuild/bazel-6.2.1-linux-x86_64/bin/bazel (deleted)": open(): No such file or directory
                FATAL: Failed to open '/root/.cache/bazelisk/downloads/bazelbuild/bazel-6.2.1-linux-x86_64/bin/bazel (deleted)' as a zip file: (error: 2): No such file or directory
                make: *** [/azp/agent/_work/1/s/hw/dv/tools/dvsim/sim.mk:73: sw_build] Error 36

@rswarbrick rswarbrick merged commit eca25c0 into lowRISC:master Jul 27, 2024
30 of 32 checks passed
vogelpi added a commit to vogelpi/opentitan that referenced this pull request Aug 6, 2024
As of lowRISC#23942, the FIFO empty status-type interrupt is
predicted and verified which unfortunately negatively impacts the
simulation performance in some cases. Most tests are not notably
impacted but for some rather long running tests, the maximum observed
job runtime increased by up to 50%. As a result, we started seeing
timeouts for some of these tests in the nightly regressions after
merging the FIFO empty interrupt verification PR.

Therefore, this commit increases the timeout for those long running
tests where we observed timeouts.

This resolves lowRISC#24225.

Signed-off-by: Pirmin Vogel <[email protected]>
andreaskurth pushed a commit that referenced this pull request Aug 8, 2024
As of #23942, the FIFO empty status-type interrupt is
predicted and verified which unfortunately negatively impacts the
simulation performance in some cases. Most tests are not notably
impacted but for some rather long running tests, the maximum observed
job runtime increased by up to 50%. As a result, we started seeing
timeouts for some of these tests in the nightly regressions after
merging the FIFO empty interrupt verification PR.

Therefore, this commit increases the timeout for those long running
tests where we observed timeouts.

This resolves #24225.

Signed-off-by: Pirmin Vogel <[email protected]>
andreaskurth pushed a commit to andreaskurth/opentitan that referenced this pull request Aug 10, 2024
As of lowRISC#23942, the FIFO empty status-type interrupt is
predicted and verified which unfortunately negatively impacts the
simulation performance in some cases. Most tests are not notably
impacted but for some rather long running tests, the maximum observed
job runtime increased by up to 50%. As a result, we started seeing
timeouts for some of these tests in the nightly regressions after
merging the FIFO empty interrupt verification PR.

Therefore, this commit increases the timeout for those long running
tests where we observed timeouts.

This resolves lowRISC#24225.

Signed-off-by: Pirmin Vogel <[email protected]>
andreaskurth pushed a commit to andreaskurth/opentitan that referenced this pull request Aug 12, 2024
As of lowRISC#23942, the FIFO empty status-type interrupt is
predicted and verified which unfortunately negatively impacts the
simulation performance in some cases. Most tests are not notably
impacted but for some rather long running tests, the maximum observed
job runtime increased by up to 50%. As a result, we started seeing
timeouts for some of these tests in the nightly regressions after
merging the FIFO empty interrupt verification PR.

Therefore, this commit increases the timeout for those long running
tests where we observed timeouts.

This resolves lowRISC#24225.

This is a cherry pick of commit dff10e5
to branch earlgrey_1.0.0.

Signed-off-by: Pirmin Vogel <[email protected]>
andreaskurth pushed a commit that referenced this pull request Aug 12, 2024
As of #23942, the FIFO empty status-type interrupt is
predicted and verified which unfortunately negatively impacts the
simulation performance in some cases. Most tests are not notably
impacted but for some rather long running tests, the maximum observed
job runtime increased by up to 50%. As a result, we started seeing
timeouts for some of these tests in the nightly regressions after
merging the FIFO empty interrupt verification PR.

Therefore, this commit increases the timeout for those long running
tests where we observed timeouts.

This resolves #24225.

This is a cherry pick of commit dff10e5
to branch earlgrey_1.0.0.

Signed-off-by: Pirmin Vogel <[email protected]>
@martin-velay martin-velay deleted the kmac_fifo_empty branch August 13, 2024 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component:DV DV issue: testbench, test case, etc. IP:kmac
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants