




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、班级 021039学号 02103121eda报告题 目 vhdl设计初步学院 电子工程学院专业信息对抗技术学生姓名 导师姓名eda大作业目录第一章实验部分(秒表)21、程序设计:22、程序代码23、程序调试4第二章习题部分8习题一8习题二8习题三10习题四11习题五12习题六14习题七1724第一章 实验部分(秒表)1、程序设计:秒表显示共有6位,两位显示分,两位显示秒,十分秒和百分秒各一位。设 计时使用一个计数器,随着时钟上升沿的到来循环计数, 每计数一次,百分秒位 加一,通过百分秒位满十进位来控制十分位的计数,十分位满十进位,依次类推,实现秒表计数。为实现秒位的计时精确,百秒位必须以 0
2、.01秒的时间间隔计数,即时钟的频 率是100h乙为此,本设计采用3mhz的时钟频率通过分频得到100hz的时钟频 率,再送给控制时钟以得到比较精确的 clk信号。其中,时钟信号 clk为3mhz 的时钟频率,分频后得到的时钟为 clkz输出引脚clk2和输入弓|脚clk2在外 部相连,实现将分频后的时钟送入。2、程序代码library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity miaobiao isport (clk,clk1,sta,pos,sto,rst: in std_logic;cq
3、1,cq2,cq3,cq4,cq5,cq6 : out std_logic_vector(3 downto 0); clk2:out std_logic );end miaobiao;architecture behav of miaobiao isbeginprocess(clk)由频率为3mhz的时钟产生频率为100hz的时钟variable num:integer range 0 to 15000o 数器variable q:std_logic;beginif clkevent and clk=仃 henif num=15000 then num:=0;q:=not q件数器每计数 15
4、000,时钟改变电平-值else num:=num+1;end if;end if;clk20);cqi2:=(others=0);cqi3:=(others=0);cqi4:=(others=0);cqi5:=(others=0);cqi6:=(others=0);elsif clk1event and clk1=thenif sta=1 thenif rst=0 thenif pos=0 thenif cqi1=1001 then cqi1:=(others = ;分秒位满十进-位if cqi2=1001 then cqi2:=(others = 0);分秒位满十进-位if cqi3=10
5、01 then cqi3:=(others = 喇位满十进位if cqi4=0101 then cqi4:=(others = 0);秒位满六进位if cqi5=1001 then cqi5:=(others = %位满十进位if cqi6=0101 then cqi6:=(others = 0);分位满六进位else cqi6:=cqi6+1;end if;else cqi5:=cqi5+1;end if;else cqi4:=cqi4+1;end if;else cqi3:=cqi3+1;end if;else cqi2:=cqi2+1;end if;else cqi1:=cqi1+1;e
6、nd if;end if;end if;end if;if rst=1 thencqi1:=(others = 0);cqi2:=(others = 0);cqi3:=(others = 0);cqi4:=(others = 0);cqi5:=(others = 0);cqi6:=(others = 0);end if;cq1=cqi1;cq2=cqi2;cq3=cqi3;cq4=cqi4;cq5=cqi5;cq6 |fllp-fl1 h口m 0谢. b好心餐品4wh 面团选id i3 9,之受w m3* i 口神|口03-1 )同 tie*: 口 q ime* 1.1 an*aa 3g hm
7、tfsi dig 100 ok 闻口陋 3kw 2w0rrii 300(1 附 30m 400 dm 用gcm 9ng ihdihfi gdq * 6930m 700 he me 孙 mf 双由 r , . 9q0*i 烟 jhc h晦t 取j 口健kruuuwlrmnjmrwwuuwwumjwwmnnmuuuuwmnjumjwlr rmjlnjirlruirlnnrlrlrlnrruulrumjwlrlnnnnnrumnjlrlmrlrumnnrlnrrmrc g fm c c c三三b 00(2)给时钟后,实现暂停功能: + 心卡;ii - 4 3 x* - bl-lli bf. 3c -
8、 .正 ejl 1:3t q g之tpluf ii il* ht odi xilcti ifuliiitx qrhtu hind” h*lp01底。屏|e| -般占&的怂总产盅园热口也品惠更富s!jref p.ons1 |*|+j tim |43j.dnairtetvaf |434.0ns|taw正namavalue: j?0即63000ns 4codn5w put即005tdcj ons 00 on;gp昭10us1.1usl3-sto0st41i il j3wcq2qcooac04wcq5 勺ccem cqi1 dz cqq 必cos w cqmi coe 而cqbhd的咬电美能隗回燧啖励
9、忸,林0日观笆耽顾屈国苑uhd xi2r3y d ihdhd0hd口hd口h0砥面丽躁/胸函函(陶歌蟆x.0.*隔砥巡面而南(:喻hq 11e2xmk 4;hd0;hd 0hdhdd(3)给时钟后,实现复位功能:d: jj hal。闽.eiabl咧 /疫国凸曲必 窗eiaj豆惠道明瞩明xij lnlco-al 155pmam也iv-5to400.ant500 口时eolq 砧700 0nec0m 900 ona1.0u1.1u1.2u2-卫丁科1-fosiclkl egnnrjuuuumnnnnnrjmjuumnmrjulwllmulkjmwwjmwwirjuuiirmnn川juuinnwju
10、i皿皿win皿jui皿皿nzkmvqc3qcgbqcq4wcq&lv can* coi4w cqi5_lhohqhqhohohohohohqhq龙包幽处侬则(焚移幽鲤施心一_0一。函函冏函幽谭函ci2i3x0k 1)dd(5)综合功能地实现:u4.1p iz - :工3.用fa ipbi hr.itafqrh edli l?rl甘 fix+plilt xi 工钝. *i t*g& dreep tal-i 4 i ai. qpti can 工i nw *1|)口酉ri倒;t:|划印卷i g单me白营屈而暴 用口劭”居起隹,阿为rh sdnsa|mamevalue.iso dns2000nszoj
11、.dns40: qns500 drueoqdnsjj i国土70a 口l stoji-sta0回srst“pqsan国l clk10芭所clka-e clk203 cq1hd3 c(j2hou cg3hu2 cq4hdcq5hoa cffihdtsz cqi1ho# cacholiz cquhdq cq|4how cqi5hdhqlriltlj inju ,tjltltllttl_ _ltltltlt1 i_nlt lti_n i_nlrjltlin inltultlru rmltu jumfltld世足9?jlras21给n口:0d0 wkhunh口k/加awo:口0dq第二章习题部分习题一
12、(ex-1)画出下例实体描述对应的原理图符号元件:实体1:三态缓冲器输入端使能端输出端实体2: 2选1多路选择器entity buf3s is-port (input : in std_logic ;- enable : in std_logic ;- output : out std_logic );-end buf3x ;entity mux21 is-port (in0, in1, sel : in std_logic;output : out std_logic);inoin1outpulsel21 muxend entity mux21;4习题二(ex-2)图中所示的是4选1多路选择
13、器,试分别用if_them句和cases句 的表达方式写出此电路的vhdls序。选择控制的信号s1和s0为std_logic_vector;当 s1=0 , s0=0 ; s1=0 , s0=1 ; s1=1 , s0=0和 s1=1 , s0=1分另u执行 y=a、y=b、yv=c、yv=d。vhdl程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity mux41a is-4个数据输入端-2个信号控制输入端-数据输出端口port(a,b,c,d:in std_logic;s0,s1
14、:in std_logic;y:out std_logic);end mux41a;architecture behavior of mux41a is-7e乂内部信号abc-abc为s1和s0的位与signal abc : std_logic_vector(1 downto 0);beginabc y y y yy =null ;end case;end process;end architecture behavior ;习题三(ex-3)图中所示的是双2选1多路选择器构成的电路 muxk对于其中mux21a 当s=0和1时,分别有y=a和y temp temp output output
15、=temp;end case;end process;end behav;习题四(ex-4)图中是一个含有上升沿触发的d触发器的时序电路,试写出此电路的 library ieee;vhd殴计文件。use ieee.std_logic_1164.all;entity ex5 isport (cl:in std_logic;clk:in std_logic;output:buffer std_logic);end ex5;architecture behav of ex5 isbeginprocess (clk)beginif (clkevent and clk=1) then output=no
16、t(cl or output);end if;end process;end behav;习题五(ex-5)给出1位全减器的vhdl的述。要求:(1)首先设计1位半减器,然后用例化语句将它们连接起来,图中h_suber 是半减器,diff是输出差,s_out是借位输出,sub_in是借位输入。sub(2)以1位全减器为基本硬件,构成串行借位的8位减法器,要求用例化语句来完成此项设计(减法运算是x - y - sun_in = diffr) 。y-定义实体半减器-减数与被减数-分别为本位输出和借位输出library ieee;use ieee.std_logic_1164.all;entity
17、h_suber isport(x,y:in std_logic;diff,s_out:out std_logic);end h_suber;architecture fd1 of h_suber isbegindiff=x xor y;s_out=(not x)and y;end fd1;library ieee;use ieee.std_logic_1164.all;entity or_2 isport (a,b:in std_logic;c:out std_logic);end or_2;architecture one of or_2 isbegincx0,y=y0,diff=d,s_o
18、ut=e);-弓 i 用半减器u2:h_suber port map(x=d,y=sub_in,diff=diffr,s_out=f);-弓 i 用半减器 u3:or_2 port map(a=f,b=e,c=sub_out);-弓 i 用或门end fs1;习题六(ex-6)根据下图,写出顶层文件 mx3256.vhd勺vhd段计文件library ieee;use ieee.std_logic_1164.all;entity diff is定义实体d触发器port(d,clk:in std_logic;clear:in std_logic;q:out std_logic);end enti
19、ty diff;architecture behav of diff isbeginprocess (clear,d,clk)beginif (clkevent and clk=1) thenif (clear=0) then q=0;-else q=d;end if;end if;end process;end behav;library ieee;use ieee.std_logic_1164.all;entity jk is-port(a1,a2,clk: in std_logic;o1,o2: buffer std_logic);end;architecture behav1 of j
20、k issignal o1_s,o2_s:std_logic;o1_s,o2_sbeginprocess(a1,a2,clk,o1_s,o2_s) beginif(clkevent and clk=1)then if(a1=0)and(a2=1)theno1_elsif (a1=1)and(a2=0)then o1elsif(a1=1)and(a2=1)theno,o2;end if;end if;o1=o1_s;o2=o2_s;end process-时钟信号到来异步清零-定义实体jk触发器-定义内部信号_ s=0, o2_s=1;_s=1,o2_s=0;_s=not o1; o2_s=no
21、tend behavllibrary ieee;use ieee.std_logic_1164.all;entity mux21 isport (a,b,s:in std_logic;c:out std_logic);end entity;architecture behav2 of mux21 isbeginprocess (a,b,s)beginif s=0 then c=a;else cina,a2=inb,clk=inclk,o1=aa,o2=bb);-弓i用jk触发器u2: diff port map (d=bb,clk=inclk,clear=inc,q=cc);-弓i用 d 触发器u3: jk port map (a1=bb,a2=cc
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年法制安全教育知识比赛试题(含答案)
- 2025年学历类自考学前儿童科学教育-中国行政史参考题库含答案解析(5套试卷)
- 继电器快速响应机制-洞察及研究
- 2025年学历类自考学前儿童发展-幼儿文学参考题库含答案解析(5套试卷)
- 2025年公共营养试题及答案
- 警察公寓出售合同范本
- 2025年学历类自考中外教育简史-现代管理学参考题库含答案解析(5套试卷)
- 厂区翻新保洁合同范本
- 学校广告施工合同范本
- 建房包工付款合同范本
- 2025年安全生产考试题库:安全生产隐患排查治理实操技能试题汇编
- 员工烧烤联谊活动方案
- 中国鱼腥草素钠栓行业市场发展前景及发展趋势与投资战略研究报告(2024-2030)
- 农村教育现状分析
- 胆道疾病的检查与护理
- QGDW11970.7-2023输变电工程水土保持技术规程第7部分水土保持设施质量检验及评定
- 初中道德与法治学科阅读力培养的有效性探究
- JG/T 396-2012外墙用非承重纤维增强水泥板
- 预付电费协议书
- 2025年电动港机装卸机械司机(高级技师)职业技能鉴定理论考试题库(含答案)
- 酒吧消防火灾应急预案(3篇)
评论
0/150
提交评论