Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Writing state machine output signals.

Reply
Thread Tools

Writing state machine output signals.

 
 
Fred Bartoli
Guest
Posts: n/a
 
      12-18-2004
Hello,

I now have a complex behavioral model that I'm rewriting in order to make
the RTL model and I have a complex state machine (1 process SM style).


Here's an excerpt for one state :

case CellState is
when Idle =>
..
..
..

when Wait_CluTOT =>
if IsBoundaryCell = '1' then
IsHighest_TOT := true;
TOT_Out <= TOT;
if IsSigCell = '0' then
CellResolved <= '1';
end if;
CellState := Resolve_TOT;
end if;
if (ResolveCell = '1') then
if HighTOT then
IsHighest_TOT := true;
StopNextCells <= '1';
TOT_Out <= TOT;
else
TOT_Out <= TOT_In;
end if;
if IsSigCell = '0' then
CellResolved <= '1';
end if;
CellState := Resolve_TOT;
end if;

..
..
..
when...

end case;

Apart from cleaning up the code and make it maybe more readable, I'm
wondering what is the best writing style for the outputs updating :
update one output after another and duplicate conditions, and then update
the state,
or
write the conditions and duplicate the states and outputs updates, as it is
written?

Does this have an impact on the final result or does the synthesizers do a
good job of optimizing all this ?
I ask this mainly because the overall state machine is about 140 LUTs and I
have 256 of those in my design.

Any input/comments/thought appreciated.


--
Thanks,
Fred.


 
Reply With Quote
 
 
 
 
Mike Treseler
Guest
Posts: n/a
 
      12-18-2004
Fred Bartoli wrote:

> Apart from cleaning up the code and make it maybe more readable, I'm
> wondering what is the best writing style for the outputs updating :
> update one output after another and duplicate conditions, and then update
> the state, or
> write the conditions and duplicate the states and outputs updates, as it is
> written?


Looks ok to me, but you only show one case.
Unless a condition is repeated in every case,
you can't pull it out, but you might tidy
up using functions and/or procedures.

Sometimes it makes sense to set an output
in one state/condition, clear it in another
and don't mention it otherwise.

But don't start cleaning up until you've
run a sim to see that it is running
like you expect.

> Does this have an impact on the final result


Order only matters with variable values.
If you get this wrong, you will see it
in simulation. Otherwise it's style.
For complicated outputs, I declare
a process variable, say my_out_v, update
that through the cases, then do a
my_out <= my_out_v;
at the end of the process.

> or does the synthesizers do a
> good job of optimizing all this ?
> I ask this mainly because the overall state machine is about 140 LUTs and I
> have 256 of those in my design.


Generally yes, a very good job.
But don't listen to me, try it and see.

> Any input/comments/thought appreciated.


Read this:
http://www.designabstraction.co.uk/HTML/articles.htm

-- Mike Treseler

 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
State machine - Vending machine - strange behaviour fenster VHDL 3 12-23-2011 09:53 AM
How to print a state flow graph for a state machine using Xilinx ISE or ModelSim Weng Tianxiang VHDL 3 07-25-2006 01:19 PM
What is the state of state machine after power-up without reset conditions Weng Tianxiang VHDL 7 11-25-2003 06:24 PM
State machine: how to stay in a state? David Lamb VHDL 1 09-15-2003 05:24 PM



Advertisments