版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
VHDL数字电路课程实验报告实验一8分频器一、实验要求:分别用信号量和变量实现八分频器二、实验过程:1、代码:8分频器vhdlibraryieee;useieee.std_logic_1164.all;entityfreq_dividerisport(clk:instd_logic;out1,out2:bufferbit);endfreq_divider;architectureexampleoffreq_dividerissignalcount1:integerrange0to7;beginprocess(clk)variablecount2:integerrange0to7;beginif(clk'eventandclk='1')thencount1<=count1+1;count2:=count2+1;if(count1=3)thenout1<=notout1;count1<=0;endif;if(count2=4)thenout2<=notout2;count2:=0;endif;endif;endprocess;endexample;八分频器tbLIBRARYieee;USEieee.std_logic_1164.all;ENTITYfd_tbisENDfd_tb;architecturebehavioroffd_tbiscomponentfreq_dividerport(clk:INSTD_LOGIC;out1,out2:bufferbit);endcomponent;signalclk:std_logic;signalout1,out2:bit;beginu1:freq_dividerportmap(clk,out1,out2);processbeginclk<='0';waitfor50ns;loopclk<=notclk;waitfor25ns;endloop;endprocess;endbehavior;2、结果图:实验二实现例8.6实验要求:电路只有一个输入时钟信号,输出信号在适中的两个边沿都会发生变化实验内容:代码信号发生器vhdENTITYsignal_genISPORT(clk:INBIT;outp:OUTBIT);ENDsignal_gen;ARCHITECTUREfsmOFsignal_genISTYPEstateIS(one,two,three);SIGNALpr_state1,nx_state1:state;SIGNALpr_state2,nx_state2:state;SIGNALout1,out2:BIT;BEGINPROCESS(clk)BEGINIF(clk'EVENTANDclk='1')THENpr_state1<=nx_state1;ENDIF;ENDPROCESS;PROCESS(clk)BEGINIF(clk'EVENTANDclk='0')THENpr_state2<=nx_state2;ENDIF;ENDPROCESS;PROCESS(pr_state1)BEGINCASEpr_state1ISWHENone=>out1<='0';nx_state1<=two;WHENtwo=>out1<='1';nx_state1<=three;WHENthree=>out1<='1';nx_state1<=one;ENDCASE;ENDPROCESS;PROCESS(pr_state2)BEGINCASEpr_state2ISWHENone=>out2<='1';nx_state2<=two;WHENtwo=>out2<='0';nx_state2<=three;WHENthree=>out2<='1';nx_state2<=one;ENDCASE;ENDPROCESS;outp<=out1ANDout2;ENDfsm;信号发生器tbentitytb_fsmisendtb_fsm;architecturebehavioroftb_fsmiscomponentsignal_genisport(clk:inbit;outp:outbit);endcomponent;signalclk,outp:bit;beginu1:signal_genportmap(clk,outp);processbeginclk<='0';waitfor20ns;loopclk<=notclk;waitfor10ns;endloop;endprocess;endbehavior;结果图实验三常数比较器实验要求常数比较器,用于比较的变量位宽应大于等于常数实验内容代码常数比较器vhdLIBRARYieee;USEieee.std_logic_1164.all;entitycompareisport(b:inintegerrange0to15;x1,x2,x3:outstd_logic);endcompare;architecturecompareofcompareisconstanta:integer:=10;beginx1<='1'whena>belse'0';x2<='1'whena=belse'0';x3<='1'whena<belse'0';endcompare;常数比较器tbLIBRARYieee;USEieee.std_logic_1164.all;entitytb_compareisendtb_compare;architecturebehavioroftb_compareiscomponentcompareport(b:inintegerrange0to15;x1,x2,x3:outstd_logic);endcomponent;signalb:integer;signalx1,x2,x3:std_logic;beginu1:compareportmap(b,x1,x2,x3);processbeginb<=5;waitfor10ns;b<=8;waitfor10ns;b<=10;waitfor10ns;b<=13;waitfor10ns;b<=10;waitfor10ns;b<=3;waitfor10ns;endprocess;endbehavior;结果图实验四序列检测器实验要求序列检测’1001’弱检测到,输出‘1‘,否则输出’0‘实验内容状态图ZZeroq=0fourq=1twoq=0oneq=0threeq=0d=0d=1d=1d=1d=1d=1d=0d=0d=0rstd=0代码序列检测器vhdlibraryieee;useieee.std_logic_1164.all;entitystring_detectorisport(datain,clk:inbit;q:outbit);endstring_detector;architecturesdofstring_detectoristypestateis(zero,one,two,three,four);signalpr_state,nx_state:state;beginprocess(clk)beginif(clk'eventandclk='1')thenpr_state<=nx_state;endif;endprocess;process(datain,pr_state)begincasepr_stateiswhenzero=>q<='0';if(datain='1')thennx_state<=one;elsenx_state<=zero;endif;whenone=>q<='0';if(datain='0')thennx_state<=two;elsenx_state<=zero;endif;whentwo=>q<='0';if(datain='0')thennx_state<=three;elsenx_state<=zero;endif;whenthree=>q<='0';if(datain='1')thennx_state<=four;elsenx_state<=zero;endif;whenfour=>q<='1';nx_state<=zero;endcase;endprocess;endsd;序列检测器tb------------------------------------------------------------------libraryieee;useieee.std_logic_1164.all;------------------------------------------------------------------entitytestBenchisendtestBench;------------------------------------------------------------------architecturetestoftestBenchiscomponentstring_detectorisport(datain,clk:inbit;q:outbit);endcomponent;signaldatain,clk:bit;signalq:bit;beginSD:string_detectorportmap(datain,clk,q);processbeginforiin0to100loopclk<='0';waitfor10ns;clk<='1';waitfor10ns;endloop;endprocess;processbegindin<='1';waitfor20ns;din<='0';waitfor20ns;din<='0';waitfor20ns;din<='0';waitfor20ns;din<='1';waitfor20ns;
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 北京市丰台区东铁匠营街道蒲黄榆社区卫生服务中心招聘1人笔试备考题库及答案解析
- 2025广东云浮市云安区统计局招聘社会化购买服务人员2(公共基础知识)综合能力测试题附答案
- 2025年合肥市杭州路幼儿园招聘(公共基础知识)综合能力测试题附答案
- 2025广东河源市连平县退役军人事务局招聘编外人员3人参考题库附答案
- 2025年仁寿县从三支一扶计划人员中考核招聘乡镇事业单位工作人员岗位调减备考题库附答案
- 2025安徽宣城宁国市面向社会招聘社区工作者25人(公共基础知识)综合能力测试题附答案
- 2025招商局集团下属企业纪检监察岗位招聘(公共基础知识)综合能力测试题附答案
- 2025年12月杭州市公安局滨江区分局招聘警务辅助人员20人考试参考题库附答案
- 2025广东茂名中共信宜市委办公室、中共信宜市委机关事务管理局选调公务员5人(公共基础知识)综合能力测试题附答案
- 2025年安徽大龙湾开发有限责任公司招聘第三批10人考前自测高频考点模拟试题附答案
- 教育机构安全生产举报奖励制度
- 妊娠合并胆汁淤积综合征
- GB/T 4706.11-2024家用和类似用途电器的安全第11部分:快热式热水器的特殊要求
- FZ∕T 61002-2019 化纤仿毛毛毯
- 《公输》课文文言知识点归纳
- 碎石技术供应保障方案
- 园林苗木容器育苗技术
- 23秋国家开放大学《机电一体化系统设计基础》形考作业1-3+专题报告参考答案
- 2023年工装夹具设计工程师年终总结及下一年计划
- 第七章腭裂课件
- 儿科学热性惊厥课件
评论
0/150
提交评论