Modify conditional operators in moving_average.vhd for Quartus compatibility

This commit is contained in:
John Ring 2023-07-23 18:27:28 +02:00
parent a20890e126
commit 66ed1d846b

View File

@ -66,13 +66,22 @@ begin
overflow <= '1';
end if;
if (enable = '1') then
accumulator <= accumulator + unsigned("0" & data_in) - unsigned("0" & fifo_out) when (fifo_full = '1') else accumulator + unsigned("0" & data_in);
if (fifo_full = '1') then
accumulator <= accumulator + unsigned("0" & data_in) - unsigned("0" & fifo_out);
else
accumulator <= accumulator + unsigned("0" & data_in);
end if;
end if;
end if;
end if;
end process;
average <= std_logic_vector(((log2c(WINDOW_SIZE)-1 downto 0 => '0') & accumulator(DATA_WIDTH-1 downto log2c(WINDOW_SIZE))) + 1)
when (ENABLE_ROUNDING and accumulator(log2c(WINDOW_SIZE)-1) = '1')
else std_logic_vector(((log2c(WINDOW_SIZE)-1 downto 0 => '0') & accumulator(DATA_WIDTH-1 downto log2c(WINDOW_SIZE))));
average_prc: process(all)
begin
if (ENABLE_ROUNDING and accumulator(log2c(WINDOW_SIZE)-1) = '1') then
average <= std_logic_vector(((log2c(WINDOW_SIZE)-1 downto 0 => '0') & accumulator(DATA_WIDTH-1 downto log2c(WINDOW_SIZE))) + 1);
else
average <= std_logic_vector(((log2c(WINDOW_SIZE)-1 downto 0 => '0') & accumulator(DATA_WIDTH-1 downto log2c(WINDOW_SIZE))));
end if;
end process;
end architecture;