C
Chuck Roth
Guest
The following code simulates and synthesizes without any problem:
entity proctest is
port(A: inout positive range 1 to 15; clk: in bit);
end proctest;
architecture Behavioral of proctest is
signal St: positive range 1 to 15;
begin
process(clk)
procedure P1 is
begin A <= A+1; end P1;
procedure P2 is
begin A <= A+2; end P2;
begin
if clk'event and clk = '1' then
if St = 1 then P1; end if;
if St = 2 then P2; end if;
if St = 3 then P1; end if;
St <= St+1;
end if;
end process;
end Behavioral;
If I move the procedure declarations from the process to the architecture
declaration section, I get syntax error messages: "cannot drive signal A in
procedure P1".
Why? I thought procedures declared in the architecture would be global to
all processes. When is it okay to declare procedures in the architecture
and when is it not?
-- C. H. Roth
entity proctest is
port(A: inout positive range 1 to 15; clk: in bit);
end proctest;
architecture Behavioral of proctest is
signal St: positive range 1 to 15;
begin
process(clk)
procedure P1 is
begin A <= A+1; end P1;
procedure P2 is
begin A <= A+2; end P2;
begin
if clk'event and clk = '1' then
if St = 1 then P1; end if;
if St = 2 then P2; end if;
if St = 3 then P1; end if;
St <= St+1;
end if;
end process;
end Behavioral;
If I move the procedure declarations from the process to the architecture
declaration section, I get syntax error messages: "cannot drive signal A in
procedure P1".
Why? I thought procedures declared in the architecture would be global to
all processes. When is it okay to declare procedures in the architecture
and when is it not?
-- C. H. Roth