It is legal VHDL (saving, as others have noted, RegNext := '0' as
it's declared a variable).
However, it likely isn't synthesisable. If you split it into 2 parts,
each performs a clearly defined action, & the synthesiser can see what
you mean. Of course, RegNext is then a signal.
Bear in mind that most synthesisers work by matching your code to a
list of templates: when they find a match, that defines the code they
produce. If you write "creative" VHDL, it may be syntactically OK, but
it won't match a template, & the synthesiser will fail.
Get a copy of the "Libraries Guide" and "XST User's Guide" from
www.xilinx.com - they contain examples of the proper code to use to
infer each of the Xilinx hardware primitives. Of course, these are
specific to XST (the Xilinx tool), but the principles are general.
"valentin tihomirov" <> wrote:
:Is it a good style to write code like the following
:

rocess (CLK, Reset)
:variable RegNext: STD_LOGIC;
:begin
: -- comb part
: RegNext := calculate();
:
: -- reg part
: if Reset = '1' then
: RegNext <= '0';
: elsif CLK'event and CLK = '1' then
: REG <= RegNext;
: end if;
:end.
:

???
:
:I've asked this question to myself trying to define the sensetivity list and
:type (signal vs. variable) of RegNext value. This style would allow for
:combining related logic into one process rather than divide one process into
:comb and reg declaring lots ot specific signals at architecture scope.
: