Altera_Forum
Honored Contributor
9 years agovariable initialization help
Hi all,
For a process, the variable only take the initial value at the first time the process is running, then it will take the last value of that variable. I am wondering how can I initial the variable every time the process is executed? For example, if I want to do something like following
ENTITY example IS
PORT (
......
InitVal : IN INTEGER; -- initial value
......
);
ARCHITECTURE rt OF example IS
......
PROCESS (...)
VARIABLE v1 : INTEGER := InitVal;
BEGIN
if (v1 < 100) then
v1 := v1 + 1;
end if;
......
END PROCESS;
END ENTITY;
InitVal is the integer input from upper level module, I want the variable v1 has the value of InitVal every time the process is executed. What can I do in this case? Many thanks for the help.