bug u barrel.vhd
barrel.vhd koji je raspoloziv na sajtu za vlsi -> ispitni zadaci ima jedan
ozbiljan problem. ukoliko se prosledi depth parametar sa vrednoscu 1 onda ne
prodje prevodjenje zato sto je niz vektora out_ver_hor deklarisan sa
indeksom 0 to depth - 2, a cak i kad bi prosao prevodjenje ne bi radio jer
samo generate naredba last_line povezuje izlazni port barrel shifter-a
data_out a ona se ne izvrsava nikad ako je depth = 1. ispravno resenje bi
bilo:
architecture structural of barrel is
component mux_2 is
port (
data_in1,
data_in2,
sel : in std_logic;
data_out: out std_logic
);
end component mux_2;
type array_of_vectors is array (-1 to depth-1) of
std_logic_vector(width-1 downto 0);
signal out_ver_hor: array_of_vectors;
begin
out_ver_hor(-1)(width - 1 downto 0) <= data_in(width - 1 downto 0);
data_out(width - 1 downto 0) <= out_ver_hor(depth - 1)(width - 1 downto 0);
vertical: for ver in 0 to depth-1 generate
begin
horizontal: for hor in width-1 downto 0 generate
begin
mux: mux_2
port map (
data_in1 => out_ver_hor(ver-1)(hor),
data_in2 => out_ver_hor(ver-1)((width + (2**ver + hor)) mod width),
data_out => out_ver_hor(ver)(hor),
sel => shift(ver)
);
end generate horizontal;
end generate vertical;
end architecture structural;
ozbiljan problem. ukoliko se prosledi depth parametar sa vrednoscu 1 onda ne
prodje prevodjenje zato sto je niz vektora out_ver_hor deklarisan sa
indeksom 0 to depth - 2, a cak i kad bi prosao prevodjenje ne bi radio jer
samo generate naredba last_line povezuje izlazni port barrel shifter-a
data_out a ona se ne izvrsava nikad ako je depth = 1. ispravno resenje bi
bilo:
architecture structural of barrel is
component mux_2 is
port (
data_in1,
data_in2,
sel : in std_logic;
data_out: out std_logic
);
end component mux_2;
type array_of_vectors is array (-1 to depth-1) of
std_logic_vector(width-1 downto 0);
signal out_ver_hor: array_of_vectors;
begin
out_ver_hor(-1)(width - 1 downto 0) <= data_in(width - 1 downto 0);
data_out(width - 1 downto 0) <= out_ver_hor(depth - 1)(width - 1 downto 0);
vertical: for ver in 0 to depth-1 generate
begin
horizontal: for hor in width-1 downto 0 generate
begin
mux: mux_2
port map (
data_in1 => out_ver_hor(ver-1)(hor),
data_in2 => out_ver_hor(ver-1)((width + (2**ver + hor)) mod width),
data_out => out_ver_hor(ver)(hor),
sel => shift(ver)
);
end generate horizontal;
end generate vertical;
end architecture structural;
Previous by date: Re: U vezi domaceg...
Next by date: automat stanja???
Previous by thread: Re: U vezi domaceg... Next by thread: automat stanja???
Previous by thread: Re: U vezi domaceg... Next by thread: automat stanja???