Hi!
Your question is not clear. As with most digital ICs the clock source is connected to a IC pin externally (the case with FPGAs) or is available internally (as in many CPUs). So you already have a clock.
* If you will use the clock for synthesis - in your circuit, then you can write (here in Verilog):
- Code: Select all
always @(posedge clk)
begin
// your code here
end
which means: Everytime a positive edge of the clock signal 'clk' is detected - evaluate your code. The clock signals acts as an event and you should 'check' for this event to occur.
* If you want to generate a testbench, then you can write (Verilog again):
- Code: Select all
always #1 clk = ~clk
This is actually a clock generator that cannot be synthesized but only simulated. It means: Always, at every 1-time-unit (this is #1), invert the clock signal 'clk' and assign it to itself - that is in fact to toggle the clock. The time unit can be specified using the 'timescale' directive that must be put at the very beginning of the testbench file.
Hope this helps.
And, please, do not repeat your question in more that one forum thread at a time
Yassen