Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17267 Discussions

How to correct the error

Altera_Forum
Honored Contributor II
1,184 Views

LIBRARY ieee; 

USE ieee.std_logic_1164.all; 

ENTITY CHAR_7SEG IS 

PORT ( c : IN STD_LOGIC_VECTOR(2 DOWNTO 0); 

HEX0 : OUT STD_LOGIC_VECTOR(0 TO 6)); 

END CHAR_7SEG; 

ARCHITECTURE behaviour4 OF CHAR_7SEG IS 

BEGIN  

case c is 

WHEN 000 =>  

HEX0 <="76" ; 

WHEN 001 =>  

HEX0 <= "79"; 

WHEN 010=>  

HEX0 <= "38"; 

WHEN 011=>  

HEX0 <= "38"; 

WHEN 100=>  

HEX0 <= "3F"; 

WHEN OTHERS => 

HEX0 <= "00"; 

END case; 

END behaviour4; THE ERROR SHOWING IS ---->> Error (10500): VHDL syntax error at CHAR_7SEG.vhd(22) near text "case"; expecting ";", or an identifier ("case" is a reserved keyword), or "architecture" . HOW TO CORRECT THIS ERROR??
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
532 Views

case statements need to be inside a process.

0 Kudos
Altera_Forum
Honored Contributor II
532 Views

Outside a process you can write :  

WITH c SELECT HEX <= "01110110" when "000", "01111001" when "001", .... "00000000" when others;  

WITH c SELECT HEX <= x"76" when "000", x"79" when "001", .... x"00" when others;  

But be aware that you are writing a MUX. It produces glitches.
0 Kudos
Reply