From 73dd7da0dbdbf7142f06b810ed7d6c241deb99c3 Mon Sep 17 00:00:00 2001 From: Klagarge Date: Fri, 1 Mar 2024 15:12:05 +0100 Subject: [PATCH] add signus signal --- .../hdl/lowpass_studentVersion.vhd | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/01-WaveformGenerator/WaveformGenerator/hdl/lowpass_studentVersion.vhd b/01-WaveformGenerator/WaveformGenerator/hdl/lowpass_studentVersion.vhd index f2e46c5..f982160 100644 --- a/01-WaveformGenerator/WaveformGenerator/hdl/lowpass_studentVersion.vhd +++ b/01-WaveformGenerator/WaveformGenerator/hdl/lowpass_studentVersion.vhd @@ -1,4 +1,17 @@ ARCHITECTURE studentVersion OF lowpass IS + + signal accumulator: unsigned((signalBitNb-1)+shiftBitNb downto 0); + BEGIN - lowpassOut <= (others => '0'); + + process(clock) + begin + if reset = '1' then + accumulator <= (others => '0'); + elsif rising_edge(clock) then + accumulator <= accumulator + resize(lowpassIn,signalBitNb+shiftBitNb) - shift_right(accumulator, shiftBitNb); + end if; + end process; + + lowpassOut <= resize(shift_right(accumulator, shiftBitNb), signalBitNb); END ARCHITECTURE studentVersion;