欢迎来到三一办公! | 帮助中心 三一办公31ppt.com(应用文档模板下载平台)
三一办公
全部分类
  • 办公文档>
  • PPT模板>
  • 建筑/施工/环境>
  • 毕业设计>
  • 工程图纸>
  • 教育教学>
  • 素材源码>
  • 生活休闲>
  • 临时分类>
  • ImageVerifierCode 换一换
    首页 三一办公 > 资源分类 > PPT文档下载  

    VHDL实验新及答案.ppt

    • 资源ID:4977967       资源大小:172.04KB        全文页数:34页
    • 资源格式: PPT        下载积分:10金币
    快捷下载 游客一键下载
    会员登录下载
    三方登录下载: 微信开放平台登录 QQ登录  
    下载资源需要10金币
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    VHDL实验新及答案.ppt

    实验1熟悉实验环境,完成下述实验内容:2输入与门、2输入或门、2输入异或门及非门的设计。D触发器的设计。带有异步清零、异步置位功能的边沿JK触发器的设计。,1-1代码,非门LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;ENTITY NOT IS PORT(A:IN STD_LOGIC;Y:OUT STD_LOGIC);END ENTITY NOT;ARCHITECTURE ART OF NOT IS BEGIN Y=NOT A;END ARCHITECTURE ART;,1-1代码,异或门LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;ENTITY XOR2 IS PORT(A,B:IN STD_LOGIC;Y:OUT STD_LOGIC);END ENTITY XOR2;ARCHITECTURE ART OF XOR2 IS BEGIN Y=A XOR B;END ARCHITECTURE ART;,1-2代码,D触发器的设计library ieee;use ieee.std_logic_1164.all;entity d_chufa is port(clk,d:in std_logic;q:out std_logic);end d_chufa;architecture behav of d_chufa isbeginprocess(clk)isbeginif(clk event and clk=1)thenq=d;end if;end process;end behav;,1-3代码,异步清零、异步置位功能的边沿JK触发器library ieee;use ieee.std_logic_1164.all;entity jk isport(pset,clr,clk,j,k:in std_logic;q,qb:out std_logic);end entity;architecture behav of jk issignal q_s,qb_s:std_logic;beginprocess(pset,clr,clk,j,k)beginif(pset=0)and(clr=1)thenq_s=1;qb_s=0;elsif(pset=1)and(clr=0)thenq_s=0;qb_s=1;elsif(clk event and clk=1)thenif(j=0)and(k=1)thenq_s=0;qb_s=1;elsif(j=1)and(k=0)thenq_s=1;qb_s=0;elsif(j=1)and(k=1)thenq_s=not q_s;qb_s=not qb_s;end if;end if;q=q_s;qb=qb_s;end process;end behav;,实验21,实验内容:完成下述模块的设计,实现真值表中的半加与半减的功能。提示信息:将加法与减法区分成两个功能模块,使用BLOCK语句将构造体分为两大部分。,输 入 值,半 加 法 器(A+B),半 减 法 器(A-B),A,B,Sum,Car,Difference,Borrow,0,0,0,1,1,0,1,1,0,0,1,0,1,0,0,1,0,1,1,0,0,1,0,0,2-1代码,library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity half is port(a,b:in std_logic;sum,car,dif,bor:out std_logic);end half;architecture behav of half isbeging1:blockbeginsum=a xor b;car=a xor b;end block g1;g2:blockbegindif=a xor b;bor=(not a)and b;end block g2;end behav;,实验22,实验内容:设计一个4位加减法器.要求:a,b:数据输入;sub:控制端,高电平实现加法功能,低电平实现减法功能;s:和与差的输出;co:进位与借位的输出。,2-2代码,library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity subadd isport(sub:in std_logic;a,b:in std_logic_vector(3 downto 0);s:out std_logic_vector(3 downto 0);co:out std_logic);end entity subadd;architecture behav of subadd issignal temp:std_logic_vector(4 downto 0);beginprocess(sub,a,b)begin if sub=1 then temp=a+b;else temp=a-b;end if;end process;s=temp(3 downto 0);co=temp(4);end behav;,实验31,实验内容:如下表所示为4位双向通用移位寄存器74LS194的真值表,编写程序描述该逻辑,仿真其功能。,3-1代码,library ieee;use ieee.std_logic_1164.all;entity ls194 is port(clr,s0,s1,clk,l,r:in std_logic;p:in std_logic_vector(3 downto 0);q:out std_logic_vector(3 downto 0);end ls194;architecture behav of ls194 issignal qs:std_logic_vector(3 downto 0);beginprocess(clr,s0,s1,clk,l,r)isbeginif(clr=0)then qs=0000;elsif(clk event and clk=1)then if(s1=1)and(s0=1)then qs=p;elsif(s1=0)and(s0=1)thenif(r=1)then qs(3)=1;qs(2 downto 0)=qs(3 downto 1);elsif(r=0)then qs(3)=0;qs(2 downto 0)=qs(3 downto 1);end if;elsif(s1=1)and(s0=0)thenif(l=1)then qs(0)=1;qs(3 downto 1)=qs(2 downto 0);elsif(l=0)then qs(0)=0;qs(3 downto 1)=qs(2 downto 0);end if;end if;end if;q=qs;end process;end behav;,实验32,实验内容:38译码器的设计(要求用WITHSELECT语句完成)(图形见下页)。提示信息:常见的38译码器的真值表如右:,A0 A1 A2,0 0 0,0 0 1,0 1 0,0 1 1,1 0 0,1 0 1,1 1 0,1 1 1,Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7,1 0 0 0 0 0 0 0,0 1 0 0 0 0 0 0,0 0 1 0 0 0 0 0,0 0 0 1 0 0 0 0,0 0 0 0 1 0 0 0,0 0 0 0 0 1 0 0,0 0 0 0 0 0 1 0,0 0 0 0 0 0 0 1,当EN1时,译码器正常工作;当EN=0时,译码器不动作。,A0,A1,A2,EN,Y0,Y7,3-2代码,library ieee;use ieee.std_logic_1164.all;entity decode3to8 isport(a:in std_logic_vector(2 downto 0);en:in std_logic;y:out std_logic_vector(7 downto 0);end decode3to8;architecture behav of decode3to8 is signal sel:std_logic_vector(3 downto 0);begin sel=a,实验41功能要求:4位数据输入,可表示0F十六个数值。将其译码为共阴极7段LED的显示码。LED的每段和dout的连接关系见下图。模块名:LEDDECODER 输入端口:i数据输入(4位)输出端口:dout译码输出(7位),4-1代码,library ieee;use ieee.std_logic_1164.all;entity leddecoder is port(i:in std_logic_vector(3 downto 0);dout:out std_logic_vector(0 to 6);end leddecoder;architecture behav of leddecoder is begin process(i)begin case i iswhen 0000=doutdoutdoutdoutdoutdoutdoutdoutdoutdoutdoutdoutdoutdoutdoutdoutdout=0000000;end case;end process;end behav;,实验42,实验内容:设计完成一个7位的偶同位产生器。提示信息:同位共分为两种形式:奇同位:数据位与奇同位的1的个数为奇数。偶同位:数据位与偶同位的1的个数为偶数。n位的偶同位产生器的输入信号为n位,输出信号为n+1位,其中前n位为输入信号,最后一位为偶同位位,且保证输出的n+1位信息中1的个数为偶数个。(奇同位产生器工作原理类似),4-2代码,library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity tongwei is port(a:in std_logic_vector(6 downto 0);c:out std_logic_vector(7 downto 0);end entity;architecture behav of tongwei issignal temp:std_logic;begintemp=a(0)xor a(1)xor a(2)xor a(3)xor a(4)xor a(5)xor a(6);c=a,实验51,实验内容:完成1位全加器的设计。提示信息:输入为A,B,C,其中A、B为输入数据,C为输入的进位标志位;输出为Sum和Car,其中Sum为本次运算结果位,Car为本次进位标志位。,5-1代码_,library ieee;use ieee.std_logic_1164.all;entity fulladd is port(a,b,c:in std_logic;car,s:out std_logic);end entity fulladd;architecture behav of fulladd isbegins=a xor b xor c;car=(a and b)or(b and c)or(c and a);end behav;,实验52,实验内容:完成4位全加法器的设计。提示信息:一个4位的全加法器可以由4个1位的全加法器级联而成。,A(0),B(0),S(0),C(1),C(2),C(3),Co,A(1),B(1),S(1),S(2),S(3),A(2),B(2),A(3),B(3),5-2代码_,library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity fulladd4 isport(a,b:in std_logic_vector(3 downto 0);c0:out std_logic;s:out std_logic_vector(3 downto 0);end fulladd4;architecture str of fulladd4 issignal c1,c2,c3:std_logic;signal t:std_logic;component fulladdport(a,b,c:in std_logic;car,sum:out std_logic);end component;begint=0;u1:fulladd port map(a(0),b(0),t,c1,s(0);u2:fulladd port map(a(1),b(1),c1,c2,s(1);u3:fulladd port map(a(2),b(2),c2,c3,s(2);u4:fulladd port map(a(3),b(3),c3,c0,s(3);end architecture str;,实验61,实验内容:设计一个3bits的可逆计数器。提示信息:由名称可以知道,它的计数方式可以加(检测到CLK时钟的上升沿,计数器加1),也可以减(检测到CLK时钟的上升沿,计数器减1)。使用一个控制信号DIR决定计数器是作加法或减法的动作。,6-1代码_,updncount_3 is port(clk,clr,updn:in std_logic;qa,qb,qc:out std_logic);end library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity updncount_3;architecture rtl of updncount_3 is signal count_3:std_logic_vector(2 downto 0);begin qa0);elsif(clkevent and clk=1)then if(updn=1)then count_3=count_3+1;else count_3=count_3-1;end if;end if;end process;end rtl,实验62,实验内容:分频器设计。要求:(1)设计一个占空比为50%的6分频器;(2)设计一个占空比为1:2的6分频器。提示信息:占空比为时钟周期中高电平与低电平之比。,6-2代码(_),library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity fdiv isgeneric(N:integer:=6);port(clkin:in std_logic;clkout:out std_logic);end fdiv;architecture a of fdiv issignal cnt:integer range 0 to n/2-1;n=6signal temp:std_logic;begin process(clkin)beginif(clkinevent and clkin=1)thenif(cnt=n/2-1)thencnt=0;temp=not temp;elsecnt=cnt+1;end if;end if;end process;clkout=temp;end a;,6-2代码,占空比1:2(_),LIBRARY IEEE;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity shiyan62 is port(clkin:in std_logic;rest:in std_logic;clk6fen:out std_logic);end;architecture rtl of shiyan62 is signal counter:std_logic_vector(0 to 2);begin process(clkin,counter,rest)begin if rest=0 then counter=000;elsif clkinevent and clkin=1then if counter5 then counter=counter+1;if counter3 then clk6fen=1;else clk6fen=0;end if;else counter=000;end if;end if;end process;end architecture rtl;,实验71,实验内容:设计完成一10进制加法计数器。该计数器具有同步置数、同步清零的功能。输入信号为:clk,clr,en,datain输出信号为:dataout,co当输入信号clr1时,计数器清零;当置数信号en=1时,计数器装入输入datain为计数初值重新计数;其它情况下,计数器进行10进制加法计数,每计数到9时,输出co1,表示进位。,7-1代码(_),library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity count10 isport(clr,clk,en:in std_logic;datain:in std_logic_vector(3 downto 0);co:out std_logic;dataout:out std_logic_vector(3 downto 0);end count10;architecture behav of count10 issignal tmp:std_logic_vector(3 downto 0);beginprocess(clk)beginif(clk event and clk=1)thenif(clr=1)then tmp=0000;elsif(en=1)thentmp=datain;elsif(tmp=1001)then tmp=0000;co=1;else tmp=tmp+1;co=0;end if;end if;end process;dataout=tmp;end behav;,实验72,实验内容:设计完成100进制加法计数器。要求:采用构造体结构化描述方式由2个10进制计数器级联而成,7-2代码_,顶层文件:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity count100 isport(clk:in std_logic;co:out std_logic;dout1,dout2:out std_logic_vector(3 downto 0);end count100;architecture behave of count100 iscomponent count10 isport(clk:in std_logic;co:out std_logic;dataout:out std_logic_vector(3 downto 0);end component;signal temp:std_logic;beginu1:count10 port map(clk,temp,dout1);u2:count10 port map(temp,co,dout2);end behave;,底层文件:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity count10 isport(clk:in std_logic;co:out std_logic;dataout:out std_logic_vector(3 downto 0);end count10;architecture behave of count10 issignal temp:std_logic_vector(3 downto 0);begindataout=temp;process(clk)beginif(clkevent and clk=1)then if(temp=1001)then temp=0000;co=1;else temp=temp+1;co=0;end if;end if;end process;end behave;,实验8-1,实验内容:LPM兆功能块的使用。对LPM兆功能单元的lpm_fifo模块进行合理的参数设置,借助仿真手段分析输入、输出端口的功能,并进行简单的说明。,实验8-2,实验内容:利用LPM兆功能单元的lpm_fifo模块实现对连续输入的数据的延时。要求:输入数据宽度为8位,延时时间为5个时钟周期。,

    注意事项

    本文(VHDL实验新及答案.ppt)为本站会员(sccc)主动上传,三一办公仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一办公(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    备案号:宁ICP备20000045号-2

    经营许可证:宁B2-20210002

    宁公网安备 64010402000987号

    三一办公
    收起
    展开