[otbn,dv] Add WFI testpoint and tests - #30918
Conversation
3566ffb to
7921cbb
Compare
| * After resuming, load the word at DMEM address 0. This tests that the ISS observes the same new | ||
| * value as the RTL (if the host wrote to DMEM). |
There was a problem hiding this comment.
I'd probably switch the order to "RTL ... the same as the ISS", which sounds a bit more like the ISS is defined to be correct :-)
There was a problem hiding this comment.
This test is now obsolete as I switched the smoke test to use the already existing top level test.
| `DV_CHECK_FATAL(uvm_hdl_read(status_path, rtl_status), | ||
| $sformatf("Failed to read STATUS from `%0s'", status_path)) |
There was a problem hiding this comment.
I'm not a big fan of this! Can't we wait by repeatedly reading the STATUS register with no backdoors?
There was a problem hiding this comment.
True, this is ugly. I've replaced it with a simpler STATUS register polling.
| // Stay paused for a random number of cycles. | ||
| resume_delay = $urandom_range(max_resume_delay, min_resume_delay); | ||
| `uvm_info(`gfn, $sformatf("Paused, waiting %0d cycles before RESUME", resume_delay), UVM_LOW) | ||
| cfg.clk_rst_vif.wait_clks(resume_delay); |
There was a problem hiding this comment.
Why add an extra wait? If there's a good reason, it will need describing carefully here and also in the testpoint. If not, I suggest dropping the unnecessary code.
There was a problem hiding this comment.
Hm, I added this just to not always read on the same cycle. But its meaningless. The only really good edge case would be to read in the very first pause cycle. But this code does not do this anyway. I removed it.
|
|
||
| // Wait until the program has ended. | ||
| `DV_WAIT(cfg.model_agent_cfg.vif.status == otbn_pkg::StatusIdle) | ||
| `uvm_info(`gfn, "OTBN finished after RESUME", UVM_LOW) |
There was a problem hiding this comment.
Don't we need the OTBN application to finish the handshake? I would suggest it does something like copying the value that we wrote and putting it at address 0x4. Then the virtual sequence can load that word and check it's the value that we wrote in the first place.
There was a problem hiding this comment.
That is a good point. This smoke test here was my very first test. But in the meantime I wrote a top level test which is more evolved. I have now changed the smoke vseq to use this test. The test can be found at sw/otbn/wfi/wfi_test.s.
7921cbb to
9545a6f
Compare
etterli
left a comment
There was a problem hiding this comment.
Thanks @rswarbrick for the good inputs. The smoke tests now uses the top level test which checks more stuff.
| * After resuming, load the word at DMEM address 0. This tests that the ISS observes the same new | ||
| * value as the RTL (if the host wrote to DMEM). |
There was a problem hiding this comment.
This test is now obsolete as I switched the smoke test to use the already existing top level test.
| `DV_CHECK_FATAL(uvm_hdl_read(status_path, rtl_status), | ||
| $sformatf("Failed to read STATUS from `%0s'", status_path)) |
There was a problem hiding this comment.
True, this is ugly. I've replaced it with a simpler STATUS register polling.
|
|
||
| // Wait until the program has ended. | ||
| `DV_WAIT(cfg.model_agent_cfg.vif.status == otbn_pkg::StatusIdle) | ||
| `uvm_info(`gfn, "OTBN finished after RESUME", UVM_LOW) |
There was a problem hiding this comment.
That is a good point. This smoke test here was my very first test. But in the meantime I wrote a top level test which is more evolved. I have now changed the smoke vseq to use this test. The test can be found at sw/otbn/wfi/wfi_test.s.
| // Stay paused for a random number of cycles. | ||
| resume_delay = $urandom_range(max_resume_delay, min_resume_delay); | ||
| `uvm_info(`gfn, $sformatf("Paused, waiting %0d cycles before RESUME", resume_delay), UVM_LOW) | ||
| cfg.clk_rst_vif.wait_clks(resume_delay); |
There was a problem hiding this comment.
Hm, I added this just to not always read on the same cycle. But its meaningless. The only really good edge case would be to read in the very first pause cycle. But this code does not do this anyway. I removed it.
9545a6f to
8b9506d
Compare
|
Moved the WFI test programs to the |
Adds new testpoints to test the WaitForInterrupt feature. Signed-off-by: Pascal Etterli <pascal.etterli@lowrisc.org>
This adds a simple sequence which runs an OTBN program with a WFI instruction. It then lets OTBN resume and checks that it did resume properly. Signed-off-by: Pascal Etterli <pascal.etterli@lowrisc.org>
This adds a directed test to check that an escalation is properly handled whilst OTBN is paused by a WFI instruction. Signed-off-by: Pascal Etterli <pascal.etterli@lowrisc.org>
Signed-off-by: Pascal Etterli <pascal.etterli@lowrisc.org>
8b9506d to
0156513
Compare
|
Rebased on merged #30917. This is now ready. |
This PR is based on #30917 and can only be merged afterwards (thus a draft PR). Only the last 4 commits are relevant.
This PR adds a testpoint for the WFI feature (or here) as well as the required tests.
Please note that I have limited DV experience. Feel free to discard the current vseqs. These serve as starting points.