1
0
SEm-Labos/02-SplineInterpolator/SplineInterpolator/hdl/interpolatorCoefficients_studentVersion.vhd

28 lines
947 B
VHDL
Raw Normal View History

2024-02-23 13:01:05 +00:00
ARCHITECTURE studentVersion OF interpolatorCoefficients IS
2024-03-08 15:16:59 +00:00
subtype sample is signed(bitNb-1 DOWNTO 0);
subtype coeff is signed(coeffBitNb-1 DOWNTO 0);
type samples_type is array (1 to 4) of coeff;
signal samples: samples_type;
2024-02-23 13:01:05 +00:00
BEGIN
2024-03-08 15:16:59 +00:00
-- a = - sample1 +3·sample2 -3·sample3 + sample4
-- b = 2·sample1 -5·sample2 +4·sample3 - sample4
-- c = - sample1 + sample3
-- d = sample2
process(sample1, sample2, sample3, sample4) begin
samples(4) <= resize(sample1, coeff'high+1);
samples(3) <= resize(sample2, coeff'high+1);
samples(2) <= resize(sample3, coeff'high+1);
samples(1) <= resize(sample4, coeff'high+1);
end process;
a <= samples(4) - samples(1) + resize( 3*(samples(2) - samples(3)), coeff'high+1);
b <= resize(2*samples(1), coeff'high+1) - resize(5*samples(2), coeff'high+1) + resize(4*samples(3), coeff'high+1) - samples(4);
c <= samples(3) - samples(1);
d <= samples(4);
2024-02-23 13:01:05 +00:00
END ARCHITECTURE studentVersion;