VHDL程序结构总结
VHDL程序结构完整版如下:
1。use库文件(必须具备);如:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
2。package定义区,定义使用哪些自定义元件库(非必须具备);
3。entity实体部分,定义电路的外观,I/O接口的规格(必须具备);如:
entity myor is
port(or0:instd_logic;
or1:instd_logic;
result:out std_logic);
end entity;
4。architecture构造体部分,描述电路内部功能,说明电路执行什么动作和功能(必须具备);其内容如下:
component定义区;
信号定义;
“behavior描述” 或者 “data flow描述即rtl描述” 或者 “structure描述”;
5。configuration定义区,决定哪个architecture被使用(非必须具备);
示例程序如下:
--************************************
library ieee; --use定义区&标准定义定义库
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
--*************************************
entity example is --实体定义区
port(
pin48:in std_logic;
pin7:out std_logic
);
end example;
--*************************************
architecture aaa of example is --构造体定义区
begin
pin7<=pin48; --程序
end aaa;
---------------------ok,太晚了,睡觉了。
吞风吻雨葬落日未曾彷徨 8023U1314