LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
---------------------------
PACKAGE MY_PACKAGE IS
TYPE ROM IS ARRAY(0 TO 7) OF STD_LOGIC_VECTOR(3 DOWNTO 0);
END MY_PACKAGE;
---------------------------
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
USE WORK.MY_PACKAGE.ALL;
---------------------------
ENTITY ROMS IS
PORT(ADDR:IN STD_LOGIC_VECTOR(3 DOWNTO 0);
DATA:OUT STD_LOGIC_VECTOR(3 DOWNTO 0));
END ROMS;
---------------------------
ARCHITECTURE ROMS OF ROMS IS
CONSTANT MY_ROM1:ROM:=("0000","0001","0010","0011","0100","0101","0110","0111");
CONSTANT MY_ROM2:ROM:=("1000","1001","1010","1011","1100","1101","1110","1111");
SIGNAL SEL: STD_LOGIC;
SIGNAL ADD: STD_LOGIC_VECTOR(2 DOWNTO 0);
SIGNAL AD : INTEGER;
BEGIN
SEL<=ADDR(3);
ADD<=ADDR(2 DOWNTO 0);
AD <=CONV_INTEGER(AD);
CASE SEL IS
WHEN '0' => DATA<=MY_ROM1(AD);
WHEN '1' => DATA<=MY_ROM2(AD);
WHEN OTHERS => DATA<="ZZZZ";
END CASE;
END ROMS;
这是我练习的程序,就是模仿ROM,输入一个地址,输出对应处的数据。但是在case那里总是出错:
Error (10500): VHDL syntax error at ROMS.vhd(29) near text "CASE"; expecting "end", or "(", or an identifier ("case" is a reserved keyword), or a concurrent statement
Error (10500): VHDL syntax error at ROMS.vhd(31) near text "WHEN"; expecting "end", or "(", or an identifier ("when" is a reserved keyword), or a concurrent statement
类似这种错误。
我一开始用if语句,就一直出这种错,改了几次后,改成case,还是这样 expecting "end", or "(", or an identifier的错误。
求助!!谢谢!!
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
不懂VHDL,
但是语法错误,怎么都好办吧?!
一周热门 更多>