Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - state machine description

 
Thread Tools Search this Thread
Old 03-23-2006, 12:52 PM   #1
Default state machine description


Hi,

When checking some condition which is responsible for jumping
back to some known state within a state machine
I have done the following :

process(rst, clk)
begin
if rst='1' then
ls_state <= s_ini;

elsif rising_edge(clk) then

case ls_state is

...
when s_0 =>
...
if ls_condition='1' then
ls_state <= s_known;
end if;
when s_1 =>
...
if ls_condition='1' then
ls_state <= s_known;
end if;
when s_2 =>
...
if ls_condition='1' then
ls_state <= s_known;
end if;
...
end case;
end if;
end process;


Can the FSM be replaced with the following description ?

process(rst, clk)
begin
if rst='1' then
ls_state <= s_ini;

elsif rising_edge(clk) then

case ls_state is
...
when s_0 =>
...
when s_1 =>
...
when s_2 =>
...
end case;

if ls_condition='1' then
ls_state <= s_known;
end if;

end if;
end process;

Thank you for your comments.

Rgds
André



ALuPin@web.de
  Reply With Quote
Old 03-23-2006, 03:32 PM   #2
Mike Treseler
 
Posts: n/a
Default Re: state machine description
wrote:

>
> Can the FSM be replaced with the following description ?

....
> end case;
>
> if ls_condition='1' then
> ls_state <= s_known;
> end if;


Yes. Same logic, easier to read.

-- Mike Treseler


Mike Treseler
  Reply With Quote
Old 03-24-2006, 11:14 AM   #3
KJ
 
Posts: n/a
Default Re: state machine description
Another way to write it is what is listed below. In my opinion, it
more clearly represents what you're trying to express which is that if
'ls_condition = 1' then you want to go to a known state and there is no
point evaluating the case statement.

Either way will synthesize to exactly the same output so it becomes
somewhat of a style issue more than anything.

process(rst, clk)
begin
if rst='1' then
ls_state <= s_ini;


elsif rising_edge(clk) then

if ls_condition='1' then
ls_state <= s_known;
else
case ls_state is
...
when s_0 =>
...
when s_1 =>
...
when s_2 =>
...
end case;
end if;
end if;
end process;



KJ
  Reply With Quote
Old 03-24-2006, 01:16 PM   #4
ALuPin@web.de
 
Posts: n/a
Default Re: state machine description
Hi Mike, KJ,

thank you for your comments.

Rgds
André



ALuPin@web.de
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
combinational lock state machine harikanth General Help Related Topics 0 04-06-2009 05:38 AM
Using BRAM in state machines zoki111 Hardware 0 09-18-2007 09:38 AM
Judge: File-swapping tools are legal Citizen Bob DVD Video 140 11-08-2006 06:42 PM
BUSH WILL LIKELY INSTALL A DRAFT Jas DVD Video 165 10-20-2004 09:39 PM
Re: Can't login to XP Pro machine Gary A+ Certification 3 09-22-2004 10:17 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46