diff --git a/docs/compte-rendu.md b/docs/compte-rendu.md index e177340b286c9b23b3b77a3b93ebdfbd9dba66bd..0c90cbcd33dabe96e06229fb0e70c933320d31ea 100644 --- a/docs/compte-rendu.md +++ b/docs/compte-rendu.md @@ -14,12 +14,13 @@ ### La séquence renvoyé par la simulation est bien celle attendue, ce n'est pas une condition suffisante pour être sûr que la description VHDL est adapté mais donne tout de même pseudo validation. ### Question filtre 3 : Validez-vous la conception de l’unité de contrôle ? - +### Le test à l'aide de la carte valide l'unité de contrôle. ### Question filtre 4 : Combien de processus sont utilisés et de quelles natures sont-ils ? - +### On observe dans la partie opérative 9 processus dont 4 séquentiels : shift, incr_address, sum_acc et store_result. Le reste étant des processus combinatoires écrits sur une seule ligne. ### Question filtre 5 : La simulation vous permet-elle de valider votre description VHDL ? Sinon, quel élément pose problème ? Comment pouvez-vous le corriger ? Justifiez - +### Lors de la première simulation, les valeurs étaient proches des valeurs attendues, à 1 de moins près. Nous avons donc proposé un arrondi des valeurs et lors des autres simulations les valeurs étaient exactes. On valide donc notre description VHDL. ### Question filtre 6 : Validez-vous la conception de l’unité opérative ? Sinon, quel élément pose problème ? Comment pouvez-vous le corriger ? +### Après avoir testé sur à l'aide de la carte, on observe bien à l'écoute un filtre passe-bas qui permet de compenser les pertes de qualité liées à la perte de bits. \ No newline at end of file diff --git a/src/hdl/firUnit.vhd b/src/hdl/firUnit.vhd index 00c36d01de18b6a368d7e04c10895b0d5d6e471c..348e793a19640a0bcddeda83f60feb00a8aecdcc 100644 --- a/src/hdl/firUnit.vhd +++ b/src/hdl/firUnit.vhd @@ -66,7 +66,7 @@ architecture archi_firUnit of firUnit is I_incrAddress : in std_logic; I_initSum : in std_logic; I_loadSum : in std_logic; - I_loadOutput : in std_logic; + I_loadY : in std_logic; O_processingDone : out std_logic; O_filteredSample : out std_logic_vector(15 downto 0)); end component operativeUnit; @@ -105,7 +105,7 @@ begin I_incrAddress => SC_incrAddress, I_initSum => SC_initSum, I_loadSum => SC_loadSum, - I_loadOutput => SC_loadOutput, + I_loadY => SC_loadOutput, O_processingDone => SC_processingDone, O_filteredSample => O_filteredSample); diff --git a/src/hdl/operativeUnit.vhd b/src/hdl/operativeUnit.vhd index 2e89ab5958e86891eeb3ac3585ee13b907b997c1..40d42593d1e6748dd54f6d11519311a7af1483c0 100644 --- a/src/hdl/operativeUnit.vhd +++ b/src/hdl/operativeUnit.vhd @@ -114,36 +114,48 @@ begin ); -- Process to describe the shift register storing the input samples - shift : process (I_reset, I_clock, ) is + shift : process (I_reset, I_clock ) is begin -- process shift if I_reset = '1' then -- asynchronous reset (active high) SR_shiftRegister <= (others => (others => '0')); - elsif _BLANK_ - + elsif rising_edge(I_clock) then + if I_loadShift = '1' then + SR_shiftRegister(0) <= SIGNED(I_inputSample); + SR_shiftRegister (1 to 15) <= SR_shiftRegister (0 to 14); + end if; end if; end process shift; + + -- Process to describe the counter providing the selection adresses -- of the multiplexers - incr_address : process (_BLANK_) is + incr_address : process (I_reset,I_clock) is begin if I_reset = '1' then -- asynchronous reset (active high) SR_readAddress <= 0; - elsif _BLANK_ - + elsif rising_edge(I_clock) then + if I_initAddress = '1' then + SR_readAddress <= 0; +-- elsif I_incrAddress = '1' and SR_readAddress < 15 then + elsif I_incrAddress = '1' then + SR_readAddress <= SR_readAddress + 1; + end if; end if; end process incr_address; -- Signal detecting that the next cycle will be the one -- providing the last product used to compute the convolution - O_processingDone <= '1' when _BLANK_; + O_processingDone <= '1' when SR_readAddress = 14 else '0'; -- Signals connected with multiplexers (SIMPLY inferred with table indices) - SC_multOperand1 <= _BLANK_; -- 16 bits - SC_multOperand2 <= _BLANK_; -- 16 bits + + SC_multOperand1 <= SR_shiftRegister(SR_readAddress); -- 16 bits + + SC_multOperand2 <= SR_coefRegister(SR_readAddress); -- 16 bits -- Multiplication of the operands - SC_MultResult <= _BLANK_; -- 32 bits + SC_MultResult <= SC_multOperand1 * SC_multOperand2; -- 32 bits -- Sum of the multiplication result and the accumulated value SC_addResult <= resize(SC_MultResult, SC_addResult'length) + SR_sum; @@ -151,19 +163,33 @@ begin -- Register to store the accumulated value if the loadSum is active -- It also reduces the width of the sum to fit to the input and output -- signal widths (be careful with truncating/rounding) - sum_acc : process (_BLANK_) is + sum_acc : process (I_clock,I_reset) is begin if I_reset = '1' then -- asynchronous reset (active high) SR_sum <= (others => '0'); - elsif _BLANK_ + elsif rising_edge(I_clock) then + if I_initSum = '1' then + SR_sum <= (others => '0'); + elsif I_loadSum = '1' then + SR_sum <= SC_addResult; + end if; end if; end process sum_acc; -- Register to store the final result if the loadOuput is active - store_result : process (_BLANK_) is + store_result : process (I_clock,I_reset) is begin - _BLANK_ - + if I_reset = '1' then -- asynchronous reset (active high) + SR_filteredSample <= (others => '0'); + elsif rising_edge(I_clock) then + if I_loadY = '1' then + if SC_addResult(14) = '1' then + SR_filteredSample <= SC_addResult(30 downto 15) + 1; + else + SR_filteredSample <= SC_addResult(30 downto 15); + end if; + end if; + end if; end process store_result; O_filteredSample <= std_logic_vector(SR_filteredSample);