How can I apply word clock jitter in UVM?

All,

I have a task in my driver which drives the clock depending on the clock period set in the transaction. I’ve successfully managed to apply a clock drift to this period, however, how can I apply jitter to every edge of the clock?

The task looks like this:

task clock_gen();

dai_vif.bclk = 1'b0;
dai_vif.wclk = 1'b0;

drv_wclk_period_drift = drv_wclk_period/2 - drv_wclk_drift;

fork
forever begin
#(drv_bclk_period/2) dai_vif.bclk = ~dai_vif.bclk;
end
join_none

fork
forever begin
#(drv_wclk_period_drift) dai_vif.wclk = ~dai_vif.wclk;
end
join_none

endtask : clock_gen

I’d like to apply a random amount of jitter by randomizing the jitter field in the transaction which is retrieved upon every word clock edge. How could I implement this in UVM?

Thanks

In reply to owenjarvie:

As per my understanding, following what you want to implement for jitter


fork
  forever begin
    // TODO: Here you need to apply some logic for when this jitter works
    dai_vif.wclk = ~dai_vif.wclk;
    #(drv_wclk_jitter) // Small enough delay for jitter
    dai_vif.wclk = ~dai_vif.wclk;
  end
join_none