# How to generate a 900 MHz clock

**URL:** <https://verificationacademy.com/forums/t/how-to-generate-a-900-mhz-clock/35239>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, clock-frequency\
**Created:** [October 25, 2018, 9:15pm UTC](https://verificationacademy.com/forums/t/how-to-generate-a-900-mhz-clock/35239 "2018-10-25T21:15:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![1978bubun](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/1/a87d85/32.png) [@1978bubun](https://verificationacademy.com/forums/u/1978bubun)\
**Post date:** [October 25, 2018, 9:15pm UTC](https://verificationacademy.com/forums/t/how-to-generate-a-900-mhz-clock/35239/1 "2018-10-25T21:15:49Z")

</div>

What is the best way to generate an exact 900MHz clock?

Currently this is what I am doing

`timescale 1ns/1ps

logic clk;  
initial clk = 1’b0;  
always #(1.111ns / 2) clk = ~clk;

Per waves, clk toggles every 0.556ns, so it has a period of 1.112ns, so it runs at a little under 900 MHz.

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [October 25, 2018, 9:44pm UTC](https://verificationacademy.com/forums/t/how-to-generate-a-900-mhz-clock/35239/2 "2018-10-25T21:44:21Z")

</div>

_In reply to [1978bubun](https://verificationacademy.com/forums/t/how-to-generate-a-900-mhz-clock/35239):_

Change your code to

```verilog
always begin
    #0.555ns clk = 1;
    #0.556ns clk = 0;
   end

```

or change your time precision to

```verilog
`timescale 1ns/100fs

```
