Lothar M. wrote:
> bumo wrote:
>> Is there some other kind of design pattern to deal with this problem?
> Your problem is namend "latency".
> And it can simply be solved: just manipulate the counter value in a
> manner that it gets a useful value when leaving the previous state.
Maybe i don't get it, but "manipulating the counter" for the next state
cannot work when it is clocked. Let's consider the following example:
1 | -- register
|
2 | process (clk, rst) is
|
3 | begin
|
4 | if rst = '0' then
|
5 | ...
|
6 | elsif rising_edge(clk) then
|
7 | state <= next_state;
|
8 | cnt <= next_cnt;
|
9 | ...
|
10 | end if;
|
11 | end process;
|
12 |
|
13 | -- fsm
|
14 | process (..., cnt) is
|
15 | begin
|
16 | case state is
|
17 | when current =>
|
18 | if cnt > limit then
|
19 | next_state <= next;
|
20 | next_cnt <= (others => '0');
|
21 | else
|
22 | next_cnt <= cnt + 1;
|
23 | end if;
|
24 | when next =>
|
25 | if cnt > smaller_limit then
|
26 | ...
|
27 | ...
|
When the condition cnt > limit is reached, next_cnt will be reset, but
since the next state will be set also, the condition cnt > smaller_limit
is true for the first clk cycle...
> BTW:
> I moved your English question from the German to the English forum.
> If you want to post in the German forum pls. write German...
sorry for that.