Skip to content

Commit

Permalink
removed one additional waiting cycle when using zero padding
Browse files Browse the repository at this point in the history
This was achieved by restructuring the zero padding module slightly.
  • Loading branch information
marph91 committed Nov 1, 2020
1 parent 10bbdd3 commit bff41b7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
3 changes: 0 additions & 3 deletions code/vhdl/sim/vunit/top/src/tb_top.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,6 @@ begin
wait until rising_edge(sl_clk);
end loop;
sl_valid_in <= '0';
-- one more waiting cycle, because else padding would accept too much input data
-- TODO: fix it (send data as long as sl_rdy = '1')
wait until rising_edge(sl_clk);
end if;
end loop;
end loop;
Expand Down
1 change: 0 additions & 1 deletion code/vhdl/sim/vunit/zero_pad/src/tb_zero_pad.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ begin
i := i + 1;
end loop;
sl_valid_in <= '0';
wait until rising_edge(sl_clk);
end loop;

stimuli_done <= true;
Expand Down
9 changes: 3 additions & 6 deletions code/vhdl/src/zero_pad.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ architecture behavioral of zero_pad is

signal sl_output_valid : std_logic := '0';
signal slv_data_out : std_logic_vector(C_DATA_WIDTH - 1 downto 0);
signal sl_rdy : std_logic := '0';

type t_states is (IDLE, PAD, PAD_PIXEL, FORWARD_DATA);

Expand Down Expand Up @@ -93,7 +92,6 @@ begin
case state is

when IDLE =>
sl_rdy <= '0';
if (int_pixel_to_pad > 0) then
state <= PAD;
end if;
Expand All @@ -120,12 +118,10 @@ begin
end if;

when FORWARD_DATA =>
sl_rdy <= '1';
slv_data_out <= islv_data;
sl_output_valid <= isl_valid;
if (int_pixel_to_pad > 0) then
state <= PAD;
sl_rdy <= '0';
state <= PAD;
end if;

end case;
Expand All @@ -136,6 +132,7 @@ begin

osl_valid <= sl_output_valid;
oslv_data <= slv_data_out;
osl_rdy <= sl_rdy and isl_get;
osl_rdy <= isl_get when (state = FORWARD_DATA and int_pixel_to_pad = 0) else
'0';

end architecture behavioral;

0 comments on commit bff41b7

Please sign in to comment.