2. I use default initializers (increments) for Sample and BitPos because I
need this increment in most branches
OK. If you wish to use variables in the process you can easily
work around this by adding another set of variables that
are used to hold the "old" value:
if rising_edge(clk) then
oldState := state;
synchOutput <= '0';
state := <default new state assignment>;
case oldState is
... [possible new state assignments]
endcase
case state is
when Special_Case =>
synchOutput <= '1';
endcase
3. Using variables does not change the sense, you are just showing one
approach of "concurrent block assignment" I referred. The problem of logic
doubling is not clarified.
I disagree. By using variables in the process, you have access
to the *next-state* value of the process's registers. If you
make use of those next-state values within the same process,
you have *not* duplicated any logic in the code, and your
synthesis tool will probably be able to share the common logic.
Let me state it again. "(BitPos=7) and (Sample=9)" signal is used twice,
i.e.
(a) asserting 0 to BitPos and Sample;
// on clock
if Sample = 7 then
case BitPos of
0: ...
9: BitPos := 0; Sample := 0; --here
else ...
end case;
....
end if;
and
(b) assigning AVAL.
AVAIL <= (BitPos=7) and (Sample=9);
Yes, I agree I coded the example in a poor way. Sorry.
It would have been better if I had used the "old state"
arrangement. Then I could easily have made the assignment
to AVAIL within the same branch of the case statement.
(I didn't do that because I was a little unsure of the
exact functionality you require. But I hope you now
can see what I mean.)
The question is: will synthesis tool recognize and reuse logic once
generated for calculation of "(BitPos=7) and (Sample=9)" signal?
Alternatively,will it generate the same logic twice?
Common expressions within the same process *should* be
eliminated by the synthesis tool, but of course there are
plenty of situations where tools can get confused. The only
sensible approach is to try some test cases on the synthesis
tool you actually use.
Hope my question now is quite "fundamental" and clear.
Perfectly clear; I'm sorry my original answer was less so.
--
Jonathan Bromley, Consultant
DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * Perl * Tcl/Tk * Verification * Project Services
Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail: (e-mail address removed)
Fax: +44 (0)1425 471573 Web:
http://www.doulos.com
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.