Menu

#943 VHDL enum values not available outside of switch statements

devel
closed-fixed
nobody
VHDL (5)
5
2015-04-01
2013-12-09
No

Compiler throws the following error when it encounters an enum value outside of a switch statement

enum.vhd:18: error: Signal/variable one not found in this context.
enum.vhd:18: error: Signal/variable one not found in this context.

library ieee;
use ieee.std_logic_1164.all;

entity e is
  port (
    clk : in  std_logic;
    rst : in  std_logic;
    q   : out std_logic);
end e;

architecture a of e is

  type t is (one, zero);
  signal r : t;

begin

   q <= '1' when r = one else '0';

   process(clk)
   begin
     if rising_edge(clk) then
       if rst = '1' then
         r <= zero;
       else
         case r is
           when zero   => r <= one;
           when others => r <= zero;
         end case;
       end if;
     end if;
   end process;
end a;

Discussion

  • Martin Whitaker

    Martin Whitaker - 2013-12-09

    The underlying cause here is that the function ExpName::probe_type does not search for enumeration names. I think the correct place to fix this would be in the function ScopeBase::find_constant, but I'm not sufficiently familiar with VHDL (in particular, name resolution precedence) to do this myself.

     
  • Olof Kindgren

    Olof Kindgren - 2015-03-27

    This appears to be fixed now in the master branch

     
  • Cary R.

    Cary R. - 2015-04-01

    A test for this problem has been added to the test suite.

     
  • Cary R.

    Cary R. - 2015-04-01
    • status: open --> closed
     
  • Cary R.

    Cary R. - 2015-04-01
    • status: closed --> closed-fixed
     

Log in to post a comment.