日志档案

发表于 2008-1-7 23:18:36

0

标签: 无标签

VHDL的package使用(有疑惑)

package的作用就是 程序包首的说明语句可收集多个VHDL设计所需的公共信息。弄了好久才勉强的能够

---在一个文件中,两者顺序严格这样,否则出现找不到“类型”提示-------

-------这是对package的声明-------------

library IEEE;
use IEEE.STD_LOGIC_1164.all;

package mcu_package is
  type command_type is (MOVE,ADD,SUB,MUL,CJE,LOAD,READ0,NOP);
  type register_type is (reg0,reg1,reg2,reg3,reg4,reg5,reg6,reg7,reg8,reg9,reg10,reg11,reg12,reg13,reg14,reg15);
  type array_size is array (0 to 15) of std_logic_vector(31 downto 0);
  constant ZERO   : std_logic_vector (31 downto 0) := (others =>'0');
end mcu_package;

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
library work;    -------重新声明
use work.mcu_package.all;   -------重新声明

这样声明后才不会出现不认“类型”的状况。有点怪!!!不知道为什么???

系统分类: 汽车电子   |   用户分类: 无分类   |   来源: 无分类   |   【推荐给朋友】

    阅读(526)    回复(0)  

投一票您将和博主都有获奖机会!