Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

comparing clock counts

Status
Not open for further replies.

kcinimod

Member level 3
Joined
Dec 19, 2011
Messages
63
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,714
Hi,

i need to program a system that compares the number of clock cycles. The input is a single pulse generated at random timings, i would like to compare the number of clock cycles (between 1st pulse and 2nd pulse) with (those between 2nd pulse and 3rd pulse). i have already programmed a single counter to count number of cycles between each interval, however, i'm facing problems with comparing them. Any ideas how i should go about doing it ?
 

You want to compare the actual value of the counter with the previous one.
This is an hint that you need to store the old value in a register.
So, at each pulse, you perform two operations:
- compare CNT to CNT_PREVIOUS
- store CNT in CNT_PREVIOUS

P.S. I assume that your system is synchronous and that the random pulse is exactly one clock tic wide.
 
You want to compare the actual value of the counter with the previous one.
This is an hint that you need to store the old value in a register.
So, at each pulse, you perform two operations:
- compare CNT to CNT_PREVIOUS
- store CNT in CNT_PREVIOUS

P.S. I assume that your system is synchronous and that the random pulse is exactly one clock tic wide.

thx for the advice, can this register be programmed within the same counter process ? or should another entity/component be used ?
 

There's no need to introduce other entities.
You can put the register inside the same process of the counter or in a separate process in the same architecture - just a matter of preferred style.
P.S. remember to reset the register
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top