使用Modelsim我想测试一个代码但是一个信号总是保持未初始化状态。这里有一段代码用于解释Modelsim的问题:
-- Signal Declaration
signal shifter : std_logic_vector(0 to 6);
signal led_out_temp : std_logic;
process (reset_reset_n) is
begin
if reset_reset_n = '0' then
shifter <= (others => '0'); -- After reset_reset_n goes to '0' shifter is '0000000'
led_out_temp <= '0'; -- Always has the value 'U'
end if;
end process;
当我单步执行它时,我可以检查值,但即使在退出过程后,信号&#34; led_out_temp&#34;是&#39; U&#39; 。有人可以告诉我为什么吗?
谢谢!
答案 0 :(得分:0)
检查设计的两种可能方法
移位器在您的尝试中变为零?如果它也不会为零,那么你可能没有进入 if 循环。
[编辑:包括样本测试平台格式]
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_unsigned.all;
ENTITY test_tb IS
END test_tb;
ARCHITECTURE behavior OF test_tb IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT name_of_your_design
PORT(
reset_reset_n : IN std_logic;
input2 : IN std_logic
output : OUT std_logic_vector(3 downto 0);
);
END COMPONENT;
-- Signal initializations
signal reset_reset_n_sig : std_logic := '0';
signal input2_sig : std_logic := '0';
signal output_sig : std_logic_vector(3 downto 0);
BEGIN
-- Port mapping
instance_name: name_of_your_design PORT MAP (
reset_reset_n => reset_reset_n_sig
input2 => input2_sig,
ouput => output_sig
);
-- Give your test inputs here
process_to_give_test_inputs: process
begin
wait for 7 ns;
reset_reset_n <='1';
wait for 3 ns;
reset_reset_n <='0';
wait;
end process;
END;
参考:http://vhdlguru.blogspot.in/2011/06/vhdl-code-for-4-tap-fir-filter.html
谢谢:@morteza kavakebi