|
1. VHDL程序的组成 一个完整的VHDL程序是以下五部分组成的:
2. 库(LIBRARY):比较好理解,调用系统已有的库,WORK库就是用户当前编辑文件所在的文件夹, IEEE库:由IEEE(美国电子电机工程师学会)制定的标准库 LPM库
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.math_real.all;
use IEEE.std_logic_arith.all;
3. 程序包(PACKAGE):声明在设计中将用到的常数、数据类型、元件及子程序
4. 实体(ENTITY):声明本设计的接口引脚,输入输出引脚,写法一般是引脚名字:接口方向:标准逻辑
复制代码
entity TempSensorCtl is
Generic (CLOCKFREQ : natural := 100); -- input CLK frequency in MHz
Port (
TMP_SCL : inout STD_LOGIC;
TMP_SDA : inout STD_LOGIC;
-- TMP_INT : in STD_LOGIC; -- Interrupt line from the ADT7420, not used in this project
-- TMP_CT : in STD_LOGIC; -- Critical Temperature interrupt line from ADT7420, not used in this project
TEMP_O : out STD_LOGIC_VECTOR(12 downto 0); --12-bit two's complement temperature with sign bit
RDY_O : out STD_LOGIC; --'1' when there is a valid temperature reading on TEMP_O
ERR_O : out STD_LOGIC; --'1' if communication error
CLK_I : in STD_LOGIC;
SRST_I : in STD_LOGIC
); |
|