Jim Lewis said:
With one process all output of the process are registered.
Mike Tressler would disagree with this statement for sure. You can use
variables and create combinatorial outputs. Personally I don't use this
technique but it does work.
With two process, you have a choice as to whether to
register your outputs or not. As you found out this
added flexibility has a hazard of potentially creating
latches. You can avoid this by initializing all of your
outputs to a default state. As Jonathan points out in
a later thread, two process also has the hazard of
creating combinational logic feedback with multiple
statemachines handshaking.
The two process style causes you to
- Write more code (2 process style will always have more statements than 1
process), more chances for error.
- Manually check (this means you, not the machine) for coding errors that
will cause the simulation to behave differently than the synthesized version
and yet both will run to completion without an 'error'. This is caused by
things like: incomplete sensitivity lists and unhandled cases in the
combinatorial process which creates latches). None of this happens with the
one process approach. Combinatorial outputs should live either in
concurrent statements outside the process or, using Mike's style, as
assignments at the very end of the process after all of the variables have
been updated.
With a one process, if you need combinational logic
you can easily add it with code outside of the process.
In this case, however, it becomes as much like a two
process as a one process.
In a theoretical sense "becoming much like a two process" is true...the
other way to look at it is that the statements that are outside the 'one
process' are the combinatorial outputs, the ones that are inside are
clocked...and many times simply glancing at the code to discern this is
almost all you need to debug some problem. For example, when you look at
the signal assignment being made in the clocked process and immediately know
why it is happening one clock cycle too late in the simulation.
Personally I tend to break up my 'one process' into multiple processes all
clocked by the clock and have all the combinatorial stuff outside all of the
processes in concurrent statements. The multiple processes all clocked by
the clock signal while not strictly necessary allows for physical grouping
of 'related' signals into chunks of code that are easier to read since they
will tend to fit on a screen as opposed to a single monolithic process where
one may have to page back and forth when reviewing the code to debug some
problem. In any case, my multiple clocked processes are one virtual process
so I definitely come down in the 'one process' camp.
I never thought three process statemachines made any sense.
A three process statemachine is like have one bubble diagram
for the present state - next state transitions and a separate
bubble diagram for output logic. If you like this, then
go for it.
In the end all techniques seem to produce reasonable results.
So find the one that suits you.
That's some bum advice. I'll accept that some people for whatever reasons
prefer the two process approach (and maybe three who knows) but the one
process approach is superior from the standpoint of designer productivity.
I contend that the new person starting out would end up being more
productive (i.e. working and tested lines of code per time period) with the
one process approach because of the two fundamental drawbacks I mentioned
earlier regarding the two process approach (more code and manual checks).
I'd even go so far as to say that a fair percentage (probably not all
though) of those who today prefer the two process method would be more
productive if they changed their mindset and tried the one process way and
worked on it a bit and gave it a chance. I base this on comments seen here
and elsewhere of people that have converted from two process to one process
and said how much easier it now seems and NEVER having seen a report of
anyone switching from one process to two process and making the same claim.
The two process people seem to prefer that approach because either that is
the way they were trained and they are now 'used to it', or the company they
work for requires it for reasons that even the two process poster admits he
does not understand...but he values his job soooo.....
So even though either approach produces 'reasonable results', I don't think
you toss out designer productivity as being a reason to not prefer the one
process method to the newbie.
I don't like one process as it does not work well for all
people. I have worked on projects where someone inherited
a one process statemachine and was unable to effectively
maintain it. As a result it was an issue.
I'm betting that this was the monolithic one process approach. The virtual
one process where you try to group 'related' things together to create
clocked processes that all fit on a screen would've helped. Having the
single monolithic process tends to cause people to put many unrelated things
together where they are not really appropriate (but it does 'work'...under
certain conditions). In any case, what you've described is totally
unrelated to one or two process...it was simply poorly written (but probably
at one time working) code. It would've been just as unsupportable if the
person that wrote that used two processes because the person that wrote the
code didn't have a sense of how to write clean code. Clear thinkers can
write clearly.
Kevin Jennings