On May 16, 12:42 am, "Legalex"
<
andreiopariuc@n_o_s_p_a_m.n_o_s_p_a_m.gmail.com> wrote:
> >this should be a 4 bit down counter with asyncronous reset(0 active),with
> >an enable that plays the role of a 'start' for the counter(that's why I
> >chose to change the value of "a" depending on enable because enable isn't
> >always "1"->in my project enable= out_of_a_clock_devider & out of a DFF
> >which has as inputs "start" and "stop")
> >I just can't make this counter work..in modelsim everything is fine...
> >If anyone knows how to fix it..please help me...
>
> >---------------------------------------
> >Posted throughhttp://
www.FPGARelated.com
>
> I forgot to say that when I reset it, the counter has to take the preset
> value and start countering from that value - that's why I have a preset
> there.
>
> ---------------------------------------
> Posted throughhttp://
www.FPGARelated.com
Does your target device allow presetting to a variable (non-constant)
value? (probably not).
Follow the templates in the user guide, at least until you get a
better idea of what works and what does not.
Your enable and reset logic is messed up. Think about priorities of
inputs. (e.g. highest priority is reset, second is (clocked) enable,
etc.) Code accordingly (e.g. if-else). For example, you reset, but
then you run other code that affects those same outputs, negating the
effect of reset.
When you say it is fine in modelsim, did you actually simulate it
(thoroughly) and the results are good, or did you just compile it?
This is not a language issue (modelsim compiles it), it is an issue
where you are not properly describing the behavior of hardware that
can be constructed in your target FPGA.
Andy