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

[pattgen,dv] Start to tidy up cnt_rollover #26319

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
c59e1ac
[pattgen,dv] Use extern definitions in pattgen_env_cfg
rswarbrick Feb 14, 2025
0159232
[pattgen,dv] Move num_runs to pattgen_stress_all_vseq
rswarbrick Feb 14, 2025
214b406
[pattgen,dv] Tidy up how some sequence delays get configured
rswarbrick Feb 14, 2025
a813ded
[pattgen,dv] Simplify how channels get started
rswarbrick Feb 14, 2025
3b15362
[pattgen,dv] Simplify how we control if errors are injected
rswarbrick Feb 14, 2025
09d7d69
[pattgen,dv] Move error_injected_enb from cfg object to sequence
rswarbrick Feb 14, 2025
e004afd
[pattgen,dv] Inline trivial task into pattgen_base_vseq::body
rswarbrick Feb 14, 2025
116bc5a
[pattgen,dv] Replace pattgen_base_vseq::right_rotation
rswarbrick Feb 14, 2025
9fd0e1d
[pattgen,dv] Merge pattgen_base_vseq::setup_pattgen_channel_*
rswarbrick Feb 14, 2025
b420876
[pattgen,dv] Make pattgen_base_vseq::wait_for_channel_ready simpler
rswarbrick Feb 14, 2025
9324c95
[pattgen,dv] Tweak pattgen_base_vseq::control_channels
rswarbrick Feb 14, 2025
d1eab5e
[pattgen,dv] Define a function for channel select enum -> mask
rswarbrick Feb 14, 2025
2e05a03
[pattgen,dv] Simplify clear_interrupts task
rswarbrick Feb 16, 2025
44b8b48
[pattgen,dv] Add docs and use extern methods in pattgen_base_vseq
rswarbrick Feb 14, 2025
712420a
[pattgen,dv] Get rid of channel_select_e
rswarbrick Feb 16, 2025
ab00925
[pattgen,dv] Get rid of pattgen_low_polarity_pct
rswarbrick Feb 16, 2025
1c625d6
[pattgen,dv] Tidy up testplan for cnt_rollover
rswarbrick Feb 16, 2025
5e9ad0c
[pattgen,dv] Reformat and document pattgen_cnt_rollover_vseq
rswarbrick Feb 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 45 additions & 27 deletions hw/ip/pattgen/dv/env/seq_lib/pattgen_cnt_rollover_vseq.sv
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,51 @@
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

// Count rollover test vseq
// TODO(#26317):
//
// This sequence doesn't really satisfy the cnt_rollover testpoint. The maximum prediv value is
// (1<<32-1), which is very large! The code below actually constrains to a 16-bit prediv and also
// overly constrains len and reps.
//
// Unfortunately, the clk_cnt_q signal in pattgen_chan isn't actually exposed to other blocks. If
// we want to work with large values, we'll probably need to force its value to "just below
// prediv_q")
Comment on lines +11 to +13
Copy link
Contributor

Choose a reason for hiding this comment

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

I tried to understand this by looking at #26317 with no luck. Am I thick in the head or is the spec for pattgen rather confusing?

Also, it seems with small constraints you are able to test the behavior is correct. So is the problem that you cannot test the behavior for larger values of the config registers, and that is the reason you would need to set the counters to values close to rollover?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's rather confusing (and I'm enthusiastically hacking away to try to tidy lots of this up). I think the original testplan authors wanted to make sure we "sent entire patterns" with maximal values of prediv and/or length. But those counters are enormous! So we either need to abandon doing so or force an internal signal. But the existing code seemed rather silly.


class pattgen_cnt_rollover_vseq extends pattgen_base_vseq;
`uvm_object_utils(pattgen_cnt_rollover_vseq)

// reduce num_trans due to long running simulations
constraint num_trans_c { num_trans inside {[2 : 3]}; }

function new (string name="");
super.new(name);
pattgen_max_dly = 0;
endfunction

// override this function for pattgen_cnt_rollover test
function pattgen_channel_cfg get_random_channel_config(uint channel);
bit [1:0] is_max;
pattgen_channel_cfg ch_cfg;
ch_cfg = pattgen_channel_cfg::type_id::create($sformatf("channel_cfg_%0d", channel));
`DV_CHECK_RANDOMIZE_WITH_FATAL(ch_cfg,
prediv dist {0 :/ 1, [1 : 'hfffe] :/ 1, 'hffff :/ 1};
len dist {0 :/ 1, [1 : 'he] :/ 1, 'hf :/ 1};
reps dist {0 :/ 1, [1 : 'h3e] :/ 1, 'h3f :/ 1};
((prediv+1) * (len+1) * (reps+1)) <= 'h1_0000;
// dependent constraints
solve len before data;
data inside {[0 : (1 << (len + 1)) - 1]};
)
return ch_cfg;
endfunction : get_random_channel_config

endclass : pattgen_cnt_rollover_vseq
// Because the constraint on the sizes below is quite large, a simulation takes a long time.
// Constrain num_trans to be reasonably small, in order to keep reasonable run times.
extern constraint num_trans_c;

extern function new(string name="");

// This function is defined in pattgen_base_vseq, but we override it here to constrain the channel
// configuration to be reasonably large.
extern function pattgen_channel_cfg get_random_channel_config(uint channel);
endclass

constraint pattgen_cnt_rollover_vseq::num_trans_c {
num_trans inside {[2 : 3]};
}

function pattgen_cnt_rollover_vseq::new(string name="");
super.new(name);
pattgen_max_dly = 0;
endfunction

function pattgen_channel_cfg pattgen_cnt_rollover_vseq::get_random_channel_config(uint channel);
bit [1:0] is_max;
pattgen_channel_cfg ch_cfg;
ch_cfg = pattgen_channel_cfg::type_id::create($sformatf("channel_cfg_%0d", channel));
`DV_CHECK_RANDOMIZE_WITH_FATAL(ch_cfg,
prediv dist {0 :/ 1, [1 : 'hfffe] :/ 1, 'hffff :/ 1};
len dist {0 :/ 1, [1 : 'he] :/ 1, 'hf :/ 1};
reps dist {0 :/ 1, [1 : 'h3e] :/ 1, 'h3f :/ 1};
((prediv+1) * (len+1) * (reps+1)) <= 'h1_0000;
// dependent constraints
solve len before data;
data inside {[0 : (1 << (len + 1)) - 1]};
)
return ch_cfg;
endfunction
Loading