Thursday, 15 August 2013

Continuous assignment seemingly not working

Continuous assignment seemingly not working

I'm working on a FIR filter, specifically the delay line. x_delayed is
initialized to all zeros.
This does not work:
x_delayed(0) <= x; -- Continuous assignment
DELAYS : process(samp_clk)
begin
if rising_edge(samp_clk) then
for i in 1 to NTAPS-1 loop
x_delayed(i) <= x_delayed(i-1);
end loop;
end if; -- rising_edge(samp_clk)
end process;




But this does:
DELAYS : process(samp_clk)
begin
if rising_edge(samp_clk) then
x_delayed(0) <= x; -- Registering input
for i in 1 to NTAPS-1 loop
x_delayed(i) <= x_delayed(i-1);
end loop;
end if; -- rising_edge(samp_clk)
end process;

The problem with this "solution" is that the first element in x_delayed is
not delayed by one sample, which it should not be. (The rest of the code
expects x_delayed(0) to be the current sample).
What gives?

No comments:

Post a Comment