# \#clock

**URL:** https://verificationacademy.com/forums/tag/clock/5342.md

[Latest](https://verificationacademy.com/forums/latest.md) · [Categories](https://verificationacademy.com/forums/categories.md) · [Tags](https://verificationacademy.com/forums/tags.md)

---

## [System Verilog Clock Generation](https://verificationacademy.com/forums/t/system-verilog-clock-generation/49111)

<div class="topic-metadata">

**Author:** [@mohitv](https://verificationacademy.com/forums/u/mohitv)\
**Replies:** 1\
**Last updated:** [December 5, 2024, 6:17am UTC](https://verificationacademy.com/forums/t/system-verilog-clock-generation/49111 "2024-12-05T06:17:14Z")

</div>

Write a code to generate the clock with a random duty cycle between 10% to 80% for each clock cycle, the clock period should be same for each cycle and the clock period should parametrized.

---

## [Signal delay by X clock cycles in System Verilog](https://verificationacademy.com/forums/t/signal-delay-by-x-clock-cycles-in-system-verilog/31432)

<div class="topic-metadata">

**Author:** [@RenéPi](https://verificationacademy.com/forums/u/Ren%C3%A9Pi)\
**Replies:** 5\
**Last updated:** [December 9, 2022, 5:35am UTC](https://verificationacademy.com/forums/t/signal-delay-by-x-clock-cycles-in-system-verilog/31432 "2022-12-09T05:35:50Z")

</div>

Hello everyone, I am new to Verilog. I’d like to delay a signal by 5 clock cycles. Right now I am doing this by just copying a signal 5 times, but isn’t there a more comfortable way? fs\_shift1\_model\_o \<= fs\_model\_o; …

---

## [Clock generation through UVC](https://verificationacademy.com/forums/t/clock-generation-through-uvc/31995)

<div class="topic-metadata">

**Author:** [@louis-alexandre.latchimy](https://verificationacademy.com/forums/u/louis-alexandre.latchimy)\
**Replies:** 15\
**Last updated:** [March 9, 2022, 10:39pm UTC](https://verificationacademy.com/forums/t/clock-generation-through-uvc/31995 "2022-03-09T22:39:54Z")

</div>

Hi everybody, I would like to know if a clock generation is possible through a dedicated UVC. I have already written some code to describe the agent and the driver. However, it doesn’t work. It seems like the driver doe…

---

## [Clock Monitoring](https://verificationacademy.com/forums/t/clock-monitoring/39509)

<div class="topic-metadata">

**Author:** [@Mariusz](https://verificationacademy.com/forums/u/Mariusz)\
**Replies:** 7\
**Last updated:** [September 3, 2021, 5:32pm UTC](https://verificationacademy.com/forums/t/clock-monitoring/39509 "2021-09-03T17:32:38Z")

</div>

Hi, I have a clock uvm\_agent to control the clock. In uvm\_sequence\_item I can among other things determine how many cycles the clock should run. My DUT is a simple counter, it means output is dependent on how many cycle…

---

## [Asynchronous state machine with active negative edge](https://verificationacademy.com/forums/t/asynchronous-state-machine-with-active-negative-edge/39383)

<div class="topic-metadata">

**Author:** [@jake0041](https://verificationacademy.com/forums/u/jake0041)\
**Replies:** 1\
**Last updated:** [July 29, 2021, 5:29pm UTC](https://verificationacademy.com/forums/t/asynchronous-state-machine-with-active-negative-edge/39383 "2021-07-29T17:29:57Z")

</div>

\-2 I am writing a testbench for an asynchronous state machine in Verilog with active falling flank. My code is currently compiling but all the outputs are getting 0 values when they shouldn’t. Any help? Code: \`times…

---

## [Checking 60% duty cycle clock](https://verificationacademy.com/forums/t/checking-60-duty-cycle-clock/38748)

<div class="topic-metadata">

**Author:** [@bachan21](https://verificationacademy.com/forums/u/bachan21)\
**Replies:** 5\
**Last updated:** [March 16, 2021, 6:52am UTC](https://verificationacademy.com/forums/t/checking-60-duty-cycle-clock/38748 "2021-03-16T06:52:23Z")

</div>

I am asserting to check whether the clock is meeting 60% duty cycle using following code (The code is working for my intention) \`define PERIOD 10ns module tb; realtime TON = \`PERIOD \* 0.6; realtime TOFF = \`PER…

---

## [Clock precision setting](https://verificationacademy.com/forums/t/clock-precision-setting/38771)

<div class="topic-metadata">

**Author:** [@Mitu\_Raj](https://verificationacademy.com/forums/u/Mitu_Raj)\
**Replies:** 9\
**Last updated:** [March 6, 2021, 7:29am UTC](https://verificationacademy.com/forums/t/clock-precision-setting/38771 "2021-03-06T07:29:35Z")

</div>

I want to generate a 39.6 ns period clock from my test bench. The following code generates a 40 ns clock instead. Can anyone tell me what is the problem? How to fix this precision problem? I use Modelsim simulator. \`ti…

---

## [SVA to check clock toggling for a fixed number of cycles](https://verificationacademy.com/forums/t/sva-to-check-clock-toggling-for-a-fixed-number-of-cycles/38630)

<div class="topic-metadata">

**Author:** [@nimitz\_class](https://verificationacademy.com/forums/u/nimitz_class)\
**Replies:** 4\
**Last updated:** [January 23, 2021, 12:11am UTC](https://verificationacademy.com/forums/t/sva-to-check-clock-toggling-for-a-fixed-number-of-cycles/38630 "2021-01-23T00:11:29Z")

</div>

Hi, I’m trying to write assertions for sclk to be stable and toggling for 4 clock cycles before ack goes high and stable and toggling 8 clock cycles after ack goes low. ack goes high after req is asserted, so that’s the…

---

## [Clock cycles](https://verificationacademy.com/forums/t/clock-cycles/38523)

<div class="topic-metadata">

**Author:** [@Aashish\_Itani](https://verificationacademy.com/forums/u/Aashish_Itani)\
**Replies:** 1\
**Last updated:** [December 28, 2020, 4:46pm UTC](https://verificationacademy.com/forums/t/clock-cycles/38523 "2020-12-28T16:46:29Z")

</div>

@(posedge clk); @(negedge clk); Why does it wait for 2 clock cycles here? Is not that 1 clock cycle?

---

## [Write a Verilog code and test bench to generate Clock signal of frequency 'f ' and duty cycle 'd ' as per the requirement using only NAND gates](https://verificationacademy.com/forums/t/write-a-verilog-code-and-test-bench-to-generate-clock-signal-of-frequency-f-and-duty-cycle-d-as-per-the-requirement-using-only-nand-gates/38458)

<div class="topic-metadata">

**Author:** [@anon\_student](https://verificationacademy.com/forums/u/anon_student)\
**Replies:** 1\
**Last updated:** [December 13, 2020, 3:52pm UTC](https://verificationacademy.com/forums/t/write-a-verilog-code-and-test-bench-to-generate-clock-signal-of-frequency-f-and-duty-cycle-d-as-per-the-requirement-using-only-nand-gates/38458 "2020-12-13T15:52:48Z")

</div>

I have tried designing a code and testbench for the above question but my EPWave does not give me the desired output clock signals. I would highly appreciate it if someone could help me out by giving a prompt response. P…

---

## [SV Generate](https://verificationacademy.com/forums/t/sv-generate/37869)

<div class="topic-metadata">

**Author:** [@SUNODH](https://verificationacademy.com/forums/u/SUNODH)\
**Replies:** 1\
**Last updated:** [July 24, 2020, 3:37pm UTC](https://verificationacademy.com/forums/t/sv-generate/37869 "2020-07-24T15:37:34Z")

</div>

Do system Verilog support delays inside. Suppose I am using genvar to generate multiple clocks like below reg \[7:0\]clk; genvar i; generate for (i=0; i \< 7; i++) begin #1 clk\[i\]=~cl…

---

## [Output to a Text file](https://verificationacademy.com/forums/t/output-to-a-text-file/37668)

<div class="topic-metadata">

**Author:** [@nimesh13](https://verificationacademy.com/forums/u/nimesh13)\
**Replies:** 2\
**Last updated:** [June 4, 2020, 8:52pm UTC](https://verificationacademy.com/forums/t/output-to-a-text-file/37668 "2020-06-04T20:52:56Z")

</div>

I am trying to write a module that writes the values of all the signals into a text file. A value should be written at every positive edge of the clock. Now File cannot be opened without an initial statement and always b…

---

## [Advance time in uvm\_driver](https://verificationacademy.com/forums/t/advance-time-in-uvm-driver/37585)

<div class="topic-metadata">

**Author:** [@Sustrak](https://verificationacademy.com/forums/u/Sustrak)\
**Replies:** 5\
**Last updated:** [May 21, 2020, 11:41am UTC](https://verificationacademy.com/forums/t/advance-time-in-uvm-driver/37585 "2020-05-21T11:41:47Z")

</div>

Given the following code, located in the run\_phase of a uvm\_driver: task get\_and\_drive(); seq\_item\_port.get\_next\_item(trans); $display("DRIVER ISSUE: %p @%t", trans, $time); while(credits.is\_available() == …

---

## [Synchronization: Setting and Clearing a Value using Different Clocks/Processes](https://verificationacademy.com/forums/t/synchronization-setting-and-clearing-a-value-using-different-clocks-processes/37108)

<div class="topic-metadata">

**Author:** [@SparkyNZ](https://verificationacademy.com/forums/u/SparkyNZ)\
**Replies:** 5\
**Last updated:** [January 31, 2020, 7:39pm UTC](https://verificationacademy.com/forums/t/synchronization-setting-and-clearing-a-value-using-different-clocks-processes/37108 "2020-01-31T19:39:24Z")

</div>

My FPGA has 50Mhz clock (clk). From this clock I have a module that generates a 9600 baud clock (baudTick). UART\_BaudRate\_generator #(baudRate) BaudGen1( .Clk( clk ), .Tick( baudTick ) ); Every 50000000 clk cyc…

---

## [Beginner learning to make a Counter](https://verificationacademy.com/forums/t/beginner-learning-to-make-a-counter/35620)

<div class="topic-metadata">

**Author:** [@gainesy](https://verificationacademy.com/forums/u/gainesy)\
**Replies:** 4\
**Last updated:** [January 17, 2019, 9:19pm UTC](https://verificationacademy.com/forums/t/beginner-learning-to-make-a-counter/35620 "2019-01-17T21:19:50Z")

</div>

Hi All, I am teaching myself SystemVerilog and starting with a simple module and hope to add to it as a way to learn this program. I’m trying to make an LED blink for 0.5 secs (I just randomly chose this). For some reas…

---

## [Clk enable](https://verificationacademy.com/forums/t/clk-enable/35152)

<div class="topic-metadata">

**Author:** [@saraTelzer](https://verificationacademy.com/forums/u/saraTelzer)\
**Replies:** 1\
**Last updated:** [October 9, 2018, 9:11am UTC](https://verificationacademy.com/forums/t/clk-enable/35152 "2018-10-09T09:11:56Z")

</div>

Hi I added enable to clock in testbench initial begin//{ forever begin//{ if(spir180\_interfaces\_i.spi\_sigs.spi\_ce==1)begin//{ @(negedge spir180\_interfaces\_i.spi\_sigs.spi\_ce)begin//{ …

---

## [Assertion triggers on edge despite delay added](https://verificationacademy.com/forums/t/assertion-triggers-on-edge-despite-delay-added/34245)

<div class="topic-metadata">

**Author:** [@azmodael](https://verificationacademy.com/forums/u/azmodael)\
**Replies:** 4\
**Last updated:** [March 24, 2018, 7:32am UTC](https://verificationacademy.com/forums/t/assertion-triggers-on-edge-despite-delay-added/34245 "2018-03-24T07:32:25Z")

</div>

Hi there, can you help me understand what is going on? forever begin @(clk); #1ns; assert (X==Y) else 'uvm\_error() end This is a snipped of my code. The values of x and y update on every edge of clk. My expe…

---

## [Clock period absolute time](https://verificationacademy.com/forums/t/clock-period-absolute-time/33187)

<div class="topic-metadata">

**Author:** [@alexkidd84](https://verificationacademy.com/forums/u/alexkidd84)\
**Replies:** 6\
**Last updated:** [June 11, 2017, 3:23pm UTC](https://verificationacademy.com/forums/t/clock-period-absolute-time/33187 "2017-06-11T15:23:07Z")

</div>

Is there a way to get the clock period in absolute time (i meain in terms of seconds)? For example I have a realtime 6.4ns clock period (and timeunit is 1ns). Ho can I get this value in seconds? Alessandro

---

## [Blocking assignment for clock divider](https://verificationacademy.com/forums/t/blocking-assignment-for-clock-divider/32987)

<div class="topic-metadata">

**Author:** [@svishnu](https://verificationacademy.com/forums/u/svishnu)\
**Replies:** 5\
**Last updated:** [March 24, 2017, 1:50am UTC](https://verificationacademy.com/forums/t/blocking-assignment-for-clock-divider/32987 "2017-03-24T01:50:26Z")

</div>

I came across the following systemverilog coding guideline: guideline:Use blocking assignments for clock divider flip-flops. Sometimes non-blocking assignments create a race condition instead of preventing it. Can some…

---

## [Constraints based on posedge clock](https://verificationacademy.com/forums/t/constraints-based-on-posedge-clock/31947)

<div class="topic-metadata">

**Author:** [@Sharandiva](https://verificationacademy.com/forums/u/Sharandiva)\
**Replies:** 1\
**Last updated:** [June 14, 2016, 2:53pm UTC](https://verificationacademy.com/forums/t/constraints-based-on-posedge-clock/31947 "2016-06-14T14:53:23Z")

</div>

I am reading through a code written by a colleague, could someone please help me understand what it is supposed to be doing? I don’t know what the intent of this code is, there are no helpful comments. bit inject; fore…

---

## [How to pass clock to agent if interface does not have it](https://verificationacademy.com/forums/t/how-to-pass-clock-to-agent-if-interface-does-not-have-it/31455)

<div class="topic-metadata">

**Author:** [@bvyas](https://verificationacademy.com/forums/u/bvyas)\
**Replies:** 2\
**Last updated:** [March 19, 2016, 8:26pm UTC](https://verificationacademy.com/forums/t/how-to-pass-clock-to-agent-if-interface-does-not-have-it/31455 "2016-03-19T20:26:55Z")

</div>

Hi, We just started the using interface for RTL. The designers have created the interface files and DV guys are using that. These interfaces don’t have clocks. Nor in DV we use m\_vif.tb\_clk to drive and monitor dut. We…

---

## [Randomization on clock edge](https://verificationacademy.com/forums/t/randomization-on-clock-edge/31328)

<div class="topic-metadata">

**Author:** [@Sharandiva](https://verificationacademy.com/forums/u/Sharandiva)\
**Replies:** 3\
**Last updated:** [December 18, 2015, 3:10am UTC](https://verificationacademy.com/forums/t/randomization-on-clock-edge/31328 "2015-12-18T03:10:51Z")

</div>

My aim is to randomize a one bit variable on posedge of clock, such that value is 0 for 100 clocks and then 1 for one clock. This is the code I have: @(posedge pin\_if.clk); randomize(inject) with { inject dist { 1’b0…

---

## [How can I apply word clock jitter in UVM?](https://verificationacademy.com/forums/t/how-can-i-apply-word-clock-jitter-in-uvm/31251)

<div class="topic-metadata">

**Author:** [@owenjarvie](https://verificationacademy.com/forums/u/owenjarvie)\
**Replies:** 1\
**Last updated:** [December 2, 2015, 11:09am UTC](https://verificationacademy.com/forums/t/how-can-i-apply-word-clock-jitter-in-uvm/31251 "2015-12-02T11:09:41Z")

</div>

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 edg…

---

## [How to model a bus behavior with enable signal in testbench](https://verificationacademy.com/forums/t/how-to-model-a-bus-behavior-with-enable-signal-in-testbench/30986)

<div class="topic-metadata">

**Author:** [@C.C.Chen](https://verificationacademy.com/forums/u/C.C.Chen)\
**Replies:** 3\
**Last updated:** [September 14, 2015, 3:25pm UTC](https://verificationacademy.com/forums/t/how-to-model-a-bus-behavior-with-enable-signal-in-testbench/30986 "2015-09-14T15:25:37Z")

</div>

If a bus with data and enable asychronous to clock, is it correct to write as follows to catch data from DUT ? @(posedge clock) if(enable) bfm\_data = data ; If enable is rising or falling, what’s the result of if(ena…
