版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025山东水发集团有限公司招聘(216人)笔试历年典型考点题库附带答案详解
- 2025安徽滁州市全椒县水务公司劳务外包人员招聘11人笔试历年典型考点题库附带答案详解
- 2025天津市今晚网络信息技术股份有限公司面向社会招聘20人笔试历年典型考点题库附带答案详解
- 2025国家电投集团浙江公司招聘15人笔试历年备考题库附带答案详解
- 2025四川长虹新网科技有限责任公司招聘软件设计师等岗位56人笔试历年难易错考点试卷带答案解析
- 2025四川成都兴城投资集团有限公司成都蓉城康养集团有限公司招聘项目投拓岗等岗位2人笔试历年备考题库附带答案详解
- 2025四川川藏工业园区发展有限责任公司招聘12名合同制员工拟聘用人员笔试历年难易错考点试卷带答案解析
- 关于2026年产品交付时间调整通知函8篇范文
- 2025内蒙古鄂尔多斯电力冶金集团股份有限公司招聘23人笔试历年备考题库附带答案详解
- 2025内蒙古能源集团有限公司招聘(137人)笔试历年备考题库附带答案详解2套试卷
- 2025年上半年生产线工作总结范文
- 医务人员职业道德教育培训总结
- 民事案件课件
- 母婴同室院感管理课件
- 海尔冰箱BCD-257DVC使用说明书
- 2025年《老年人能力评估实务》课程标准(含课程思政元素)
- 贷款培训课件下载
- 寺院用工合同范本
- 兽医防治员职业技能理论知识考试题及答案
- YY 1001-2024全玻璃注射器
- 《我的情绪我做主》心理健康课件
评论
0/150
提交评论