1.用原理图输入法设计一位全加器,进行功能仿真, 做出仿真波形。
参考实验一
2.用原理图输入法设计一位半加器,进行功能仿真, 做出仿真波形。
参考课本61页图3-5
3.用原理图输入法设计一位全加器,进行下载测试,
参考实验一
4.用原理图输入法设计一位半加器,进行下载测试,
参考课本61页图3-5
5.用文本输入法设计一个分频电路,并进行功能测试。
以25M为信号源,得到一周期为1秒的方波脉冲。
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 (inclk'event and inclk='1') then ------将时钟分频至1Hz
if fp=24999999 then
fp<=\ f<=not f; else fp<=fp+1; end if; end if; end process; outputa<=f;
end arch_fp; -------构造体结束
6.用文本输入法设计一个分频电路,并进行功能测试。
以25M为信号源,得到一周期为2秒的方波脉冲。
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 (inclk'event and inclk='1') then ------将时钟分频至1Hz
if fp=124999999 then
fp<=\ f<=not f; else fp<=fp+1; end if; end if; end process; outputa<=f;
end arch_fp; -------构造体结束
7.用文本输入法设计一个50倍分频电路,进行功能仿真。
library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity div is
generic(n:integer :=50); port (clk:in std_logic; q:out std_logic);
end div;
architecture behave of div is
signal count :integer range n-1 downto 0:=n-1; begin
process(clk) begin
if (clk'event and clk='1' and clk'last_value ='0') then count<=count-1; if count>=n/2 then q<='0'; else q<='1'; end if;
if count<=0 then count<=n-1; end if; end if; end process; end behave;
8.用文本输入法设计一个60倍分频电路,进行功能仿真。
library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity div is
generic(n:integer :=60); port (clk:in std_logic; q:out std_logic); end div;
architecture behave of div is
signal count :integer range n-1 downto 0:=n-1; begin
process(clk) begin
if (clk'event and clk='1' and clk'last_value ='0') then count<=count-1; if count>=n/2 then q<='0'; else q<='1'; end if;
if count<=0 then count<=n-1; end if;
end if; end process; end behave;
9.用文本输入法设计一个分频电路,并进行功能测试。
以25M为信号源,得到一周期为4秒的方波脉冲。
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 (inclk'event and inclk='1') then ------将时钟分频至1Hz
if fp=6249999 then
fp<=\ f<=not f; else fp<=fp+1; end if; end if; end process; outputa<=f;
end arch_fp; -------构造体结束
10.用文本输入法设计一个分频电路,并进行功能测试。
以25M为信号源,得到一周期为0.5秒的方波脉冲。
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 (inclk'event and inclk='1') then ------将时钟分频至1Hz if fp=49999999 then
fp<=\ f<=not f; else fp<=fp+1; end if; end if; end process; outputa<=f;
end arch_fp; -------构造体结束
11.用文本输入法设计一个12归1电路,进行功能测试。
采用25MHz时钟源,静态数码管显示。 (必须与分频模块一同使用)
library ieee; -------调用库 use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity twelveto1 is -------实体描述 port(finclk: 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 f: std_logic;
component fp --------调用分频模块(分频模块需与此程序在同一文件夹下) port (inclk : in std_logic; outputa: out std_logic); end component; begin
u1: fp port map(inclk=>finclk,outputa=>f);
process(f) --------进程语句描述 begin
if (rising_edge(f)) then --------十二归一条件语句模块 if (sa=2 and sb=1) then sa<=\ sb<=\ else if sa=9 then sa<=\ sb<=sb+1;
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库EDA实验试题16.6(附答案)在线全文阅读。
相关推荐: