VHDL 枚举器关系运算符

VHDL enumerator relational operators

我目前正在用 VHDL 编写一个系统,我正在使用另一个名为 vnir 的包中的枚举器,它的定义如下:

package vnir is
    type row_type_t is (ROW_NONE, ROW_NIR, ROW_BLUE, ROW_RED);
end package vnir;

我已经这样定义了我的架构

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

use work.vnir;

entity imaging_buffer is
    port(
        clock           : in std_logic;
        reset_n         : in std_logic;
        vnir_row_ready  : in vnir.row_type_t
    );
end entity imaging_buffer;

architecture rtl of imaging_buffer is
    signal vnir_row_ready_i : vnir.row_type_t;
begin
    vnir_pipeline : process (reset_n, clock) is
    begin
        if (reset_n = '0') then
            vnir_row_ready_i <= vnir.ROW_NONE;
        elsif rising_edge(clock) then
            if (vnir_row_ready /= vnir.ROW_NONE) then
                --do stuff
            end if;
       end if;
    end process vnir_pipeline;
end architecture;

内部信号 vnir_row_ready_i 可以分配给没问题,但是关系运算符似乎不起作用,因为当我尝试编译时 ModelSim 抛出此错误:

# ** Error: C:/Users/nashg/Documents/iris_project/ex2_iris/vhdl/subsystems/sdram/Imaging Buffer/test.vhd(23): (vcom-1581) No feasible entries for infix operator '/='.
# ** Error: C:/Users/nashg/Documents/iris_project/ex2_iris/vhdl/subsystems/sdram/Imaging Buffer/test.vhd(23): Type error resolving infix expression "/=" as type std.STANDARD.BOOLEAN.
# ** Error: C:/Users/nashg/Documents/iris_project/ex2_iris/vhdl/subsystems/sdram/Imaging Buffer/test.vhd(28): VHDL Compiler exiting

我的同事帮我弄清楚了如何让它发挥作用!我认为 /= 运算符是在 vnir 范围内创建的,但没有移植到我正在处理的实体。通过在编译文件的开头写 :use work.vnir."/="; ,所以完整的实体看起来像这样:

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

use work.vnir;
use work.vnir."/=";

entity imaging_buffer is
    port(
        clock           : in std_logic;
        reset_n         : in std_logic;
        vnir_row_ready  : in vnir.row_type_t
    );
end entity imaging_buffer;

architecture rtl of imaging_buffer is
    signal vnir_row_ready_i : vnir.row_type_t;
begin
    vnir_pipeline : process (reset_n, clock) is
    begin
        if (reset_n = '0') then
            vnir_row_ready_i <= vnir.ROW_NONE;
        elsif rising_edge(clock) then
            if (vnir_row_ready /= vnir.ROW_NONE) then
                --do stuff
            end if;
       end if;
    end process vnir_pipeline;
end architecture;

或者它通过包含 use work.vnir.all; 并删除 vnir 来工作。在类型之前,但我正在做的项目不可能做到这一点