1
0
SEm-Labos/02-SplineInterpolator/SplineInterpolator/hdl/interpolatorCalculatePolynom_studentVersion.vhd
2024-03-13 14:21:54 +01:00

43 lines
1.1 KiB
VHDL

ARCHITECTURE studentVersion OF interpolatorCalculatePolynom IS
subtype st is signed(coeffBitNb-1+oversamplingBitNb+8 DOWNTO 0);
signal x: st;
signal u: st;
signal v: st;
signal w: st;
signal y: st;
BEGIN
process(clock, reset) begin
if reset = '1' then
x <= (others => '0');
u <= (others => '0');
v <= (others => '0');
w <= (others => '0');
y <= (others => '0');
elsif rising_edge(clock) then
if restartPolynom = '1' then
x <= resize(d, st'high+1) sll (oversamplingBitNb * 3 + 1);
u <= resize(a, st'high+1) + (resize(b, st'high+1) sll oversamplingBitNb) + (resize(c, st'high+1) sll (oversamplingBitNb*2));
v <= resize(6*a, v'length) + (resize(b, st'high+1) sll (oversamplingBitNb + 1));
w <= resize(6*a, w'length);
y <= resize(d, st'high+1);
else
x <= x + u;
u <= u + v;
v <= v + w;
y <= x srl (oversamplingBitNb * 3 + 1);
end if;
end if;
end process;
sampleOut <= resize(y,signalBitNb);
END ARCHITECTURE studentVersion;