




已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
.设计一个“01111110”序列检测器,采用VHDL语言编写。2.设计一4-2编码器(10分)3.设计一异步复位、模60计数器(10分)4.试编写“01111110”序列发生器的VHDL语言程序。5.采用VHDL语言描述该电路6.编写16选1数据选择器的VHDL源程序。设电路的16位数据输入为A15.0,使能控制端为ENA,高电平有效,数据选择输出为Y。7.编写8位二进制数据比较器的VHDL源程序。设电路的两个8位二进制输入为A7.0和B7.0,当A7.0B7.0是时输出GT=1, 当A7.0B7.0是时输出LT=1, 当A7.0=B7.0是时输出EQ=1。8.采用VHDL语言描述该电路。9.下表为双向数据缓冲器的功能表,根据该功能表采用VHDL语言编写双向数据缓冲器(a位宽8)。EnDr功能00a=b01b=a1X三态10.采用VHDL语言描述该电路11.编写程序(10分) 试编写上升沿触发的D触发器的VHDL语言程序。12.编写程序(10分)试编写下降沿触发的D触发器的VHDL语言程序。答案1.library IEEE;use IEEE.STD_LOGIC_1164.all;entity rplcont is port( clk,rst,datain : in STD_LOGIC; q : out STD_LOGIC); end rplcont;architecture rplcont of rplcont istype states is (st0,st1,st2,st3,st4,st5,st6,st7,st8);signal cur_state,next_state : states;beginprocess(clk,rst)begin if rst=1 then cur_state=st0; elsif clkevent and clk=1 then cur_state=next_state; end if; end process;process(cur_state,next_state) begin q if datain=0 then next_state=st1; else next_state if datain=1 then next_state=st2; else next_state if datain=1 then next_state=st3; else next_state if datain=1 then next_state=st4; else next_stateif datain=1 then next_state=st5; else next_stateif datain=1 then next_state=st6; else next_stateif datain=1 then next_state=st7; else next_stateif datain=0 then next_state=st8; q=1; else next_state if datain=0 then next_state=st1; else next_state=st2; end if; end case;end process; end rplcont;2.设计一4-2编码器(10分)library ieee;use ieee.std_logic_1164.all;entity code4 is port( a,b,c,d : in std_logic; y0,y1 : out std_logic );end code4;architecture code4 of code4 issignal ddd:std_logic_vector(3 downto 0); signal q:std_logic_vector(1 downto 0);beginddd=a&b&c&d;process(d)begin if (ddd(0)=0) then q = 11; elsif (ddd(1)=0) then q = 10; elsif(ddd(2)=0) then q=01; else q = 00;end if;end process;y1=q(0);y0=q(1);end code4;3.设计一异步复位、模60计数器(10分)library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt60 is port( clk,rst : in std_logic; m60 : out std_logic_vector(5 downto 0) );end cnt60;architecture cnt60 of cnt60 issignal cnt60:std_logic_vector(5 downto 0); beginprocess(clk,rst)begin if rst=1 then cnt600); elsif clkevent and clk=1 then if cnt60=59 then cnt600); else cnt60= cnt60+1; end if;end if;end process;m60=cnt60;end cnt60;4. library IEEE;use IEEE.STD_LOGIC_1164.all;use IEEE.STD_LOGIC_unsigned.all;entity rplcont is port( clk,rst : in STD_LOGIC; zo : out STD_LOGIC); end rplcont;architecture rplcont of rplcont issignal count:std_logic_vector(2 downto 0);signal z:std_logic;beginprocess(clk,rst) begin if rst=1 then count=000; elsif clkevent and clk=1 then if count=7 then count=000; else countzzzzzzzz=0; end case; end process; process(rst,clk) begin if rst=1 then zo=0; elsif clkevent and clk=1 then zo=z; end if; end process; end rplcont;5.程序如下library IEEE;use IEEE.STD_LOGIC_1164.all;entity rplcont is port( clk : in STD_LOGIC; count : out STD_LOGIC_VECTOR(7 downto 0); end rplcont;architecture rplcont of rplcont issignal count_in_bar:std_logic_vector(7 downto 0);component dffport (clk,d:in std_logic; q,qb:out std_logic);end component ;begin count_in_bar(0)count_in_bar(i), d=count_in_bar(i+1), q=count(i),qb=count_in_bar(i+1); end generate;end rplcont;6.程序如下library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity mux16_1 isport( s3,s2,s1,s0: in std_logic;d15,d14,d13,d12: in std_logic; d11,d10,d9,d8: in std_logic; d7,d6,d5,d4: in std_logic; d3,d2,d1,d0: in std_logic; y: out std_logic);end mux16_1;architecture one of mux16_1 issignal s: std_logic_vector(3 downto 0); begin s=s3&s2&s1&s0; yb then gt=1; lt=0; eq=0; elsif ab then lt=1;gt=0;eq=0; else lt=0;gt=0; eqb7.0时,输出GT=1(表示a大于b),当a7.0b7.0时,输出lT=1(表示a小于b),当a7.0=b7.0时,输出EQ=1(表示a等于b)。8程序如下architecture shift of shift isbegincomponent dffport (d,clk: in std_logic;q: out std_logic);end component ;signal z:std_logic_vector(0 to 4);beginz(0)=a;g1:for i in 0 to 3 generate dffx:dff port map (z(i),clk,z(i+1);end generate;b=z(4);end shift;9程序如下library IEEE;use IEEE.STD_LOGIC_1164.all;entity buffer is port( a,b : inout STD_LOGIC_vector(7 downto 0); en,dr : in STD_LOGIC);end buffer;architecture buffer of buffer r issignal aout,bout: STD_LOGIC_vector(7 downto 0);begin process(a,dr,en)beginif en=0 and dr=1 thenbout=a;elsebout=ZZZZZZZZ;end if;b=bout;end process;process(a,dr,en)beginif en=0 and dr=0 thenaout=b;elseaout=ZZZZZZZZ;end if;a=aout;end process;end buffer; 10. 程序如下library IEEE;use IEEE.STD_LOGIC_1164.all;entity half_adder is port( a : in STD_LOGIC; b : in STD_LOGIC; s : out STD_LOGIC; co : out STD_LOGIC );end half_adder;architecture half_adder of half_adder issignal c,d:std_logic;begin c=a or b; d=a nand b; co=not d; s=c and d;end half_adder;library IEEE;use IEEE.STD_LOGIC_1164.all;entity full_adder is port( a,b,cin : in STD_LOGIC; co,s : out STD_LOGIC);end full_adder;architecture full_adder of full_adder iscomponent half_adderport( a,b : in STD_LOGIC; s,co : out STD_LOGIC );end component ;signal u0_co,u0_s,u1_co:std_logic;begin u0:half_adder port map(a,b,u0_s,u0_co); u1:half_adder port map(u0_s,b,cin,s,u1_co); co=u0_co or u1_co;end full_adder;11.编写程序试编写上升沿触发的D触发器的VHDL语言程序。LIBRARY IEEE;USE IEEE.std_logic_1164.all ;ENTITY sels IS PORT(d,clk:IN STD_LOGIC; q, n
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 民爆物品安全培训会课件
- 初二八校联考试卷及答案
- 棒球专业考试题库及答案
- 民族风课件教学课件
- 算力与新质生产力的关联
- 安全生产管理系统讲解
- 新质生产力的发展策略
- 文旅产品融入新质生产力探索
- 民族的课件教学课件
- 陕西新质生产力十大产业榜单
- 2025版全新离婚协议书:财产分割、子女抚养及离婚后财产保全合同范本
- 石油钻井知识课件
- “学回信精神·助改革发展”专题调研报告
- 2025年医学基础知识题库及答案
- (2025秋新版)苏教版三年级数学上册全册教案
- 职业院校实习生考核评价标准
- 水果保鲜的秘密课件
- 无人机公开课课件
- 2025年事业单位招聘考试综合类职业能力倾向测验真题模拟试卷:电子信息工程领域
- 仓库维修协议书
- 城管协管员面试题及答案
评论
0/150
提交评论