Skip to content

[dv,clk_mgr] Vendor in clk_mgr DV environment from OT - #698

Open
tchilikov-semify wants to merge 9 commits into
lowRISC:mainfrom
tchilikov-semify:clk_mgr
Open

tchilikov-semify wants to merge 9 commits into
lowRISC:mainfrom
tchilikov-semify:clk_mgr

Conversation

@tchilikov-semify

@tchilikov-semify tchilikov-semify commented Aug 20, 2026 •

Copy link
Copy Markdown
Collaborator

This PR makes the clk_mgr DV environment build and pass on mocha's configuration. The environment was already generated in the tree; what was missing was adapting it to a single hint clock and to ext_clk_bypass being false.

The regression can be ran with:
dvsim hw/top_chip/ip_autogen/clkmgr/dv/clkmgr_sim_cfg.hjson -i all
It currently passes 610/610.

This PR disables the clock manager measurement tests, since measurement is disabled in mocha.

The DV templates hardcoded earlgrey's four hint clocks, so the generated environment referred to signals that don't exist in mocha and wouldn't compile. Hint clock names are now generated from the config.

Two shared DV bugs were hit along the way, and both were fixed by vendoring in the upstream OpenTitan fixes.

Lastly, the clkmgr register description declared a countermeasure for the external clock regwen, a register that is not built when ext_clk_bypass is false. That countermeasure, its RTL annotation and its testpoint are now gated on ext_clk_bypass.

@tchilikov-semify

Copy link
Copy Markdown
Collaborator Author

This PR will close issue #432

@tchilikov-semify tchilikov-semify linked an issue Aug 20, 2026 that may be closed by this pull request
@tchilikov-semify

Copy link
Copy Markdown
Collaborator Author

Results of running the regression:

Test Results

Stage Name Tests Max Job Runtime Simulated Time Passing Total Pass Rate
V1 smoke clkmgr_smoke 2.000s 48.895us 50 50 100.00 %
V1 csr_hw_reset clkmgr_csr_hw_reset 1.000s 41.636us 5 5 100.00 %
V1 csr_rw clkmgr_csr_rw 2.000s 26.830us 20 20 100.00 %
V1 csr_bit_bash clkmgr_csr_bit_bash 9.000s 1629.248us 5 5 100.00 %
V1 csr_aliasing clkmgr_csr_aliasing 2.000s 41.693us 5 5 100.00 %
V1 csr_mem_rw_with_rand_reset clkmgr_csr_mem_rw_with_rand_reset 2.000s 85.753us 20 20 100.00 %
V1 regwen_csr_and_corresponding_lockable_csr clkmgr_csr_rw 2.000s 26.830us 20 20 100.00 %
V1 regwen_csr_and_corresponding_lockable_csr clkmgr_csr_aliasing 2.000s 41.693us 5 5 100.00 %
V1 TOTAL 105 105 100.00 %
V2 peri_enables clkmgr_peri 2.000s 44.233us 50 50 100.00 %
V2 trans_enables clkmgr_trans 2.000s 39.986us 50 50 100.00 %
V2 clk_status clkmgr_clk_status 2.000s 18.288us 50 50 100.00 %
V2 jitter clkmgr_smoke 2.000s 48.895us 50 50 100.00 %
V2 stress_all clkmgr_stress_all 15.000s 1833.690us 50 50 100.00 %
V2 alert_test clkmgr_alert_test 2.000s 19.977us 50 50 100.00 %
V2 tl_d_oob_addr_access clkmgr_tl_errors 3.000s 305.435us 20 20 100.00 %
V2 tl_d_illegal_access clkmgr_tl_errors 3.000s 305.435us 20 20 100.00 %
V2 tl_d_outstanding_access clkmgr_csr_hw_reset 1.000s 41.636us 5 5 100.00 %
V2 tl_d_outstanding_access clkmgr_csr_rw 2.000s 26.830us 20 20 100.00 %
V2 tl_d_outstanding_access clkmgr_csr_aliasing 2.000s 41.693us 5 5 100.00 %
V2 tl_d_outstanding_access clkmgr_same_csr_outstanding 2.000s 50.068us 20 20 100.00 %
V2 tl_d_partial_access clkmgr_csr_hw_reset 1.000s 41.636us 5 5 100.00 %
V2 tl_d_partial_access clkmgr_csr_rw 2.000s 26.830us 20 20 100.00 %
V2 tl_d_partial_access clkmgr_csr_aliasing 2.000s 41.693us 5 5 100.00 %
V2 tl_d_partial_access clkmgr_same_csr_outstanding 2.000s 50.068us 20 20 100.00 %
V2 TOTAL 370 370 100.00 %
V2S tl_intg_err clkmgr_sec_cm 3.000s 379.579us 4 5 80.00 %
V2S tl_intg_err clkmgr_tl_intg_err 3.000s 260.606us 20 20 100.00 %
V2S shadow_reg_update_error clkmgr_shadow_reg_errors 2.000s 53.849us 20 20 100.00 %
V2S shadow_reg_read_clear_staged_value clkmgr_shadow_reg_errors 2.000s 53.849us 20 20 100.00 %
V2S shadow_reg_storage_error clkmgr_shadow_reg_errors 2.000s 53.849us 20 20 100.00 %
V2S shadowed_reset_glitch clkmgr_shadow_reg_errors 2.000s 53.849us 20 20 100.00 %
V2S shadow_reg_update_error_with_csr_rw clkmgr_shadow_reg_errors_with_csr_rw 2.000s 91.264us 20 20 100.00 %
V2S sec_cm_bus_integrity clkmgr_tl_intg_err 3.000s 260.606us 20 20 100.00 %
V2S sec_cm_meas_config_shadow clkmgr_shadow_reg_errors 2.
000s 53.849us 20 20 100.00 %
V2S sec_cm_idle_intersig_mubi clkmgr_idle_intersig_mubi 3.000s 460.887us 50 50 100.00 %
V2S sec_cm_jitter_config_mubi clkmgr_csr_rw 2.000s 26.830us 20 20 100.00 %
V2S sec_cm_idle_ctr_redun clkmgr_sec_cm 3.000s 379.579us 4 5 80.00 %
V2S sec_cm_meas_config_regwen clkmgr_csr_rw 2.000s 26.830us 20 20 100.00 %
V2S sec_cm_clk_ctrl_config_regwen clkmgr_csr_rw 2.000s 26.830us 20 20 100.00 %
V2S prim_count_check clkmgr_sec_cm 3.000s 379.579us 4 5 80.00 %
V2S TOTAL 134 135 99.26 %
V3 regwen clkmgr_regwen 2.000s 49.768us 50 50 100.00 %
V3 stress_all_with_rand_reset clkmgr_stress_all_with_rand_reset 129.000s 37116.651us 50 50 100.00 %
V3 TOTAL 100 100 100.00 %
TOTAL 609 610 99.84 %

The DV templates hardcode earlgrey's four hint clocks (aes, hmac, kmac, otbn)
and build signal names from them. Mocha has one hint clock, clk_main_hint, so
the generated environment referred to signals that don't exist and wouldn't
compile.
Clock measurement is disabled in mocha, so the hardware holds its config lock
open instead of letting software clear it. The randomized CSR tests write to
the lock, read back a different value, and fail. Exclude it from the tests
that write to it.
clk_mgr has no interrupts, but the testplan still imported the shared
interrupt testplan. This added an interrupt test to the V2 regression that
doesn't exist, so every dvsim run logged an error about it and the report
carried testpoints that could never be covered.
@tchilikov-semify
tchilikov-semify force-pushed the clk_mgr branch 2 times, most recently from f96e956 to b6901c4 Compare October 20, 2026 13:48
Clock measurement is disabled in mocha, so any test that tries to exercise it
can't pass. Drop the two measurement tests and their testpoints, and skip the
measurement checks inside the tests that also cover other things.

In place of the dropped checks, the regwen test now tries to enable
measurement and confirms the hardware refuses.
Apply two commits from OpenTitan (lowRISC/opentitan#31175) which allows
the driver to resume when it encounters items during a reset, instead of
getting stuck forever.
Add the upstream fix from OpenTitan (lowRISC/opentitan#31207) which
widens the sec_cm alert window from 7 to 8 cycles in cip_lib, since the
alert crosses a clock domain and can arrive a cycle late due to
metastability.
…it is not built

Gate the CLK_CTRL.CONFIG.REGWEN countermeasure, its RTL annotation
and its testpoint on ext_clk_bypass, since the register it
protects isn't built without it.

@martin-velay martin-velay left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe this PR is good to go now. Thanks @tchilikov-semify !

@martin-velay
martin-velay disabled auto-merge October 23, 2026 08:34
@martin-velay
martin-velay added this pull request to the merge queue Oct 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Oct 23, 2026
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.

Clock Manager DV - Block-level env to be imported from OT

2 participants