two clock,one is clocka, the other is clockb
i don't know the frequency of them
if the frequency of clocka is higher than that of clockb, output is '1'
how to implement it in verilog?
count the rising edges of each clock. First to reach a preset count is highest frequency.
There may be other ways, but that should work, and if you know the basics of verilog it should be easy to code.
Hi... think my solution could be simple... have a n-bit counter for both the clocks...start the both the counters at the same time... whenever overflow occurs in any one of the counter reset both the counters... the colck which leads to overflow is the fastest...this overflow could be used to set a flip-flop so that the faster clock will be known until another overflow occurs...
create 2 counter, let the counter count until 10(or some number but must larger than 2 because 2 clock may not triger at the same time) and then compare the 2 counters output value to determine which 1 is larger .
if (clka'event and clka = 1) then
cntra <= cntra + 1;
end if;
if (clkb'event and clkb =1) then
cntrb <= cntrb +1;
end if;
if (cntra == 10 and cntra < cntrb) then
output <= 1;
// reset cntr logic
end if;