Refactor: Adopt AXI5 reset pattern for OBI memory driver - #2741
TheMonkeyG wants to merge 3 commits into
Conversation
Resolves openhwfoundation#2734 * Migrated reset handling to a centralized disable fork pattern inside run_phase * Added force_idle_nets and release_nets to handle asynchronous resets safely * Restored reactive slave behavior by using try_next_item in drv_slv_loop * Fixed shared state race condition by removing cntxt.reset_state assignment from driver Signed-off-by: Daniel <monkeyg400@gmail.com>
|
I would recommend keeping reset monitoring logic in the monitor and using a uvm_event in the context to share state with the driver. |
|
Hi datum-dpoulin, |
|
Hi @TheMonkeyG, thanks for the update. This is a significant change that will impact multiple projects, so I am being very careful with it. The OBI Agent is used by two active projects (CVE2 and CVA6) am actively working to test these changes in the CVE2 environment. I'll let you know if I encounter any issues. |
|
Hi @MikeOpenHWGroup, I reviewed the reset handling and realized that using a fake I've just pushed an update to fix this: I removed the manual To check this, I wrote a quick smoke test that fires reset at different points during idle, right before item_done(), and mid-transaction. The approach mostly held up under reset, but the smoke test also found one narrow case: if item_done() happens to fire in the exact same delta cycle as reset asserting, it can slip through before the sequencer reacts — so the sequence sees a false "completed". Not sure yet if real OBI timing can actually land in that window, or if it's just an artifact of how the mock drives reset. Still looking into it. Please let me know how it behaves in your CVE2 testing ! |
Resolves #2734
The OBI memory driver previously dispatched on
cntxt.reset_stateinside per-task loops (
drv_pre_reset/drv_in_reset/drv_post_reset).Because
drv_post_reset()called multi-cycle tasks (drv_mstr_req,drv_slv_read_req,drv_slv_write_req),reset_statewas onlyre-checked between transactions, not during one — a reset asserted
mid-transaction would not abort it. That's the root cause of #2734.
This PR moves reset handling entirely into
run_phase, using thesame
disable forkpattern already used inuvma_axi5. Rationaleand an alternative approach that was considered (per-task
fork/join_any escapes) are written up in this comment:
#2734 (comment)
Reset architecture changes
run_phasenow spawns the gnt loop (drv_slv_gnt,chan_a) andthe transaction loop (
drv_mstr_loop/drv_slv_loop,chan_r)via
fork...join_none, racing against await(reset_n !== 1)inthe same scope. When reset asserts,
join_anyreturns anddisable forkkills both loops immediately, wherever they werein execution — including mid multi-cycle wait inside a
transaction task.
drv_mstr_loop/drv_slv_loop(formerly the MSTR/SLV branches ofdrv_post_reset) are now self-containedforeverloops with noreset awareness of their own; they rely entirely on the outer
disable forkto stop them.get_next_item/try_next_itemanditem_done(), the sequencer would otherwise deadlock.run_phasenow checks
req != nullafterdisable forkand callsitem_done()itself to release the sequencer.force_idle_nets/release_netsonuvma_obi_memory_if,operating on the bare signal names (force must target the
physical net, not a clocking-block alias). This gives a hard
guarantee the bus is idle while in reset, on top of the existing
soft
<=idle drive indrv_idle().drv_slv_gnt()no longer dispatches oncntxt.reset_state— it'sonly ever invoked from inside the active-window fork now.
Bundled protocol fixes
Signed-off-by: Daniel monkeyg400@gmail.com