已阅读5页,还剩17页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
信号与变量,区别useIEEE.STD_LOGIC_1164.ALL;entitycount_onesisport(din:instd_logic_vector(7downto0);ones:outintegerrange0to8);endcount_ones;architecturenot_okofcount_onesissignaltemp:integerrange0to8;beginprocess(din)begintemp=0;foriin0to7loopif(din(i)=1)thentemp=temp+1;endif;endloop;ones=temp;endprocess;endarchitecturenot_ok;,libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;entitycount_onesisport(din:instd_logic_vector(7downto0);ones:outintegerrange0to8);endcount_ones;architectureokofcount_onesisbeginprocess(din)variabletemp:integerrange0to8;begintemp:=0;foriin0to7loopif(din(i)=1)thentemp:=temp+1;endif;endloop;ones=temp;endprocess;endarchitectureok;,8,分频器设计,libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;entityfreq_dividerisport(clk,clr:instd_logic;out1,out2:bufferstd_logic);endfreq_divider;architectureBehavioraloffreq_dividerissignalcount1:integerrange0to7;begin,process(clk,clr)variablecount2:integerrange0to7;beginif(clr=1)thencount1=0;count2:=0;out1=0;out2=0;elseif(clkeventandclk=1)thencount1=count1+1;count2:=count2+1;if(count1=?)thenout1=notout1;count1=0;endif;if(count2=?)thenout2=notout2;count2:=0;endif;endif;endif;endprocess;endBehavioral;,10,Cnt1:sigCnt2:var2,2,2,3,4,4,11,触发器设计,libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;entitydffisport(d,clk:instd_logic;q:bufferstd_logic;qbar:outstd_logic);enddff;architecturenot_okofdffisbeginprocess(clk)beginif(clkeventandclk=1)thenq=d;-进程结束后才生效qbar=notq;-进程结束后才生效,q的值此时还没更新!endif;endprocess;endarchitecturenot_ok;,12,qbar延迟了一个周期,13,改进的设计,libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;entitydffisport(d,clk:instd_logic;q:bufferstd_logic;qbar:outstd_logic);enddff;architectureokofdffisbeginprocess(clk)beginif(clkeventandclk=1)thenq=d;endif;endprocess;qbar=notq;endarchitectureok;,14,qbar赋值与进程并发,q变化,qbar立即更新,15,寄存器数量,一个信号的赋值是以另一个信号的跳变为条件时(即发生同步赋值时),编译后产生寄存器。(process、function、procedure中)如果一个变量在还没有进行赋值操作时已被使用,那么综合后就好产生寄存器。一个变量在一个信号跳变时赋值,并且该值最终又被赋给了另外的信号,则综合后会产生寄存器。如果变量的值没有被进程(函数或过程)以外的代码调用,那么不一定产生寄存器。,16,17,18,libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;entitydffisport(d,clk:instd_logic;q:bufferstd_logic;qbar:outstd_logic);enddff;architecturenot_okofdffisbeginprocess(clk)beginif(clkeventandclk=1)thenq=d;-进程结束后才生效qbar=notq;-进程结束后才生效,q的值此时还没更新!endif;endprocess;endarchitecturenot_ok;,19,改进的设计,libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;entitydffisport(d,clk:instd_logic;q:bufferstd_logic;qbar:outstd_logic);enddff;architectureokofdffisbeginprocess(clk)beginif(clkeventandclk=1)thenq=d;endif;endprocess;qbar=notq;endarchitectureok;,20,移位寄存器,entityshiftisport(din,clk:inbit;dout:outbit);endshift;architectureshiftofshiftisbeginprocess(clk)variablea,b,c:bit;beginif(clkeventandclk=1)thendout=c;c:=b;b:=a;a:=din;endif;endprocess;endarchitectureshift;,entityshiftisport(din,clk:inbit;dout:outbit);endshift;architectureshiftofshiftisbeginprocess(clk)variablea,b,c:bit;beginif(clkeventandclk=1)thena:=din;b:=a;c:=b;dout=c;endif;endprocess;endarchitectureshift;,entityshiftisport(din,clk:inbit;dout:outbit);ends
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年河北遴选考试真题及答案
- 协助执行合同
- 2025年国际贸易合同跨国销售协议
- 2025搬迁补偿房的买卖合同
- 采购软件合同
- 2025家电维修合同的预算表
- 知识产权授权合同(标准版)
- 2025商业房租赁合同书范本
- 绿电制加氢一体化示范项目节能评估报告
- xx镇集中供热站及供热管网项目技术方案
- 市场调查与预测(高职市场营销专业)全套教学课件
- 拒绝脏话文明用语(课件)-小学生主题班会
- 人工智能伦理与社会影响的讨论
- 人民美术出版社(北京科学研究院)小学美术五年级上册 7. 各式各样的椅子【市一等奖】
- 酒店经营分析报告模板
- 中国地图素材课件
- 公司弹性工作制管理制度
- 依奇珠单抗注射液-药品解读
- 餐饮服务公司消防培训制度范本
- U3Lesson17Lesson18(课件)六年级英语上册(人教精通版)
- 师德师风证明材料
评论
0/150
提交评论