Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17040 Discussions

entity problem/errors with easy counter

Altera_Forum
Honored Contributor II
1,150 Views

Hello guys, 

 

I am new to VHDL, but I am having some problem with my entitiy creation. The design below counts the number of leading zeros in a binary vector, starting 

from the left end. But i am not able to compile my file at all thats why I need your help. 

 

This is the error message I got: 

 

Error (10500): VHDL syntax error at zero_counter.vhd(5) near text "ENTITY"; expecting "(", or "'", or "." 

 

------------------------------------------------------------------ 

 

LIBRARY ieee; 

USE ieee.std_logic_1164.all;  

USE ieee.numeric_std.all 

 

ENTITY zero_counter IS -- error message at this point 

GENERIC (WID: Integer :=8; 

Minval: unsigned:="0000_0000" 

); 

PORT(data: IN STD_LOGIC_VECTOR(WID-1 downto 0); 

output: OUT STD_LOGIC_VECTOR(WID-1 downto 0) 

); 

END zero_counter; 

 

ARCHITECTURE behavior OF zero_counter IS 

 

BEGIN 

PROCESS (data) 

VARIABLE count: unsigned (0 to WID-1); 

BEGIN 

count := Minval; 

FOR i IN 0 to Wid-1 LOOP 

CASE data(i) IS 

WHEN '0' => count := count + 1; -- data(i)='0' , count++ 

WHEN OTHERS => NEXT; --jump to next iteration 

END CASE; 

END LOOP; 

output <= std_logic_vector(count); 

END PROCESS; 

END behavior; 

 

------------------------------- 

 

 

I already tryed to realize it without the generic block, but its all the same. 

I am using Quartus 13.1 

Can someone help me?
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
434 Views

Missing a ; after your second USE.

0 Kudos
Altera_Forum
Honored Contributor II
434 Views

thanks cronus10 for your reply. I really feel ashamed that I didnt find it on my own.

0 Kudos
Altera_Forum
Honored Contributor II
434 Views

No worries, it's easy to miss, I do it plenty of times myself.

0 Kudos
Altera_Forum
Honored Contributor II
434 Views

As a rule of thumb, when you don't understand a VHDL compiler error message, it can often mean that the mistake is in fact on the line *above*. 

I'm still amazed that after so many years, parsers are still not able to detect properly a missing semicolon (and this doesn't apply only to vhdl). 

 

http://img-9gag-fun.9cache.com/photo/adm0zxx_700b.jpg (http://9gag.com/gag/adm0zxx/programming-is-like-writing-a-book)
0 Kudos
Reply