我正在用 VHDL 实现 FIR 滤波器,需要一些关于何时使用和不使用过程语句的建议。部分代码如下所示。具体来说,我想知道resetCoeffs
循环将如何合成。它会是顺序重置,因此我假设的速度和面积都非常低效,还是会并行完成?如果是前者,我将如何编写它以便可以并行重置。
process (clk) is begin
if rising_edge(clk) then
if rst = '1' then
-- Reset pointer
ptr <= (others => '0');
-- Reset coefficients
resetCoeffs: for i in 0 to ORDER - 1 loop
coeffs(i) <= (others => '0');
end loop;
else
-- Increment pointer
ptr <= ptr + 1;
-- Fetch input value
vals( to_integer(ptr) ) <= ival;
-- Write coefficient
if coeff_wen = '1' then
coeffs( to_integer(ptr) ) <= ival;
end if;
end if;
end if;
end process;