TrickyDicky
Advanced Member level 7
The control always has to be done at the input. But with this code you could connect the output from this code to another instantiation of the moving average, and it will halve the data rate again.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
average_proc : process (reset,clk)
begin
if reset = '1' then
m1 <= '0';
m2 <= '0';
m3 <= '0';
m4 <= '0';
elsif rising_edge (clk) then
m1 <= '0';
m2 <= '0';
m3 <= '0';
m4 <= '0';
if source_pixel_valid = '1' then
case S is
when "00" =>
ip1 <= source_pixel;
m1 <= '1';
when "01" =>
ip2 <= source_pixel;
m2 <= '1';
when "10" =>
ip3 <= source_pixel;
m3 <= '1';
when "11" =>
ip4 <= source_pixel;
m5 <= '1';
end case;
av_out <= op1;
end if;
end if;
end process;