No feasible entries for infix operator “+”

前端 未结 1 2000
傲寒
傲寒 2020-12-20 10:17

I am designing a 2s complement code but it is showing that error can any one help me with that.

library ieee;
use ieee.std_logic_1164.all;
use IEEE.std_logic         


        
相关标签:
1条回答
  • 2020-12-20 10:59

    When using Synopsys packages, you need to add use of the std_logic_unsigned package after std_logic_1164, like:

    use IEEE.std_logic_unsigned.all;
    

    With this you can even use integer notation for addition like:

    y <= not(a) + 1;
    

    Alternative is to use the IEEE VHDL standard numeric_std package, with changes like:

    library ieee;
    use ieee.std_logic_1164.all;
    use ieee.numeric_std.all;
    ...
      y <= std_logic_vector(unsigned(not(a)) + 1);
    
    0 讨论(0)
提交回复
热议问题