28 lines
947 B
VHDL
28 lines
947 B
VHDL
ARCHITECTURE studentVersion OF interpolatorCoefficients IS
|
|
|
|
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;
|
|
|
|
BEGIN
|
|
-- 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);
|
|
END ARCHITECTURE studentVersion;
|