【FPGA】VHDL设计模型和程序结构

VHDL设计模型

  数据流模型:直接使用基本门和扩展门描述

  行为模型:通过输入输出响应描述

  结构化模型:通过低级器件的内联实现


VHDL程序结构

  Entity(实体)

  Architecture(结构体)

  Configuration(配置)

  Package(包)、Library(库)


Entity(实体)

Entity实体定义格式:

Entity <entity name> is
        Generic Declarations
        Port Declarations
End Entity <entity name>

Entity name :

字母为开头,其余可由字母、数字、下划线组成。

类属声明(Generic Declarations):

作用:用于模型传递信息。

类属里常量声明格式:

  constant 常量名:数据类型 := 设定值;

  数据类型:integer,time,string

  Generic (N : integer := 16 )

端口声明(Port Declarations)

定义格式:

<Class> Object_name : <Mode> <Type>;

<Class> : Signal , (Constant , Variable)

<Mode> :输入方向,in(输入),out(输出),inout(双向),buffer(输出、可反馈)

<Type>  :数据类型,如[ std_logic , std_logic_vector (7 downto 0) ]


Architecture(结构体)


Package(包)、Library(库)

常用库:IEEE

常用包:std_logic_1164 , std_logic_arith , std_logic_signed , std_logic_unsigned

std_logic_1164:包含std_logic、std_vector等类型定义及其相关逻辑类子程序定义

std_logic_arith:包括std_logic类型数据的算术运算子程序定义。(如+、-、*、移位、比较等)

std_logic_signed:std_logic_vector类型的符号数算术运算子程序定义。

std_logic_unsigned:std_logic_vector类型的无符号数算术运算子程序定义。

原文地址:https://www.cnblogs.com/Osea/p/13091955.html