EDA实验考试参考程序.doc_第1页
EDA实验考试参考程序.doc_第2页
EDA实验考试参考程序.doc_第3页
EDA实验考试参考程序.doc_第4页
EDA实验考试参考程序.doc_第5页
已阅读5页,还剩42页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1.已知信号源脉冲频率为50M,试编写一分频程序,得到一周期为1秒(频率为1Hz)的脉冲频率。library ieee; -调用库use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity fp is -实体说明port(inclk:in std_logic; -端口说明 outputa:out std_logic);end fp;architecture arch_fp of fp is -构造体说明 signal fp:std_logic_vector(24 downto 0); -信号定义 signal f:std_logic; begin process(inclk) -进程语句描述 begin if (inclkevent and inclk=1) then -将时钟分频至1Hz if fp=24999999 then fp=0000000000000000000000000; f=not f; else fp=fp+1; end if; end if; end process; outputa=f; end arch_fp; -构造体结束 library ieee; -调用库use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity fp is -实体说明port(inclk:in std_logic; -端口说明 outputa:out std_logic);end fp;architecture arch_fp of fp is -构造体说明 signal fp:std_logic_vector(24 downto 0); -信号定义 signal f:std_logic; begin process(inclk) -进程语句描述 begin if (inclkevent and inclk=1) then -将时钟分频至0.5Hz if fp=12499999then fp=0000000000000000000000000; f=not f; else fp=fp+1; end if; end if; end process; outputafinclk,outputa=f); process(f) -进程语句描述 begin if (rising_edge(f) then -十二归一条件语句模块 if (sa=2 and sb=1) then sa=0001; sb=0000; else if sa=9 then sa=0000; sb=sb+1; else sa=sa+1; end if; end if; end if; end process; with sa select -段码转换模块 outputa=0110000 when 0001, -1 1101101 when 0010, -2 1111001 when 0011, -3 0110011 when 0100, -4 1011011 when 0101, -5 1011111 when 0110, -6 1110000 when 0111, -7 1111111 when 1000, -8 1111011 when 1001, -9 1110111 when 1010, -A 0011111 when 1011, -b 1001110 when 1100, -C 0111101 when 1101, -d 1001111 when 1110, -E 1000111 when 1111, -F 1111110 when others; -0 with sb select -段码转换模块 outputbfinclk,outputa=f); process(f) -进程语句描述 begin if (rising_edge(f) then -十归一条件语句模块 if (sa=0 and sb=1) then sa=0001; sb=0000; else if sa=9 then sa=0000; sb=sb+1; else sa=sa+1; end if; end if; end if; end process; with sa select -段码转换模块 outputa=0110000 when 0001, -1 1101101 when 0010, -2 1111001 when 0011, -3 0110011 when 0100, -4 1011011 when 0101, -5 1011111 when 0110, -6 1110000 when 0111, -7 1111111 when 1000, -8 1111011 when 1001, -9 1110111 when 1010, -A 0011111 when 1011, -b 1001110 when 1100, -C 0111101 when 1101, -d 1001111 when 1110, -E 1000111 when 1111, -F 1111110 when others; -0 with sb select -段码转换模块 outputbfinclk,outputa=f); process(f) -进程语句描述 begin if (rising_edge(f) then -十二归一条件语句模块 if (sa=0and sb=6) then sa=0000; sb=0000; else if sa=9 then sa=0000; sb=sb+1; else sa=sa+1; end if; end if; end if; end process; with sa select -段码转换模块 outputa=0110000 when 0001, -1 1101101 when 0010, -2 1111001 when 0011, -3 0110011 when 0100, -4 1011011 when 0101, -5 1011111 when 0110, -6 1110000 when 0111, -7 1111111 when 1000, -8 1111011 when 1001, -9 1110111 when 1010, -A 0011111 when 1011, -b 1001110 when 1100, -C 0111101 when 1101, -d 1001111 when 1110, -E 1000111 when 1111, -F 1111110 when others; -0 with sb select -段码转换模块 outputb=0110000 when 0001, -1 1101101 when 0010, -2 1111001 when 0011, -3 0110011 when 0100, -4 1011011 when 0101, -5 1011111 when 0110, -6 1110000 when 0111, -7 1111111 when 1000, -8 1111011 when 1001, -9 1110111 when 1010, -A 0011111 when 1011, -b 1001110 when 1100, -C 0111101 when 1101, -d 1001111 when 1110, -E 1000111 when 1111, -F 1111110 when others; -0end arch_twelveto1; 11, 用文本输入法设计一个10归1电路,并进行功能测试,记录测试结果。时钟源采用50MHz的脉冲。library ieee; -调用库use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity twelveto1 is -实体描述port(inclk: in std_logic; -端口说明 outputa:out std_logic_vector(6 downto 0); outputb:out std_logic_vector(6 downto 0); end twelveto1; architecture arch_twelveto1 of twelveto1 is -结构体描述 signal sa:std_logic_vector(3 downto 0); signal sb:std_logic_vector(3 downto 0);signal fp:std_logic_vector(24 downto 0); -信号定义 signal f:std_logic; begin process(inclk) -进程语句描述 begin if (inclkevent and inclk=1) then -将时钟分频至1Hz if fp=24999999 then fp=0000000000000000000000000; f=not f; else fp=fp+1; end if; end if; end process; with sa select -段码转换模块 outputa=0110000 when 0001, -1 1101101 when 0010, -2 1111001 when 0011, -3 0110011 when 0100, -4 1011011 when 0101, -5 1011111 when 0110, -6 1110000 when 0111, -7 1111111 when 1000, -8 1111011 when 1001, -9 1110111 when 1010, -A 0011111 when 1011, -b 1001110 when 1100, -C 0111101 when 1101, -d 1001111 when 1110, -E 1000111 when 1111, -F 1111110 when others; -0 with sb select -段码转换模块 outputb=0110000 when 0001, -1 1101101 when 0010, -2 1111001 when 0011, -3 0110011 when 0100, -4 1011011 when 0101, -5 1011111 when 0110, -6 1110000 when 0111, -7 1111111 when 1000, -8 1111011 when 1001, -9 1110111 when 1010, -A 0011111 when 1011, -b 1001110 when 1100, -C 0111101 when 1101, -d 1001111 when 1110, -E 1000111 when 1111, -F 1111110 when others; -0end arch_twelveto1; oo用文本输入法设计一个12归1电路,并进行功能测试,记录测试结果。时钟源采用50MHz的脉冲。library ieee; -调用库use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity twelveto1 is -实体描述port(inclk: in std_logic; -端口说明 outputa:out std_logic_vector(6 downto 0); outputb:out std_logic_vector(6 downto 0); end twelveto1; architecture arch_twelveto1 of twelveto1 is -结构体描述 signal sa:std_logic_vector(3 downto 0); signal sb:std_logic_vector(3 downto 0);signal fp:std_logic_vector(24 downto 0); -信号定义 signal f:std_logic; begin process(inclk) -进程语句描述 begin if (inclkevent and inclk=1) then -将时钟分频至1Hz if fp=24999999 then fp=0000000000000000000000000; f=not f; else fp=fp+1; end if; end if; end process;process(finclk) -进程语句描述 begin if (rising_edge(f) then -十二归一条件语句模块 if (sa=2and sb=1) then sa=0001; sb=0000; else if sa=9 then sa=0000; sb=sb+1; else sa=sa+1; end if; end if; end if; end process; with sa select -段码转换模块 outputa=0110000 when 0001, -1 1101101 when 0010, -2 1111001 when 0011, -3 0110011 when 0100, -4 1011011 when 0101, -5 1011111 when 0110, -6 1110000 when 0111, -7 1111111 when 1000, -8 1111011 when 1001, -9 1110111 when 1010, -A 0011111 when 1011, -b 1001110 when 1100, -C 0111101 when 1101, -d 1001111 when 1110, -E 1000111 when 1111, -F 1111110 when others; -0 with sb select -段码转换模块 outputb=0110000 when 0001, -1 1101101 when 0010, -2 1111001 when 0011, -3 0110011 when 0100, -4 1011011 when 0101, -5 1011111 when 0110, -6 1110000 when 0111, -7 1111111 when 1000, -8 1111011 when 1001, -9 1110111 when 1010, -A 0011111 when 1011, -b 1001110 when 1100, -C 0111101 when 1101, -d 1001111 when 1110, -E 1000111 when 1111, -F 1111110 when others; -0end arch_twelveto1; 用文本输入法设计一个串行扫描电路,由8个动态数码管依次轮流显示计数过程,记录测试结果(扫描显示的内容及顺序)。library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity tcx isport (inclk:in std_logic; outa:out std_logic_vector(6 downto 0); outb:out std_logic_vector(2 downto 0);end tcx;architecture arch_tcx of tcx is signal ma:std_logic_vector(2 downto 0); signal mb:std_logic_vector(3 downto 0); signal fp:std_logic_vector(23 downto 0); signal f:std_logic;begin process(inclk) begin if (inclkevent and inclk =1)then

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论