IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VHDL Discussion :

Fonction CASE avec coup d'horloge


Sujet :

VHDL

  1. #1
    Candidat au Club
    Femme Profil pro
    Développeur .NET
    Inscrit en
    Novembre 2011
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : Industrie Pharmaceutique

    Informations forums :
    Inscription : Novembre 2011
    Messages : 6
    Points : 4
    Points
    4
    Par défaut Fonction CASE avec coup d'horloge
    Bonjour,

    je ne comprends pas mon erreur :
    Error (10313): VHDL Case Statement error at VHDL_2.vhd(77): Case Statement choices must cover all possible values of expression
    Je voudrais lire chaque état de case pour 1 cycle d'horloge. C'est à dire 1er coup d'horloge st0, 2d coup d'horloge st1, 3eme coup d'horloge st2 jusqu’à st6. Mais j'ai l'erreur du dessus qui s'affiche et je ne vois pas ce qu'il faut faire !
    Si vous pouviez m'aider.

    Je vous remercie d'avance.

    Olivier



    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
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    library IEEE;
    use IEEE.STD_LOGIC_1164.ALL;
    use IEEE.STD_LOGIC_ARITH.ALL;
    use IEEE.STD_LOGIC_UNSIGNED.ALL;
     
     
    entity VHDL_2 is --file
     
    	Port ( 
    		--LEDR1 : in bit_vector (0 to 13) ;
    		OSC_SMA_ADC4 : in std_logic; --
    		CLOCK_50 : in std_logic; --
    		ADC_DA : in bit_vector (0 to 13) ;
    		DAC_DA : out bit_vector (0 to 13) ;
    		ADC_DB : in bit_vector (0 to 13) ;
    		DAC_DB : out bit_vector (0 to 13) ;
    		--GPIOa : out bit_vector (0 to 13) ;
    		GPIOb : out bit_vector (0 to 4) ;
    		LEDR : out bit_vector (0 to 13) ;
    		DAC_WRT_A : out std_logic; --dac	
    		DAC_WRT_B : out std_logic;
    		GPIOa_2 : out std_logic;
    		GPIOa_1 : out std_logic;
    		GPIOa_4 : out bit_vector(0 to 7);
    		SMA_CLKIN : in std_logic;
    		SMA_CLKOUT : out std_logic);
     
    end VHDL_2;
     
    architecture Behavioral of VHDL_2 is
     
    --type state_type is (idle, read, func, write);
    --signal state : state_type := read;
    signal cnt : integer range 0 to 14 := 0;
    signal clkdiv : integer range 0 to 10 := 0;
    signal risingedge : std_logic := '1';
    signal reset : std_logic := '0';
    --signal LEDR1 : bit_vector := '14';
    signal LEDRt : bit_vector (0 to 13) ;
    --signal GPIOa[2] : std_logic value := 0;
    --signal GPIOa[1] : std_logic value := 0;
    --signal GPIOa[4] : std_logic_vector value :=  "11010101";
    --VARIABLE a : integer := 0;
     
    CONSTANT st0 : std_logic_vector(0 TO 3) := "0000";
    CONSTANT st1 : std_logic_vector(0 TO 3) := "0001";
    CONSTANT st2 : std_logic_vector(0 TO 3) := "0010";
    CONSTANT st3 : std_logic_vector(0 TO 3) := "0011";
    CONSTANT st4 : std_logic_vector(0 TO 3) := "0100";
    CONSTANT st5 : std_logic_vector(0 TO 3) := "0101";
    CONSTANT st6 : std_logic_vector(0 TO 3) := "0110";
    --CONSTANT st7 : std_logic_vector(0 TO 3) := "0111";
    --SIGNAL state : std_logic_vector(0 TO 3) := "0111";
    --SIGNAL state : bit_vector (0 to 3) ;
    SIGNAL state : std_logic_vector (0 to 3) := "0000";
     
     
     
    begin
    --drive the adc and dac clock pins
    	SMA_CLKOUT <= SMA_CLKIN;
    	DAC_WRT_A <= SMA_CLKIN;	--Input write signal for PORT A
    	DAC_WRT_B <= SMA_CLKIN;	--Input write signal for PORT B
    	--OSC_SMA_ADC4
     
    	state <= st0;
     
    main : process (SMA_CLKIN, reset) 
    	begin 
     
     
    --loop1: FOR a IN 0 TO 6 LOOP -- la variable de boucle est a de 0 à 6	
    				if rising_edge(SMA_CLKIN) then
    				DAC_DA <= ADC_DA;
    				DAC_DB <= ADC_DB;
     
    							case state is
    									when St0 => if  state<=St0 then
    										GPIOa_2 <= '0';
    										state <= St1;
    										end if;
    									when St1 => if state<=St1 then
    										GPIOa_1 <= '1';
    										state <= St2;
    										end if;
    									when St2 => if  state<=St2 then
    										GPIOa_4 <= "11010101";
    										state <= St3;
    										end if;
    									when St3 => if  state<=St3 then
    										GPIOa_1 <= '0';
    										state <= St4;
    										end if;
    									when St4 => if  state<=St4 then
    										GPIOa_2 <= '1';
    										state <= St5;
    										end if;
    									when St5 => if  state<=St5 then
    										GPIOa_2 <= '0';
    										state <= St6;
    										end if;	
    									when St6 => if  state<=St6 then
    										GPIOb <= ADC_DB;
    										state <= St0;
    										end if;
    							end case;
     
    				elsif state = St0 then 
    				LEDRt <= LEDRt;
     
    	end if;
     
    --END LOOP loop1;					
     
     
     
    		--end if;
    end process main;
    end Behavioral;

  2. #2
    Membre régulier
    Profil pro
    Inscrit en
    Juin 2009
    Messages
    61
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2009
    Messages : 61
    Points : 121
    Points
    121
    Par défaut
    'st0' est un std_logic_vector de 4 bits. Un case/when doit couvrir tous les cas possibles (c'est ce que raconte le message d'erreur). Donc :
    • en simulation, un std_logic possède 9 états possibles (0, 1, Z, L, H, U, X, W, -). 4 bits => 9^4 = 6561 valeurs de "when"
    • en synthèse, seulement 2 possibles (0 & 1) => 2^4 = 16 cas possibles

    Le plus simple est de lister les 7 cas réels (st0 .. st6) et d'ajouter "when others => null;" (comme si "others" était un 8ème cas). Ca devrait aller beaucoup mieux...

    Cdlt

Discussions similaires

  1. Fonction mail() avec MIME, début du mail coupé
    Par Hazow dans le forum Langage
    Réponses: 0
    Dernier message: 18/02/2014, 16h27
  2. Erreurs sur procédure PL/SQL avec fonction case
    Par Djene dans le forum PL/SQL
    Réponses: 2
    Dernier message: 07/10/2011, 17h19
  3. Probleme avec la fonction case
    Par JUSTIN Loïc dans le forum Requêtes
    Réponses: 4
    Dernier message: 07/10/2011, 16h23
  4. fonction Case avec intervalle
    Par backdraf dans le forum Développement
    Réponses: 2
    Dernier message: 08/09/2009, 09h14
  5. Fonction If avec rs.eof problème
    Par M1000 dans le forum ASP
    Réponses: 5
    Dernier message: 24/03/2004, 17h10

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo