# Clock generation through UVC

**URL:** <https://verificationacademy.com/forums/t/clock-generation-through-uvc/31995>\
**Category:** UVM\
**Tags:** UVM, uvc, clock\
**Created:** [June 29, 2016, 7:44am UTC](https://verificationacademy.com/forums/t/clock-generation-through-uvc/31995 "2016-06-29T07:44:59Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![rohitk](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/r/a698b9/32.png) [@rohitk](https://verificationacademy.com/forums/u/rohitk)\
**Post date:** [June 29, 2016, 8:11am UTC](https://verificationacademy.com/forums/t/clock-generation-through-uvc/31995/2 "2016-06-29T08:11:10Z")

</div>

_In reply to [louis-alexandre.latchimy](https://verificationacademy.com/forums/t/clock-generation-through-uvc/31995):_

I always use clock UVC and clock generation part is coded in clock interface itself. Agent sets random frequency to be used and then there are multiple sequences available to start/stop clock. driver gets the command and calls task in interface to start or stop clock accordingly. clock interface looks like this:

```auto
interface clk_if;
output clk;
bit clk_on;
int clk_high;
int clk_low;

always begin
if (clk_on) begin
   clk = 1;
   #clk_high;
   clk = 0;
   #clk_low;
end
end

task start_clock()
 clk_on = 1;
endtask
endinterface

```

---

_[View the full topic](https://verificationacademy.com/forums/t/clock-generation-through-uvc/31995)._
