From ac60efb123b200f554706472579110e07078386f Mon Sep 17 00:00:00 2001
From: Clement LERICHE <c23leric@fl-tp-br-606.imta.fr>
Date: Wed, 12 Feb 2025 12:24:50 +0100
Subject: [PATCH] tp_presque_termine

---
 docs/compte-rendu.md |  7 ++++-
 src/automate.vhd     | 65 +++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 67 insertions(+), 5 deletions(-)

diff --git a/docs/compte-rendu.md b/docs/compte-rendu.md
index 12875e4..9d2c3f8 100644
--- a/docs/compte-rendu.md
+++ b/docs/compte-rendu.md
@@ -23,22 +23,27 @@ Les signaux à renseigner sont la clock et le reset car il  n'y a pas besoin de
 
 ## Question Loto 5 : Que se passe-t-il si le test est incomplet, c’est-à-dire s’il ne couvre pas toutes les combinaisons d’entrées du module ? Est-ce grave ici ?
 
-Toutes les combinaisons binaires possibles ne sont pas testées. Le test n'est pas complet car il n'y a pas d'interet.
+Toutes les combinaisons binaires possibles ne sont pas testées. Le test n'est pas complet car il n'y a pas d'interet (on ne va pas tester les 64 valeurs possibles). Il doit permettre de réflechir aux conditions critiques désirées.
 
 ## Question Loto 6 : Ce test est-il concluant ? Est-il suffisant pour valider le module ? Justifiez.
 
+Le test est concluant car les sorties sont en modulo 6. Quand I_block = 1, le compteur s'arrete jusqu'à ce que I_block = 0, alors le comptage reprend au prochain front montant.
 
 ## Question Loto 7 : Combien de processus avez-vous décris ?
 
+1
 
 ## Question Loto 8 : De quel(s) type(s) sont-ils
 
+Sequentiel
 
 ## Question Loto 9 : Serait-il possible de décrire cette machine d'état de manière différente, en terme de nombre et de type de process ?
 
+Pour les étudiants SEH : pas notre cas
 
 ## Question Loto 10 : Ce test est-il concluant ? Justifiez.
 
+Oui, on observe tous les changements d'état associé aux evenements bouton. Alternance rouge/vert à la fin.
 
 ## Question Loto 11 : Le circuit inféré par l’outil est-il conforme à l’attendu ? Sinon, en quoi diffère-t-il et est-ce lié à une erreur de description VHDL ?
 
diff --git a/src/automate.vhd b/src/automate.vhd
index 1ccb931..881612f 100644
--- a/src/automate.vhd
+++ b/src/automate.vhd
@@ -36,10 +36,9 @@ begin
     process (I_clk, I_rst)
     begin
         if(I_rst = '1')then
-            __BLANK_TO_FILL__
+            SR_STATE <= st_wait_success;
         elsif rising_edge(I_clk)then
             case SR_STATE is
-                case SR_STATE is
 
                 when st_wait_success =>
                     O_l_green        <= '1';
@@ -50,9 +49,67 @@ begin
                         SR_STATE <= st_counting;
                     end if;
 
-                    when __BLANK_TO_FILL__
+                when st_counting =>
+                    O_l_green        <= '0';
+                    O_l_red        <= '0';
+                    O_counting       <= '1';
+                    O_store <= '0';
+                    if I_button = '0' then
+                        SR_STATE <= st_compar;
+                    end if;
+
+                when st_compar =>
+                    O_l_green        <= '0';
+                    O_l_red        <= '0';
+                    O_counting       <= '0';
+                    O_store <= '0';
+                    if I_invalide = '0' then
+                        SR_STATE <= st_store;
+                    else
+                        SR_STATE <= st_wait_failed;
+
+                    end if;
+
+
+                when st_store =>
+                    O_l_green        <= '0';
+                    O_l_red        <= '0';
+                    O_counting       <= '0';
+                    O_store <= '1';
+                    if I_end = '0' then
+                        SR_STATE <= st_wait_success;
+                    end if;
+                    if I_end = '1' then
+                        SR_STATE <= st_end_red;
+                    end if;
 
-                    __BLANK_TO_FILL__
+                when st_end_red =>
+                    O_l_green        <= '0';
+                    O_l_red        <= '1';
+                    O_counting       <= '0';
+                    O_store <= '0';
+                    if I_clk_display = '1' then
+                        SR_STATE <= st_end_green;
+                    end if;
+
+                when st_end_green =>
+                    O_l_green        <= '1';
+                    O_l_red        <= '0';
+                    O_counting       <= '0';
+                    O_store <= '0';
+                    if I_clk_display = '0' then
+                        SR_STATE <= st_end_red;
+                    end if;
+
+                when st_wait_failed =>
+                    O_l_green        <= '0';
+                    O_l_red        <= '1';
+                    O_counting       <= '0';
+                    O_store <= '0';
+                    if I_button = '1' then
+                        SR_STATE <= st_counting;
+                    end if;
+            
 
             end case;
         end if;
-- 
GitLab