Reputation: 11
I am trying to verify a flash-based design using Cocotb (a Python-based framework) which I am new to it. I have always used verilog, SystemVerilog in the past. I am trying to generate the clock for a testbench.
I have tried going through the documentation. I see in the cocotb website where they have a clock class. I also see that I can use,something like, cocotb.fork(clock(dut.clk,5000).start())
to generate the clock.
def directed_test(dut):
cocotb.fork(Clock(dut.clk, 1000).start())
Is that all I need to do to generate a clock? The class Clock available on the cocotb documentation, should I simply import it and generate the clock by writing a statement as above inside a coroutine ?
Any help is much appreciated.
Learner.
Upvotes: 0
Views: 2207
Reputation: 503
Exactly, that's all you need. Replace the clk
in dut.clk
with the name of your clock signal if needed.
It's also nice to specify the units
option, see https://cocotb.readthedocs.io/en/latest/library_reference.html#cocotb.clock.Clock
Upvotes: 1