1. Define an input for the clock signal
Code:inout clk;
electrical clk;
2. Create an event that checks for the clock's edges:
Code:@(cross(V(clk) - thresh, +1)) begin
count = (count > max_count) ? 0 : count + 1;
outval = (count == 0);
end
3. Contribute a value calculated in the event statement to the output
Code:V(out) <+ outval;
Hope this helps,
Marq