为何合成后的输出信号不能照常工作?

问题描述 投票:0回答:1

我编写了一个小的VHD文件,用于模拟正交解码器的行为,如下所示。按预期使用通用测试台进行设计仿真。但是在用Quartus生成可综合设计之后,我遇到了两个问题之一(例如,在使用unsigned时)1.在整个合成后仿真过程中,positiondirection信号始终为恒定0值。2. position值似乎每3-4个时钟周期跳10个值,这归因于数据中的某些抖动。有没有人有解决此问题的建议?这主要是时序问题,还是我的设计存在重大缺陷?

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.NUMERIC_STD.ALL;

entity quad_decoder is
  port(rst   : in  std_logic;
       clk   : in  std_logic;
       a    : in  std_logic;
       b    : in  std_logic;
       direction : out std_logic;
       position : out std_logic_vector(8 DOWNTO 0));
end quad_decoder;


architecture behavioral of quad_decoder is
begin
    process(clk)
        variable counter : integer range 0 to 360 := 0;
        variable chanA,chanB : std_logic;
        variable int_direction : std_logic; 
            begin
                if (rst = '0') then 
                    int_direction := '0';
                    counter := 0;
                elsif (rising_edge(clk)) then                   
                    chanA := a;
                    chanB := b;
                    if (chanA = '1') and (chanB = '0') then
                        if (counter = 360) then
                            counter := 0;
                        else
                            counter:= counter + 1;
                        end if;
                        int_direction := '1';
                    elsif (chanA = '0') and (chanB = '1') then
                        if (counter = 0) then 
                            counter := 360; 
                        else 
                            counter := counter-1;
                        end if;
                        int_direction := '0';
                    else
                        counter := counter;
                        int_direction := int_direction;
                    end if;
                    position <= std_logic_vector(to_unsigned(counter,9));
                    direction <= int_direction;
                end if;
    end process;
end behavioral;

预期的合成前捕捉值为here

我已经链接了合成后模拟here的示例快照。可以看出,在多个时钟周期内,positiondirection都没有变化。

vhdl modelsim quartus register-transfer-level
1个回答
-1
投票

真的有必要将信号a,b,rst添加到过程的灵敏度列表中吗?1尝试这次将它们从sens列表中删除。

© www.soinside.com 2019 - 2024. All rights reserved.