西电EDA满分大作业.docx

上传人:小飞机 文档编号:2792971 上传时间:2023-02-25 格式:DOCX 页数:19 大小:163.89KB
返回 下载 相关 举报
西电EDA满分大作业.docx_第1页
第1页 / 共19页
西电EDA满分大作业.docx_第2页
第2页 / 共19页
西电EDA满分大作业.docx_第3页
第3页 / 共19页
西电EDA满分大作业.docx_第4页
第4页 / 共19页
西电EDA满分大作业.docx_第5页
第5页 / 共19页
点击查看更多>>
资源描述

《西电EDA满分大作业.docx》由会员分享,可在线阅读,更多相关《西电EDA满分大作业.docx(19页珍藏版)》请在三一办公上搜索。

1、精选优质文档-倾情为你奉上 EDA报告 题 目 VHDL设计初步 学 院 电子工程学院 专 业 学 号 导师姓名 朱燕 目录 引言 随着大规模集成电路技术和计算机技术的不断发展,在涉及通信、国防、航天、医学、工业自动化、计算机应用、仪器仪表等领域的电子系统设计工作中,EDA技术的含量正以惊人的速度上升;电子类的高新技术项目的开发也逾益依赖于EDA技术的应用。即使是普通的电子产品的开发,EDA技术常常使一些原来的技术瓶颈得以轻松突破,从而使产品的开发周期大为缩短、性能价格比大幅提高。不言而喻,EDA技术将迅速成为电子设计领域中的极其重要的组成部分。第一章 实验部分(流水灯)开始1、程序设计流程图

2、: 开始模8的计数器输出计数电平4M的分频器输出1HZ38译码器依次输出低电平8个二极管灯依次点亮结束2、模块说明第一部分:分频器 因为主板是cyclong-EP16C6Q240C8的主频是4M赫兹,如果直接当做CLK信号,根本无法看清流水灯的变化,所以需要做分频操作。仿照数电课本的例题中的分频器。分频器的实体:entity devide isport( clk :in std_logic; clk_out:out std_logic );end devide;我们可以从程序中看到,输入时clk(外部主频时钟),输出是clk_out(分频后的时钟)。(这是实体的器件图)分频器的结构体: pro

3、cess;用进程语言描述 begin wait until clkevent and clk=1 if(count)then count=count+1; clk_out=0; else count0); clk_out=1; 我们可以从程序中看到wait until clkevent and clk=1这句是时钟来到意思,当count计数小于时,count自加1,且输出为零,只有当大于时,产生一个高电平脉冲。接下来是对分频器的波形仿真:从波形中我们可以看到分频器的工作.第二部分:模8计数器 我们需要一个计数器来输出计数电频,作为下一步38译码器的输入信号,首先我们来看这个器件的实体:port

4、(clk:in std_logic; dout:out std_logic_vector(2 downto 0) );(这是器件的实体图)输入端口是clk,是接入分频器的时钟信号,输出就是计数电平了。计数器的结构体:architecture arc_m of m issignal count:std_logic_vector(2 downto 0);begin process(clk) beginif rising_edge(clk) then if count7 then count=count+1;elsif count=7 then count=000; end if; end if;a

5、=count(0);b=count(1);c=count(2);end process; 以上是模8计数器的结构体,我们可以看到,但时钟来到时,在count小于7时count加一,当count=7时,count清零。接下来是对计数器波形的仿真: dout输出000,001,010,011,100,101,110,111,000,001这符合我们的要求。第三部分:38译码器因为我们使用是共阴极二极管,38译码器每接受一个来自计数器的点平时,对应的Yn就输出低电平,点亮此二极管。我们就可以看到二极管依次点亮好似流水一般。译码器的实体:port(a,b,c:in std_logic; y:out s

6、td_logic_vector(7downto 0); 输入是a,b,c从低到高的三个,输出是y对应的译码电平。(这是译码器的原件图)译码器的结构体:architecture arc_yima38 of yima38 issignal comb:std_logic_vector(2 downto 0); begin combyyyyyyyyy=null; end case; end process;我们可以看到如下的波形:在y的输出波形中,“0”循环右移,这是我们想要的结果。第四部分:总体效果3、遇到的问题和解决方法 我使用的是原理图连接,在下到片子后我编译失败,经过同学和我的检查,终于发现我

7、的原理图连接有问题,如上图所示,我将y2.0连接到译码器的输入端(a,b,c),这是不正确的,因为y2.0是(vector)矢量,而(a,b,c)是位,我错误的以为用线连起来就可以使用,但事实是矢量必须配对矢量,位配对位。第二章 习题部分(Ex-1)画出下例实体描述对应的原理图符号元件:ENTITY buf3s IS - 实体1: 三态缓冲器 PORT (input : IN STD_LOGIC ; - 输入端 enable : IN STD_LOGIC ; - 使能端 output : OUT STD_LOGIC ) ; - 输出端END buf3x ;答:ENTITY mux21 IS -

8、实体2: 2选1多路选择器 PORT (in0, in1, sel : IN STD_LOGIC; output : OUT STD_LOGIC); END ENTITY mux21;(Ex-2)图中所示的是4选1多路选择器,试分别用IF_THEN语句和CASE语句的表达方式写出此电路的VHDL程序。 ( 选择控制的信号s1和s0为STD_LOGIC_VECTOR类型;当s1=0,s0=0;s1=0,s0=1;s1=1,s0=0和s1=1,s0=1分别执行y=a、y=b、y=c、y=d。) 答:首先为用IF THEN 语句实现程序如下:library IEEE; USE IEEE.STD_LO

9、GIC_1164.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL;entity mux41 isport(a,b,c,d:in std_logic; s1,s0:in std_logic_vector(1 downto 0); y:out std_logic );end entity mux41;architecture one of mux41 isbegin process(a,b,c,d,s1,s0) begin if s1=0and s0=0 then y=a; else if s1=0and s0=1 then y=b; else if s1=1and s0

10、=0 then y=c; else if s1=1and s0=1 then y=d; end if;end process;end architecture one;用 case 语句程序如下:library IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL;entity mux41 isport(a,b,c,d:in std_logic; s1,s0:in std_logic; -这里s1 s0没有定义成2位矢量 y:out std_logic );end entity mux41;architecture

11、 one of mux41 issignal l1:std_logic_vector(1 downto 0); -中间信号为两位矢量,为了使用&begin process(a,b,c,d,s1,s0) begin l1yyyy=d; end case;end process;end architecture one;(Ex-3)图中所示的是双2选1多路选择器构成的电路MUXK,对于其中MUX21A,当s=0和1时,分别有y=a和y temp temp output output=temp;end case;end process;end pr1; (Ex-4)图中是一个含有上升沿触发的D触发器

12、的时序电路,试写出此电路的VHDL设计文件。 library IEEE; USE IEEE.STD_LOGIC_1164.ALL; entity dff is port(cl,clk0:in std_logic; out1:out std_logic);end entity dff;architecture one of dff issignal q1,q2:std_logicbegin process(clk) begin if rising edge(clk) then q2=not q1; q1=not(cl and q2); end if; end process; out=q2;en

13、d one;(Ex-5)给出1位全减器的VHDL描述。要求:(1)首先设计1位半减器,然后用例化语句将它们连接起来,图中h_suber是半减器,diff是输出差,s_out是借位输出,sub_in是借位输入。 (2)以1位全减器为基本硬件,构成串行借位的8位减法器,要求用例化语句来完成此项设计(减法运算是 x y - sun_in = diffr)。 答:(1)全减器library ieee;use ieee.std_logic_1164.all;entity h_suber is -定义半减器port(x,y:in std_logic; -减数与被减数 diff,s_out:out std_

14、logic); -分别为本位输出和借位输出end h_suber;architecture h1 of h_suber is begin diff=x xor y; -根据真值表写出差和借位 s_out=(not x)and y; -得到的逻辑关系end h1;library ieee;use ieee.std_logic_1164.all;entity or2 is - 或门port (a,b:in std_logic; c:out std_logic); end or2;architecture one of or2 is begin cx0,y=y0,diff=d,s_out=e); -

15、引用半减器u2:h_suber port map(x=d,y=sub_in,diff=diffr,s_out=f); -引用半减器u3:or2 port map(a=f,b=e,c=sub_out); -引用或门end one; (2)8位减法器library IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL;entityf8_suberisport(a:instd_logic_vector(8downto1); -定义输入为8位数,输 b:instd_logic_vector(8downto1); -出为8位

16、,s_in为借位输s_in:instd_logic; -入,s_out为借位输出 c:outstd_logic_vector(8 downto1); s_out:outstd_logic);endentityf8_suber;architecturebehaveoff8_suberiscomponentf_suber -全减器的例化port(x,y,sub_in:instd_logic;diffr,sub_out:outstd_logic);endcomponent;signalstmp:std_logic_vector(8downto1); - 定义中间信号beginstmp(0)=s_in

17、;s_outa(i),y=b(i),sub_in=stmp(i),diffr=c(i),sub_out=stmp(i+1);endgenerate;endarchitecturebehave;(Ex-6)根据下图,写出顶层文件MX3256.VHD的VHDL设计文件。 答: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 entity diff;architecture one of d

18、iff is begin process (clear,d,clk) begin if (clkevent and clk=1) then -上升沿有效 if (clear=0) then q=0; -异步清零 else q=d; end if; end if; end process;end one;library ieee;use ieee.std_logic_1164.all;entity jk is -定义JK触发器port(a1,a2,clk: in std_logic; o1,o2: buffer std_logic); end;architecture one1 of jk is

19、signal o1_s,o2_s:std_logic; begin process(a1,a2,clk,o1_s,o2_s) begin if(clkevent and clk=1)then if(a1=0)and(a2=1)then o1_ s=0, o2_s=1; elsif (a1=1)and(a2=0)then o1_s=1,o2_s=0; elsif(a1=1)and(a2=1)then o1_s=not o1; o2_s=not o2; end if; end if; o1=o1_s; o2=o2_s; end process; end one1;library ieee;use

20、ieee.std_logic_1164.all;entity mux21 is port (a,b,s:in std_logic; c:out std_logic);end entity;architecture bhv of mux21 isbegin process (a,b,s) -敏感信号列表 begin if s=0 then c=a; else cina,a2=inb,clk=inck,o1=m1,o2=m2); -jk触发器 u2: diff port map (d=m2,clk=inck,clear=inc,q=m3); - D触发器 u3: jk port map (a1=m

21、2,a2=m3,clk=inck,o1=m4,o2=out1); - jk触发器 u4: mux21 port map (a=m4,b=m1,s=m2,c=e); - mux21end bhv1;(Ex-7)设计含有异步清零和计数使能的16位二进制加减可控计数器。 library IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL;entity counter4 is port(clk,clr,updn,en:in std_logic; q:buffer std_logic_vector(3 downto 0);

22、co:out std_logic); end counter4; architecture one of counter4 isbegin process(clk,clr) -clk为时钟信号,clr为清零信号 begin if(clr=1)then q0); -清零操作 elsif(clkevent and clk =1)then if(en=1)then -en使能操作 if(updn=1)then q=q+1; -1 时进行加1计数, else q=q-1; -0时进行减1计数, end if; end if; end if; end process;co =1 when q=1111 and enb =1 -co为进位输出端 else 0; end one;专心-专注-专业

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号