Rob wrote:
> Unfortunately, the restriction is to use only one process with a clock.
> I want the counter to count on both the edges.
don't mix the things. You raise two new topics and probable have not yet
understood the problem of the code you showed in the beginning.
Having only one process with a clock is fine. Then everything, which
must be stored in flipflops, has to be assigned inside that process.
But the process you showed in the beginning has no clock at all. Try to
imagine, how fast ctr_r tries to count upwards (cause it has no clock
that defines the pace of the counter).
Having a Counter which counts on both clock edges is in general not
fine: it works only in those very special cases, where the hardware
supports dual edge triggerd Flipflops. Most hardware does not support
this.
But it's a different thing, if you have a fast clock and count the
transistions (rising and falling) of a slower input signal: that can be
done without problems by an edge detection.