even or odd

C

crazyrdx

If I need to check whether I have an even clock cycle or odd, how can I
do it? should I use a counter? If using a counter, do I %2 it to check
if it returns 0 or 1? Is there an easier way to check for even or odd
clock cycles?

thanks
 
Z

Zara

crazyrdx said:
If I need to check whether I have an even clock cycle or odd, how can I
do it? should I use a counter? If using a counter, do I %2 it to check
if it returns 0 or 1? Is there an easier way to check for even or odd
clock cycles?

thanks
Yes, use a T type flip flop. Thjis is a flip flop that toggles every
clock cycle, and may be created with any primitive flip flop type.

And, in a HW independent manner:

process(reset,clock)
begin
if reset='1' then
state<='0';
elsif rising_edge(clock) then
state<=not state;
end if;
end process;
output<=state;

If you fill in the holes left, you will have a full functioning, optimal
"odd-even" cycle detector.

Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top