发布网友
共3个回答
热心网友
一下内容是两个问题的具体解答:由于只能传一个图片,所以我把仿真结果的四个图都放在了最后的图里面,用时自己保存下来后在截图吧。
第1题:考试题目任意题目设计:设计一个4位二进制减法计数器,并含有异步清零信号。
程序源代码如下(含有异步清零 并且含有同步置位):仿真结果及RTL图如图所示
LIBRARY ieee;
use ieee.std_logic_11.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
--*-------------------------------------------------------*--
ENTITY sub_counter IS
PORT(clk : in std_logic;
clr : in std_logic;
preset : in std_logic;
D : in std_logic_vector(3 downto 0);
Q : out std_logic_vector(3 downto 0);
BO : out std_logic);
End sub_counter;
--*------------------------------------------------------*--
--*------------------------------------------------------*--
ARCHITECTURE arch OF sub_counter IS
signal i_cnt : std_logic_vector(3 downto 0);
begin
P1 :process(clk,clr)
begin
if clr='0' then
i_cnt <= "1001";
BO <= '0';
elsif clk'event and clk='0' then
if preset='0' then
i_cnt <= D;
elsif preset='1' then
i_cnt <= i_cnt-1;
if i_cnt="0000" then
BO<= '1';
i_cnt <= "1001";
else
BO<= '0';
end if;
end if;
end if;
end process P1;
P2 : process(i_cnt)
begin
Q <= i_cnt;
end process P2;
end arch;
--*-------------------------------------------------------*--
第2题,考试题目时序逻辑门电路设计:设计一个异步复位的JK触发器。
原代码如下:
LIBRARY ieee;
use ieee.std_logic_11.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
--*-------------entity---------------------*--
entity JK is
port(clk : in std_logic;
set : in std_logic;
J,K : in std_logic;
Q : out std_logic;
Q1 : out std_logic);
end JK;
--*--------------end-----------------------*--
--*---------------architecture----------------------*--
architecture arch of JK is
signal Q_pre : std_logic;
begin
P1 : process(clk,set)
begin
if set='0' then
Q_pre <= '0';
elsif clk'event and clk='1' then
if J='0'and K='0' then
Q_pre <= Q_pre;
elsif J='0'and K='1'then
Q_pre <= '0';
elsif J='1'and K='0'then
Q_pre <= '1';
elsif J='1'and K='1'then
Q_pre <= not Q_pre;
else
NULL;
end if;
end if;
end process P1;
--*--------------------------------------------------*--
P2 : process(Q_pre)
begin
Q <= Q_pre;
Q1<= not Q_pre;
end process;
end arch;
--*------------------------end-----------------------*--
热心网友
给出RTL电路图
3、给出时序仿真波形图
考试题目任意题目设计:设计一个4位二进制减法计数器,并含有异步清零信号。
考试题目时序逻辑门电路设计:设计一个异步复位的JK触发器。
课程是:EDA技术与VHDL,用VHDL编辑,我表示完全不会
跪求高人指教呀,希望哪位好心的大哥大姐能帮忙解决一下,很重要的,期末考试呀,谢谢各位好心人士了,暂目前只有这点财富,等我去做任务,事后再附赠100分,谢谢各位高人了……
热心网友
an820