本帖最后由 神之胡之 于 2013-1-5 23:43 编辑
程序是想交换input0和input1的值,然后输出其一。但modelsim仿真output是红线不定态,我哪里犯了错误?
程序如下:
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity MF is
port (clk : in std_logic;
input0: in std_logic_vector(2 downto 0);
input1: in std_logic_vector(2 downto 0));
end MF;
architecture Behavioral of MF is
signal bubble0: std_logic_vector(2 downto 0);
signal bubble1: std_logic_vector(2 downto 0); signal swap0: std_logic_vector(2 downto 0);
begin
bubble0 <= input0;
bubble1 <= input1;
process(clk)
begin
if rising_edge(clk) then
if bubble0 > bubble1 then -- 交换input0和input1
swap0 <= bubble0;
bubble0 <= bubble1;
bubble1 <= swap0;
end if;
output <= bubble0; -- 输出
end if;
end process;
end Behavioral;仿真图:
|