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

[dv,pwm] DV improvements for PWM #25718

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

alees24
Copy link
Contributor

@alees24 alees24 commented Dec 19, 2024

This PR offers extensive improvements to the amount of verification performed by the existing DV environment.
Unfortunately the majority of the sequence items were being silently ignored previously as a result of a couple of clear faults in the DV environment (incorrect clock, ignoring items that had a 'period' mismatch, and a 'settle time' whenever the blink phase changed).
The DV also made no attempt to monitor disabled channels, pulse cycles with no change in the output (duty cycle of zero), or the phase delay of outputs. The low power mode testing was also deficient.

This PR improves the DV and achieves a near 100% pass rate; there is an issue with 'pwm_alert_test' at present, and some sequences will fail on account of the initial pulse cycle being hard to predict because of the CDC and channel reprogramming/start up behavior. This should be improved by a later PR.

The existing test sequences are largely unmodified, but we shall definitely want some additional sequences or constraints to hit awkward edge cases, since most of the parameters have a large range and can interact badly (eg. large 'clk_div' and large 'dc_resn' on the phase counter, or large 'blink_param.x' and small 'blink_param.y' in heartbeat mode. In each case the simulation time quickly becomes infeasible).

@alees24 alees24 requested a review from rswarbrick December 19, 2024 23:34
@alees24 alees24 requested a review from a team as a code owner December 19, 2024 23:34
@rswarbrick
Copy link
Contributor

For reviewers (possibly me!): The first commit comes from #25717, which should be merged first.

} dc_blink_t;
} duty_cycle_t;

// Blink mode parameters (BLINK_PARAM_x).
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 I'd be inclined to use something like BLINK_PARAM_* to avoid "x" clashing with the X name!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Switched both to _i for clarity.

channel_cfg.ClkDiv = next_cfg.ClkDiv;
channel_cfg.DcResn = next_cfg.DcResn;
end
// Enable bit applies immediately.
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 sure about "immediately" here. Maybe "is always accepted" (to match the words a few lines earlier)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK.

Comment on lines 42 to 43
// int unsigned clk_div, int unsigned dc_resn,
// int unsigned clk_elapsed);
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 sure I understand these commented arguments. Maybe add an explanatory comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, code restructuring; they are due to be deleted. Thanks.

// phase.
first_activation = 1'b1;
// Calculate how many core clocks a single pulse cycle takes; we require this information so
// that we may detect a pulse cycle in which the PWM assert is not asserted at all
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Maybe "PWM output"?

@@ -144,7 +146,7 @@ task pwm_scoreboard::process_tl_access(tl_seq_item item,
// enabled with an arbitrary phase relationship to the shared phase counter.
ignore_state_change[ii] = SettleTime;
end
txt = $sformatf("\n Channel[%d] : %0b",ii, channel_en[ii]);
txt = $sformatf("\n Channel[%d] : %0b",ii, channel_en[ii]) ;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Missing space before second argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair enough; lingering formatting issue from earlier DV...there are more than a few and I shy away from changing them generally. At some point I should address them all in a single commit with no functional impact.


endtask
`uvm_info(`gfn, $sformatf("Ch %0d active %0d first %0d", channel, active_cycles, first_activation[channel]), UVM_LOW)
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 might be over length?

Introduce separate structures for the DUTY_CYCLE_i and
BLINK_PARAM_i registers to reduce the potential for confusion.

Remove the crosstalk between duty cycles an pulse cycle counts
in `rand_pwm_blink.` This confusion appears to have resulted
from the fact that in heartbeat mode BLINK_PARAM_i.Y represents
an increment to the duty cycle rather than a count of pulses
cycles.

Other tidy ups/clarifications; no functional change in this commit
beyond adjusting the ranges of A,B,X and Y values exercised.

Signed-off-by: Adrian Lees <a.lees@lowrisc.org>
The majority of the sequence items were being rejected on
account of a mismatch between the expected pulse period and
that observed by the monitor. This discrepancy was the result
of the monitor running on the wrong clock signal.

Signed-off-by: Adrian Lees <a.lees@lowrisc.org>
Duty cycle prediction was very overcomplicated, confusing the task
of forming the current prediction with that of then updating the
state for the subsequent prediction.

Tidy and clarify the detection of active and inactive output states
within the monitor.

The currently-required 'settle time' at start up and transition
between blinking phases may be achieved using the same logic.

Signed-off-by: Adrian Lees <a.lees@lowrisc.org>
Introduce phase monitoring and checking.
Run the monitors on disabled channels too.
Modify and simplify duty cycle prediction to meet the
specification.
Implement low power mode testing (TL-UL clock stopping
and resuming).
Introduce some handling of reset with an eye towards V3.
Report the duty cycle as a 16-bit fixed-point number as
per the hardware specification and implementation; this
aids comprehension and diagnostics.

Signed-off-by: Adrian Lees <a.lees@lowrisc.org>
To avoid incurring ping timeouts when the TL-UL clock is stopped
during low power mode, ensure that the alert agent is operating
on the same clock and not asynchronously.

Signed-off-by: Adrian Lees <a.lees@lowrisc.org>
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.

2 participants