VHDL中的结构设计元件例化语句_第1页
VHDL中的结构设计元件例化语句_第2页
VHDL中的结构设计元件例化语句_第3页
VHDL中的结构设计元件例化语句_第4页
VHDL中的结构设计元件例化语句_第5页
已阅读5页,还剩20页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

VHDL中的结构设计的实例entitybutnotis

port(x,y:inbit;z:outbit);endbutnot;architecturestrofbutnotissignaltemp:bit;componentkinvport(a:inbit;y:outbit);endcomponent;componentkand2port(a,b:inbit;y:outbit);endcomponent;VHDL中的结构设计的实例beginu1:kinvportmap(y,temp);u2:kand2portmap(x,temp,z);endstr;VHDL中的结构设计的特点Architecturestrof实体名is元件说明;--(电路设计中使用的元件及端口)信号说明;--(电路设计中各中间连接点)begin元件使用语句;--(端口与信号(中间连接点及输入/输出端点)的连接关系)endstr;VHDL中的结构设计:元件说明component元件名port(信号名:模式

信号类型;…….

信号名:模式

信号类型);endcomponent;要点:所用的电路实体应在work库或已说明的库中;模块名称和对应端口名称顺序应完全一致;实体与元件说明的对比entitykand2isport(a,b:instd_logic;y:outstd_logic);endkand2;componentkand2port(a,b:instd_logic;y:outstd_logic);endcomponent;VHDL中的结构设计:元件使用元件编号:元件名portmap(信号对应表);元件使用语句要点:对每一元件应该指定唯一的编号;元件名称应该与已经有的元件名称完全一致;元件使用语句为并行语句,只能在结构体中使用,不能在子程序中(函数、过程、进程)使用。信号对应表的格式将本元件的各端口与外部的信号接点或端口建立连接;每个连接应该具有一个唯一的名称;例:原来元件的端口:

port(a,b:instd_logic;y:outstd_logic);顺序关联法:port(data,en,out);名称关联法:port(a=>data,y=>out,b=>en);VHDL中的结构设计的实例质数检测器的结构设计p.284表4-43architectureprime1_archofprimeissignaln3_l,n2_l,n1_l:std_logic;signaln3l_n0,n3l_n2l_n1,n2l_n1_n0,n2_n1l_n0:std_logic;componentkinvport(a:instd_logic;y:outstd_logic);endcomponent;componentkand2port(a0,a1:instd_logic;y:outstd_logic);endcomponent;componentkand3port(a0,a1,a2:instd_logic;y:outstd_logic);endcomponent;componentkor4port(a0,a1,a2,a3:instd_logic;y:outstd_logic);endcomponent;VHDL中的结构设计的实例beginu1:kinvportmap(n(3),n3_l);u2:kinvportmap(n(2),n2_l);u3:kinvportmap(n(1),n1_l);u4:kand2portmap(n3_l,n(0),n3l_n0);u5:kand3portmap(n3_l,n2_l,n(1),n3l_n2l_n1);u6:kand3portmap(n2_l,n(1),n(0),n2l_n1_n0);u7:kand3portmap(n(2),n1_l,n(0),n2_n1l_n0);u8:kor4portmap(n3l_n0,n3l_n2l_n1,n2l_n1_n0,n2_n1l_n0,f);endprime1_arch;相关元件程序libraryieee;useieee.std_logic_1164.all;entitykinvisport(a:instd_logic;y:outstd_logic);endkinv;architecturedatofkinvisbeginy<=nota;end

dat;

libraryieee;useieee.std_logic_1164.all;entitykand2isport(a0,a1:instd_logic;y:outstd_logic);endkand2;architecturedatofkand2isbeginy<=a0anda1;enddat;相关元件程序libraryieee;useieee.std_logic_1164.all;entitykand3isport(a0,a1,a2:instd_logic;y:outstd_logic);endkand3;architecturedatofkand3isbeginy<=a0anda1anda2;enddat;

libraryieee;useieee.std_logic_1164.all;entitykor4isport(a0,a1,a2,a3:instd_logic;y:outstd_logic);endkor4;architecturedatofkor4isbeginy<=a0ora1ora2ora3;enddat;VHDL中的结构设计:generate语句编号:for指标in范围generate元件编号:元件名portmap(信号1,信号2,…);endgenerategenerate语句对同一结构体中使用的多个相同元件进行说明;语句中,指标为整数,不需要定义,各元件对应的信号此时成为数组,其下标由指标范围决定;VHDL中的结构设计:generate语句也可以采用if-generate语句的形式控制电路的结构变化:编号:if关系式generate元件语句;endgenerate;在关系式为true时生成相关的元件;generate语句的使用实例8位总线反相器p.285architecturestrofinv8iscomponentkinvport(a:instd_logic;y:outstd_logic);endcomponent;beging1:forbin7downto0generateu1:kinvportmap(x(b),y(b));endgenerate;endstr;VHDL中的结构设计:generic语句在原有元件中的定义:p.285表4-46

entity….generic(参量名:参量类型;….);port…..在元件语句中赋值:元件编号:元件名genericmap(参量名=>常量值)portmap(信号…);赋值后,参量名由具体常量值所替代。generic语句的使用实例n位总线反相器设计p.285entitybusinvisgeneric(width:positive:=4);port(x:instd_logic_vector(width-1downto0);

y:out

std_logic_vector(width-1downto0));endbusinv;

generic语句的使用实例architecturesofbusinviscomponentkinvport(a:instd_logic;y:outstd_logic);endcomponent;beging1:forbinwidth-1downto0generateu1:kinvportmap(x(b),y(b));endgenerate;ends;generic语句的使用实例16位总线反相器设计:architecturesofinv16iscomponentbusinvisgeneric(width:positive:=4);port(x:instd_logic_vector(width-1downto0);

y:out

std_logic_vector(width-1downto0));endcomponent;beginu1:businvgenericmap(16)portmap(x,y);ends;元件语句的简化使用—宏调用元件的使用通常需要在结构体中进行说明,可能使程序显得很长;在很多综合工具中,允许将这种说明省略,只要进行了包含元件的资源说明,就可以在结构体中直接使用元件名称和相关的语句。宏调用的使用实例16位总线反相器设计:libraryieee;useieee.std_logic_1164.all;usework.all;

entityinv16isport(x:instd_logic_vector(15downto0);

y:out

std_logic_vector(15downto0));endinv16;

architecturesofinv16isbeginu1:businvgenericmap(16)portmap(x,y);ends;宏调用的使用实例8选1数据选择器设计(altera数据库的使用)libraryieee;useieee.std_logic_1164.all;libraryaltera;usealtera.maxplus2.all;

entitymux8_altis

port(a,b,c,gn:in

std_logic;

d:instd_logic_vector(7downto0);

y,wn:out

std_logic);endmux8_alt;

architecturestrofmux8_altisbeginmux:a_74151bportmap(c,b,a,d,gn,y,wn);endstr;宏调用的使用实例24位寄存器的LPM设计(LPM库的使用)libraryieee;

useieee.std_logic_1164.all;librarylpm;

uselpm.lpm_components.all;entityreg24lpmis

port(clk:instd_logic;

d:instd_logic_vector(23downto0);q:outstd_logic_vector(23downto0));endreg24lpm;architecturestrofreg24lpmisbeginreg24:lpm_ffgenericmap(lpm_width=>24)portmap(data=>d(23downto0),clock=>clk,q=>q(23downto0));endstr;结构设计的小结与图形输入设计法最接近,可以最直观地进行逻辑电路图的设计;电路直观,节点清楚

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论