Bonjour,

je suis entrain de développer en VHDL dans le cadre d'un projet. Je suis sur un composant compareScore qui vise à sauver le meilleur score pendant une phase de jeu. Je veux sauver ma variable dans un signal STD_LOGIC_VECTOR.

Le problème est que mon signal bestScoreSauve n'est pas modifier dans mes process et j'en ai aucune idée pourquoi ? J'ai beaucoup chercher sur internet mais c'est réponse il y a vraiment peut de choses pour le VHDL :S Merci de votre aide.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
 
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use IEEE.NUMERIC_STD.ALL;
 
entity compareScore is
    Port ( currentState : in  STD_LOGIC_VECTOR (1 downto 0);
           currentScore : in  STD_LOGIC_VECTOR (4 downto 0);
           bestScore : out  STD_LOGIC_VECTOR (4 downto 0);
           reset : in  STD_LOGIC;
           clock : in  STD_LOGIC);
end compareScore;
 
architecture Behavioral of compareScore is
   signal bestScoreSauve : STD_LOGIC_VECTOR (4 downto 0);
	 type etats is (afficheBestScore, affichageJeu, compareScore);
    signal etat_courant, etat_future : etats;
begin
 
 
	combinatoire_compareScore_etat_futur : process (etat_courant, currentState)
	begin
	case etat_courant is
		when afficheBestScore =>
				if  currentState = "01" then 
					etat_future <= affichageJeu;
				else
					etat_future <= afficheBestScore;
				end if;
 
		when affichageJeu =>
       		if  currentState = "10" then 
					etat_future <= compareScore;
				elsif currentState =  "00" then 
					etat_future <= afficheBestScore; 
				else
					etat_future <= affichageJeu;
				end if;
		when compareScore =>
       		if   currentState = "10" or currentState = "00" then 
					etat_future <= afficheBestScore;
				elsif currentState =  "01" then 
					etat_future <= affichageJeu; 
				else
					etat_future <= afficheBestScore;
				end if;
 
		when others =>
		    	etat_future <= afficheBestScore;
		end case;
	end process combinatoire_compareScore_etat_futur ;
 
 
   registre_score : process (clock, reset)
 
   begin
		if reset = '1' then
	   -- bestScoreSauve(4 downto 0) <= "00000";   
			etat_courant <= afficheBestScore;	
 
		elsif rising_edge (clock) then
			etat_courant <= etat_future;
 
		end if ;
	end process registre_score;
 
 
	circuit_compareScore_sortie : process (etat_courant, currentScore)
 
	begin	
	 	case etat_courant is 
	 when afficheBestScore =>
			   bestScore <= bestScoreSauve;
		 when affichageJeu =>  
		      bestScore <= currentScore;
        when compareScore =>
		       if  (currentScore(4 downto 0) > bestScoreSauve(4 downto 0)) then
			      bestScoreSauve <= currentScore;  
					bestScore <= bestScoreSauve;
			 else
				 bestScore <= currentScore; 
			  end if;	
		when others =>
		   bestScore <= bestScoreSauve;
		end case;				
 
   end process circuit_compareScore_sortie ;
 
end Behavioral;