J
Joerg Ritter
Guest
hi,
please consider the following recusive description of a component
calculating the flags 'a', 'p' and 'g' of an Ladner/Fisher-like adder.
This code is working and was validated using a VHDL-Simulator.
Lets exchange the part
POSTPROCESSING_B:
for i in n/2-1 downto 0 generate
flag_out(2*i+1) <= f_rec_out(i);
end generate;
with a process like this
process(f_rec_out)
begin
for i in n/2-1 downto 0 loop
flag_out(2*i+1) <= f_rec_out(i);
end loop;
end
This results in more then one drivers per signal for flag_out. It seems
to be, that the process doesnt use the flag_out signal at the specific
recursion level, instead assigns always to the port flag_out at the top
level.
Could anybody give a meaningful explanation ?
Thanks
Joerg
library IEEE;
library WORK;
use IEEE.std_logic_1164.all;
use WORK.apg_arithmetic.all;
entity flag_comp is
generic (n: positive);
port
(flag_in: in apg_vector (n-1 downto 0);
flag_out: out apg_vector (n-1 downto 0));
end flag_baustein;
architecture parallel_adder of flag_comp is
component con
port (l, r: in apgType;
flag_out: out apgType);
end component;
component flag_comp
generic (n: positive);
port (flag_in: in apg_vector (n-1 downto 0);
flag_out: out apg_vector (n-1 downto 0));
end component;
begin
rekursion: if n>2 generate
signal f_rec_out,f_rec_in: apg_vector (n/2-1 downto 0);
begin
PREPROCESSING:
for i in n/2-1 downto 0 generate
CON_CELL_1: con
port map (l => flag_in(2*i+1), r => flag_in(2*i),
flag_out => f_rec_in(i));
end generate;
RECURSIVE_CELL: flag_comp
generic map (n/2)
port map (flag_in => f_rec_in, flag_out => f_rec_out);
POSTPROCESSING_COMP:
for i in n/2-2 downto 0 generate
CON_CELL_2: con
port map (l => flag_in(2*i+2), r => f_rec_out(i) ,
flag_out => flag_out(2*i+2));
end generate;
POSTPROCESSING_B:
for i in n/2-1 downto 0 generate
flag_out(2*i+1) <= f_rec_out(i);
end generate;
flag_out(0) <= flag_in(0);
end generate;
stop_recursion2:
if n=2 generate
CON_CELL_3: con
port map (l => flag_in(1), r => flag_in(0),
flag_out => flag_out(1));
flag_out(0) <= flag_in(0);
end generate;
stop_recursion1: if n=1 generate
flag_out(0) <= flag_in(0);
end generate;
end parallel_adder;
please consider the following recusive description of a component
calculating the flags 'a', 'p' and 'g' of an Ladner/Fisher-like adder.
This code is working and was validated using a VHDL-Simulator.
Lets exchange the part
POSTPROCESSING_B:
for i in n/2-1 downto 0 generate
flag_out(2*i+1) <= f_rec_out(i);
end generate;
with a process like this
process(f_rec_out)
begin
for i in n/2-1 downto 0 loop
flag_out(2*i+1) <= f_rec_out(i);
end loop;
end
This results in more then one drivers per signal for flag_out. It seems
to be, that the process doesnt use the flag_out signal at the specific
recursion level, instead assigns always to the port flag_out at the top
level.
Could anybody give a meaningful explanation ?
Thanks
Joerg
library IEEE;
library WORK;
use IEEE.std_logic_1164.all;
use WORK.apg_arithmetic.all;
entity flag_comp is
generic (n: positive);
port
(flag_in: in apg_vector (n-1 downto 0);
flag_out: out apg_vector (n-1 downto 0));
end flag_baustein;
architecture parallel_adder of flag_comp is
component con
port (l, r: in apgType;
flag_out: out apgType);
end component;
component flag_comp
generic (n: positive);
port (flag_in: in apg_vector (n-1 downto 0);
flag_out: out apg_vector (n-1 downto 0));
end component;
begin
rekursion: if n>2 generate
signal f_rec_out,f_rec_in: apg_vector (n/2-1 downto 0);
begin
PREPROCESSING:
for i in n/2-1 downto 0 generate
CON_CELL_1: con
port map (l => flag_in(2*i+1), r => flag_in(2*i),
flag_out => f_rec_in(i));
end generate;
RECURSIVE_CELL: flag_comp
generic map (n/2)
port map (flag_in => f_rec_in, flag_out => f_rec_out);
POSTPROCESSING_COMP:
for i in n/2-2 downto 0 generate
CON_CELL_2: con
port map (l => flag_in(2*i+2), r => f_rec_out(i) ,
flag_out => flag_out(2*i+2));
end generate;
POSTPROCESSING_B:
for i in n/2-1 downto 0 generate
flag_out(2*i+1) <= f_rec_out(i);
end generate;
flag_out(0) <= flag_in(0);
end generate;
stop_recursion2:
if n=2 generate
CON_CELL_3: con
port map (l => flag_in(1), r => flag_in(0),
flag_out => flag_out(1));
flag_out(0) <= flag_in(0);
end generate;
stop_recursion1: if n=1 generate
flag_out(0) <= flag_in(0);
end generate;
end parallel_adder;