How to use a single variable in more than one process…!!
VHDL87 limited the scope of the variable to the process in which it was declared. Signals were the only means of communication between processes, but signal assignments require an advance in either delta time or simulation time.
VHDL '93 introduced shared variables which are available to more than one process. Like ordinary VHDL variables, their assignments take effect immediately. However, caution must be exercised when using shared variables because multiple processes making assignments to the same shared variable can lead to unpredictable behavior if the assignments are made concurrently. The VHDL ‘93 standard does not define the value of a shared variable it two or more processes make assignments in the same simulation cycle.
The syntax of the shared variable is similar to that of the normal variable. However, the keyword SHARED is placed in front of VARIABLE in the declaration
Example:
Architecture SV_example of example is
shared variable status_signal : bit;
begin
p1 : process (Clock,In1)
begin
if(status_signal) then
...
end if;
status_signal :='0';
end process;
p2 : process (Clock,In2)
begin
if(!(status_signal)) then
....
end if;
status_signal:='1';
end process p2;
end SV_example;
Above example shows the use of shared variable in more than one process.
No comments:
Post a Comment