On Sat, 5 Feb 2005 17:33:54 +0100,
"M.Randelzhofer" <> wrote:
>Normally i use a sequential process to built a shift register for edge
>detection:
>
>process (clock)
>begin
> if (clock'event and clock ='1') then
> shift(0) <= signal ;
> shift(1) <= shift(0) ;
> end if ;
> rise <= not shift(1) and shift(0) ;
> fall <= shift(1) and not shift(0) ;
>end process;
Many synthesis tools will reject this process,
because the assignments to "rise" and "fall"
are performed both on rising and on falling edges
of the clock. Consider splitting it into two
processes, one synchronous and one combinational.
>Now i would like to use a procedure as a subprogram, to simplify the code
>for lots of such situations.
[...]
A subprogram is called by some other sequential code, executes
for a certain length of time, and then terminates and returns
to its calling code.
A process starts executing at time zero, and then runs forever
as an independent piece of activity.
It would make no sense to bury your process in the middle
of another process, so equally it makes no sense to try to
call a subprogram to do the same thing.
The obvious way to modularise this kind of thing is by
building an entity to contain it, and then instantiating
the entity. However, there is another possibility that
is sometimes neater: use a concurrent procedure. This
is simply a way of packaging a process so that you can
"instantiate" it, but without the extra overhead of
defining a component and so on. However, a concurrent
procedure effectively becomes a process, and so it would
have the same problem that I pointed out for your
original process - it's a synchronous process with
combinational outputs, and therefore should not be
described as a single process for synthesis.
--
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, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail:
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.