ereur de synthèse

Electronique numérique / Circuits logiques programmables EPLD, CPLD, FPGA d'Altera ou de Xilinx VHDL, Verilog ou SystemC

Modérateur : Modérateur

mortema
NOUVEAU
NOUVEAU
Messages : 2
Inscription : 13 sept. 2007 14:56

ereur de synthèse

Message par mortema »

Bonjour tout le monde.

je voudrais réaliser la fonction suivante (en vert les entrées du module, en rouge les sorties)

Image
voila mon code
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;

Entity compteur is port(
locked, raza, c0 : in std_logic;
pllena : out std_logic;
dout : out std_logic_vector (7 downto 0));
end entity;


architecture compt of compteur is
signal dint, dint_inc : std_logic_vector (7 downto 0);
signal pllena_int : std_logic;

begin

if raza='0' then
if c0 'event and c0='1' then -- sur front montant de l'horloge c0
dint<=dint_inc; -- incrémentation du compteur
end if;
else dint<="00000000"; -- reset du compteur
end if;

if locked='1' then -- si locked vaut 1 on incrémente,sinon non
dint_inc<=std_logic_vector(unsigned(dint)+1);
else dint_inc<=dint_inc;
end if;

if (unsigned(dint)>150) then -- si le compteur dépasse 150, on met pllena
pllena_int<='0'; -- a l'état bas
else pllena_int<='1';
end if;

dout<=dint;
pllena<=pllena_int;
end compt;

et les ereurs
Error (10500): VHDL syntax error at Compteur.vhd(18) near text "if"; expecting "end", or "(", or an identifier ("if" is a reserved keyword), or a concurrent statement
Error (10500): VHDL syntax error at Compteur.vhd(19) near text "and"; expecting "(", or "'", or "."
Error (10500): VHDL syntax error at Compteur.vhd(21) near text "if"; expecting ";", or an identifier ("if" is a reserved keyword), or "architecture"
Error (10500): VHDL syntax error at Compteur.vhd(26) near text "else"; expecting "end", or "(", or an identifier ("else" is a reserved keyword), or a concurrent statement
Error (10500): VHDL syntax error at Compteur.vhd(27) near text "if"; expecting ";", or an identifier ("if" is a reserved keyword), or "architecture"
Error (10500): VHDL syntax error at Compteur.vhd(29) near text "then"; expecting "<="
Error (10500): VHDL syntax error at Compteur.vhd(31) near text "else"; expecting "end", or "(", or an identifier ("else" is a reserved keyword), or a concurrent statement
Error (10500): VHDL syntax error at Compteur.vhd(32) near text "if"; expecting ";", or an identifier ("if" is a reserved keyword), or "architecture"
je ne comprend pas pourquoi cela ne compile pas...
Quelqu'un peut il m'aider ?


Merci d'avance =)

mortema
NOUVEAU
NOUVEAU
Messages : 2
Inscription : 13 sept. 2007 14:56

Message par mortema »

bon en fait j'ai trouvé tout seul =)

C'est parceque dans mon code j'utilise des IF, a la place de When pour décrire ma logique, il faut donc que j'utilise un process pour que cela fonctionne.

Pour ceux que cela intéresse :
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;

Entity compteur is port(
locked, raza, c0 : in std_logic;
pllena : out std_logic;
dout : out std_logic_vector (7 downto 0));
end entity;


architecture compt of compteur is
signal dint, dint_inc : std_logic_vector (7 downto 0);
signal pllena_int : std_logic;

begin

process(raza, locked, clk)
begin

if raza='0' then
if c0 'event and c0='1' then -- sur front montant de l'horloge c0
dint<=dint_inc; -- incrémentation du compteur
end if;
else dint<="00000000"; -- reset du compteur
end if;

if locked='1' then -- si locked vaut 1 on incrémente,sinon non
dint_inc<=std_logic_vector(unsigned(dint)+1);
else dint_inc<=dint_inc;
end if;

if (unsigned(dint)>150) then -- si le compteur dépasse 150, on met pllena
pllena_int<='0'; -- a l'état bas
else pllena_int<='1';
end if;

dout<=dint;
pllena<=pllena_int;
end process;
end compt;

Répondre