diff --git a/docs/compte-rendu.md b/docs/compte-rendu.md index cd056f619d4a6c4caddd9df5b41f43ed435892f3..550cf9e1da8f3b89c3bdc49f177b64d48b39fa0e 100644 --- a/docs/compte-rendu.md +++ b/docs/compte-rendu.md @@ -7,19 +7,38 @@ ## Questions -### Question filtre 1 : Combien de processus sont utilisés et de quelles natures sont-ils ? Comment les différenciez-vous ? +### Question filtre 1 : Combien de processus sont utilisés et de quelles natures sont-ils ? Comment les différenciez-vous ? +Nous avons utilisé 2 process. Un synchrone sur la clock qui gère le changement de l'état_présent à l'état_futur. L'autre qui calcule l'état futur en fonction de l'état présent et des conditions de transition/ des entrées. -### Question filtre 2 : La simulation vous permet-elle de valider votre description VHDL ? Justifiez. +### Question filtre 2 : La simulation vous permet-elle de valider votre description VHDL ? Justifiez. +oui, nous avons bien la séquence attendue à l'issue du filtre et les changement d'états de la FSM sont logiques. ### Question filtre 3 : Validez-vous la conception de l’unité de contrôle ? - +Oui. ### Question filtre 4 : Combien de processus sont utilisés et de quelles natures sont-ils ? - +Il y a 4 process pour gérer chacun des registres, ils sont synchrones. ### 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 +La simulation permet de valider une partie du comportement mais ne s'intéresse pas à la taille des outputs. Nous avons eu des problème lors de la synthèse. Nous avons alors du corriger la taille de SR_Y en prenant bien en compte la gestion de l'arrondit et en ne prenant que les bits de poids fort + le bit de signes. exemple ci dessous. + +if I_loadY ='1' then + +if SR_sum(6)= '1' then + +SR_Y <= SR_sum(14 downto 7)+"00000001"; + +else + +SR_Y <= SR_sum(14 downto 7); + +end if; + +end if; + ### Question filtre 6 : Validez-vous la conception de l’unité opérative ? Sinon, quel élément pose problème ? Comment pouvez-vous le corriger ? +Oui,c'est identique au test précédent. diff --git a/docs/img/FSM.png b/docs/img/FSM.png index 7f6db881fff5cdfb9351c0348dfec49ff082516d..62ec5836140b5ea2239c2f2db8cba1b646007aa3 100644 Binary files a/docs/img/FSM.png and b/docs/img/FSM.png differ diff --git a/src/hdl/controlUnit.vhd b/src/hdl/controlUnit.vhd index 705905d8efbad8482d22e650f8cce92ef78290f4..24e53a7dfc8e212a06c40b88f94f4d0d90404bc5 100644 --- a/src/hdl/controlUnit.vhd +++ b/src/hdl/controlUnit.vhd @@ -49,36 +49,65 @@ architecture archi_operativeUnit of controlUnit is begin - process (_BLANK_) is +-- initialisation de l'état + process (I_reset,I_clock) is begin if I_reset = '1' then -- asynchronous reset (active high) - SR_presentState <= _BLANK_ + SR_presentState <= WAIT_SAMPLE ; elsif rising_edge(I_clock) then -- rising clock edge - _BLANK_ + SR_presentState <= SR_futurState ; end if; end process; - process (_BLANK_) is + +-- transition + process (SR_presentState,I_inputSampleValid,I_processingDone) is begin case SR_presentState is - when WAIT_SAMPLE => - _BLANK_ - + if I_inputSampleValid = '1' then + SR_futurState <= STORE ; + else + SR_futurState <= WAIT_SAMPLE ; + end if; + + when STORE => + SR_futurState <= PROCESSING_LOOP ; + + when PROCESSING_LOOP => + if I_processingDone = '1' then + SR_futurState <= OUTPUT ; + else + SR_futurState <= PROCESSING_LOOP ; + end if; + + when OUTPUT => + SR_futurState <= WAIT_END_SAMPLE; + + when WAIT_END_SAMPLE => + if I_inputSampleValid = '0' then + SR_futurState <= WAIT_SAMPLE; + else + SR_futurState <= WAIT_END_SAMPLE ; + end if; + when others => null; + end case; end process; - O_loadShift <= '1' when _BLANK_ ; - O_initAddress <= '1' when _BLANK_ ; - O_incrAddress <= '1' when _BLANK_ ; - O_initSum <= '1' when _BLANK_ ; - O_loadSum <= '1' when _BLANK_ ; - O_loadY <= '1' when _BLANK_ ; - O_FilteredSampleValid <= '1' when _BLANK_ ; + O_loadShift <= '1' when SR_presentState = STORE else '0' ; + O_initAddress <= '1' when SR_presentState = STORE else '0' ; + O_incrAddress <= '1' when SR_presentState = PROCESSING_LOOP else '0'; + O_initSum <= '1' when SR_presentState = STORE else '0'; + O_loadSum <= '1' when SR_presentState = PROCESSING_LOOP else '0' ; + O_loadY <= '1' when SR_presentState = OUTPUT else '0' ; + O_FilteredSampleValid <= '1' when SR_presentState = OUTPUT else '0' ; + + end architecture archi_operativeUnit; diff --git a/src/hdl/operativeUnit.vhd b/src/hdl/operativeUnit.vhd index 1286aff5a65b975b333b4136df7781bb98c0742e..3d74059c07f988ec8949274e27cd29566ce3375f 100644 --- a/src/hdl/operativeUnit.vhd +++ b/src/hdl/operativeUnit.vhd @@ -85,42 +85,62 @@ begin to_signed(2, 8) ); - shift : process (_BLANK_) is + shift : process (I_clock,I_reset) 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 to 14) <= SR_shiftRegister(1 to 15); + SR_shiftRegister(15) <= signed(I_inputSample); + end if; end if; - end process shift; + end process shift; - 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_incrAddress ='1' then + SR_readAddress <= SR_readAddress + 1; + elsif I_initAddress ='1' then + SR_readAddress <= 0; + end if; end if; end process incr_address; - O_processingDone <= '1' when _BLANK_ ; + O_processingDone <= '1' when SR_readAddress = 15 ; - SC_multOperand1 <= _BLANK_ ; -- 8 bits - SC_multOperand2 <= _BLANK_ ; -- 8 bits - SC_MultResult <= _BLANK_ ; -- 16 bits + SC_multOperand1 <= SR_shiftRegister(SR_readAddress) ; -- 8 bits + SC_multOperand2 <= SR_coefRegister( SR_readAddress); -- 8 bits + SC_MultResult <= SC_multOperand1*SC_multOperand2 ; -- 16 bits SC_addResult <= resize(SC_MultResult, SC_addResult'length) + SR_sum; - sum_acc : process (_BLANK_) is + sum_acc : process (I_reset,I_clock) 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_loadSum ='1' then + SR_sum <= SC_addResult; + elsif I_initSum ='1' then + SR_sum <= (others => '0'); + end if; end if; end process sum_acc; - store_result : process (_BLANK_) is + store_result : process (I_clock) is begin - _BLANK_ + if rising_edge (I_clock) then + if I_loadY ='1' then + if SR_sum(6)= '1' then + SR_Y <= SR_sum(14 downto 7)+"00000001"; + else + SR_Y <= SR_sum(14 downto 7); + end if; + end if; + end if; end process store_result;