各位大神求解答:
下面是5分频的vhdl程序与testbench :
为什么在modelsim中进行RTL
仿真时出不来波形图,而在gate level 仿真时能够出波形图呢?
//源程序:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
en
tity counterex is
port(clk:in std_logic;
k_or,k1,k2:out std_logic);
end;
architecture bhv of counterex is
signal c1,c2:std_logic_vector(2 downto 0);
signal n1,n2:std_logic;
begin
process(clk,c1)
begin
if rising_edge(clk) then
if (c1="001") then n1 <= not n1;
elsif (c1="011") then n1 <= not n1;
end if;
if (c1="100") then c1 <= "000";
else c1 <= c1+1;
end if;
end if;
end process;
process(clk,c2)
begin
if falling_edge(clk) then
if (c2="001") then n2 <= not n2;
elsif (c2="011") then n2 <= not n2;
end if;
if (c2="100") then c2 <="000";
else c2 <= c2+1;
end if;
end if;
end process;
k1 <= n1;k2 <= n2;k_or <= n1 or n2;
end bhv;
//modelsim中RTL仿真显示图
//testbench程序
LIBRARY ieee;
USE ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
ENTITY counterex_vhd_tst IS
END counterex_vhd_tst;
ARCHITECTURE counterex_arch OF counterex_vhd_tst IS
SIGNAL clk : STD_LOGIC;
SIGNAL k1 : STD_LOGIC;
SIGNAL k2 : STD_LOGIC;
SIGNAL k_or : STD_LOGIC;
constant clk_p : time := 50ns;
COMPONENT counterex
PORT (
clk : IN STD_LOGIC;
k1 : OUT STD_LOGIC;
k2 : OUT STD_LOGIC;
k_or : OUT STD_LOGIC
);
END COMPONENT;
BEGIN
i1 : counterex
PORT MAP (
clk => clk,
k1 => k1,
k2 => k2,
k_or => k_or
);
PROCESS
BEGIN
clk <= '0' ; wait for clk_p/2;
clk <= '1' ; wait for clk_p/2;
END PROCESS ;
END counterex_arch;
//modelsim 中Gatelevel仿真图
-
RTL仿真图
一周热门 更多>