数字系统设计:2.4 VHDL主要描述方式_第1页
数字系统设计:2.4 VHDL主要描述方式_第2页
数字系统设计:2.4 VHDL主要描述方式_第3页
数字系统设计:2.4 VHDL主要描述方式_第4页
数字系统设计:2.4 VHDL主要描述方式_第5页
已阅读5页,还剩11页未读 继续免费阅读

下载本文档

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

文档简介

2.4VHDL主要描述方式VHDL主要描述方式(1)行为描述方式(2)数据流描述方式(3)结构描述方式(4)混合描述方式(略)行为描述方式特点:常以算法形式描述电路功能,不体现电路结构。用于系统数学模型的仿真或者系统工作原理的仿真。大量采用算术运算、关系运算等。例:全加器libraryieee;useieee.std_logic_1164.all;entityFAisport(x,y,ci:instd_logic;s,co:outstd_logic);endFA;architecturebehavofFAis行为描述方式

beginprocess(x,y,ci)variablen:integer;constantsum_vector:std_logic_vector(0to3):=“0101”;constantcarry_vector:std_logic_vector(0to3):=“0011”;beginn:=0;ifx=’1’thenn:=n+1;endif;ify=‘1’thenn:=n+1;endif;ifci=’1’thenn:=n+1;endif;s<=sum_vector(n);co<=carry_vector(n);endprocess;endbehav;此为查表法数据流描述方式

特点:既表示行为,又隐含着结构;体现数据的流动路径和方向

例:全加器entityFAisport(…..);endFA;architecturedataflowofFAissignals:std_logic;begins<=xXORyXORci;co<=(xANDy)OR(xANDci)OR(yANDci);enddataflow;

特点:描述电路元件与它们之间的连接关系

结构描述方式半加器

LibraryIEEE;Usestd_logic_1164.all;Entityhalf_adderisport(X,Y:inbit;sum,carry:outbit);endhalf_adder;Architecturedataflowofhalf_adderisbegin--并行处理语句

sum<=XxorYafter10ns;carry<=XandYafter10ns;Enddataflow;全加器

LibraryIEEE;Usestd_logic_1164.all;Entityfull_adderis Port(A,B,carry_in:inbit;AB,carry_out:outbit);Endfull_adder;Architecture

structureoffull_adderis

Signaltemp_sum:bit;--定义语句

Signaltemp_carry1:bit;

Signaltemp_carry2:bit;

Componenthalf_adderPort(X,Y:inbit;sum,carry:outbit);Endcomponent;

Componentor_gatePort(in1,in2:inbit;out1:outbit);Endcomponent;全加器Begin--并行语句U0

:half_adder元件例化语句

Portmap(X=>A,Y=>B,sum=>temp_sum,carry=>temp_carry1);名称映射U1

:half_adderPortmap(X=>temp_sum,Y=>carry_in,sum=>AB,carry=>temp_carry2);U2:or_gatePortmap(in1=>temp_carry1,in2=>temp_carry2,out1=>carry_out);Endstructure;层次化设计结构描述写出位置映射。元件例化语句Component元件名

Generic说明;

Port说明;

EndComponent;Component语句用于Architecture、Package、Block说明语句中。标号名:元件名portmap(信号,…);位置映射和名称映射练习题请写出下列组合逻辑的结构描述方式entityAnd2isport(x,y:inbit;z:outbit);endAnd2;architectureex1ofAnd2isbeginz<=xandy;endex1;先写与门(底层)entityOr2isport(x,y:inbit;z:outbit);endentityOr2;architectureex1ofOr2isbeginz<=xory;endarchitectureex1;再写或门(底层)entityNot1isport(x:inbit;z:outbit);endentityNot1;architectureex1ofNot1isbeginz<=notx;endarchitectureex1;再写非门(底层)entitycomb_functionis port(a,b,c:inbit;z:outbit);endentitycomb_function;

architecturenetlistofcomb_functionis

componentAnd2is port(x,y:inbit;z:outbit); endcomponentAnd2; componentOr2is port(x,y:inbit;z:outbit); endcomponentOr2; componentNot1is port(x:inbit;z:outbit); endcomponentNot1;

signalp,q,r:bit;最后按层次化写顶层模块beging1:Not1

温馨提示

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

评论

0/150

提交评论