Skip to content

Commit

Permalink
[pwm,dv] Remove cfg.pwm_param
Browse files Browse the repository at this point in the history
This is just a duplicate of information that's already in the
RAL (seemingly used for configuring vseqs).

Signed-off-by: Rupert Swarbrick <[email protected]>
  • Loading branch information
rswarbrick committed Nov 8, 2024
1 parent d83115d commit 65ee6b5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
2 changes: 0 additions & 2 deletions hw/ip/pwm/dv/env/pwm_env_cfg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ class pwm_env_cfg extends cip_base_env_cfg #(.RAL_T(pwm_reg_block));
virtual clk_rst_if clk_rst_core_vif;
int core_clk_freq_mhz;

// variables
param_reg_t pwm_param[PWM_NUM_CHANNELS];
// ratio between bus_clk and core_clk (must be >= 1)
rand int clk_ratio;
constraint clk_ratio_c { clk_ratio inside {[1: 4]}; }
Expand Down
11 changes: 6 additions & 5 deletions hw/ip/pwm/dv/env/seq_lib/pwm_perf_vseq.sv
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ class pwm_perf_vseq extends pwm_rand_output_vseq;
`uvm_object_new

// variables
rand bit [15:0] rand_dc;
rand bit [15:0] rand_blink;
rand bit [15:0] rand_dc;
rand bit [15:0] rand_blink;
rand param_reg_t pwm_param[PWM_NUM_CHANNELS];

// constraints
constraint rand_chan_c {
Expand Down Expand Up @@ -52,9 +53,9 @@ class pwm_perf_vseq extends pwm_rand_output_vseq;
set_duty_cycle(i, .A(rand_dc[i]), .B(rand_dc[i]));
set_blink(i, .A(rand_blink[i]), .B(rand_blink[i]));

cfg.pwm_param[i].HtbtEn = rand_reg_param.HtbtEn;
cfg.pwm_param[i].BlinkEn = rand_reg_param.BlinkEn;
set_param(i, cfg.pwm_param[i]);
pwm_param[i].HtbtEn = rand_reg_param.HtbtEn;
pwm_param[i].BlinkEn = rand_reg_param.BlinkEn;
set_param(i, pwm_param[i]);
end

set_ch_invert(rand_invert);
Expand Down
12 changes: 8 additions & 4 deletions hw/ip/pwm/dv/env/seq_lib/pwm_rand_output_vseq.sv
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,17 @@ class pwm_rand_output_vseq extends pwm_base_vseq;
// set random dc and params for all channels
for (uint i = 0; i < PWM_NUM_CHANNELS; i++) begin
dc_blink_t duty_cycle = rand_pwm_duty_cycle();
param_reg_t pwm_param;

pwm_param.PhaseDelay = (rand_reg_param.PhaseDelay * (2**(-16)));
pwm_param.HtbtEn = rand_reg_param.HtbtEn;
pwm_param.BlinkEn = rand_reg_param.BlinkEn;

set_duty_cycle(i, .A(duty_cycle.A), .B(duty_cycle.B));
rand_pwm_blink(i);

// phase delay of the PWM rising edge, in units of 2^(-16) PWM cycles
cfg.pwm_param[i].PhaseDelay = (rand_reg_param.PhaseDelay * (2**(-16)));
cfg.pwm_param[i].HtbtEn = rand_reg_param.HtbtEn;
cfg.pwm_param[i].BlinkEn = rand_reg_param.BlinkEn;
set_param(i, cfg.pwm_param[i]);
set_param(i, pwm_param);
end

set_ch_invert(rand_invert);
Expand Down
7 changes: 4 additions & 3 deletions hw/ip/pwm/dv/env/seq_lib/pwm_smoke_vseq.sv
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class pwm_smoke_vseq extends pwm_base_vseq;


virtual task body();
param_reg_t pwm_param;
`DV_CHECK_STD_RANDOMIZE_WITH_FATAL(pwm_param, pwm_param.BlinkEn == 1;)

//make sure write to regs are enabled
set_reg_en(Enable);

Expand All @@ -24,11 +27,9 @@ class pwm_smoke_vseq extends pwm_base_vseq;
//setup general config
set_cfg_reg(10, 1, 1);

cfg.pwm_param[0].BlinkEn = 1;

set_duty_cycle(.channel(0), .A(13000), .B(6500));
set_blink(.channel(0), .A(0), .B(0));
set_param(0, cfg.pwm_param[0]);
set_param(0, pwm_param);

// enable channel 0
set_ch_enables(32'h1);
Expand Down

0 comments on commit 65ee6b5

Please sign in to comment.