Addition in VHDL not compiling?

回眸只為那壹抹淺笑 提交于 2019-12-25 02:07:43

问题


I know this is a fairly notorious topic, but none of the usual solutions seem to be working..

Here's the line that's giving the error:

ppl_stage_cnt <= ppl_stage_cnt + 1;

Here's the error I get (from xst):

Line 89: found '0' definitions of operator "+", cannot determine exact overloaded matching definition for "+"

Here's more information to put it in context:

signal ppl_stage_cnt : std_logic_vector(log2(ppl)-1 downto 0);


pplstage_cnt: process ( clk )
begin
    if rising_edge( clk ) then      
        if rst = '1' or ei = '1' or li = '1' then
            ppl_stage_cnt <= (others => '0');
        else
            ppl_stage_cnt <= ppl_stage_cnt + 1;
        end if;
    end if;
end process;   

Other things I've tried:

ppl_stage_cnt <= std_logic_vector(to_unsigned(ppl_stage_cnt, log2(ppl)) + 1);

ppl_stage_cnt <= std_logic_vector(unsigned(ppl_stage_cnt) + '1');

回答1:


Try

ppl_stage_cnt <= UNSIGNED(ppl_stage_cnt) + 1;

source: http://objectmix.com/vhdl/190708-how-do-perform-std_logic_vector-addition-using-ieee-numeric_std.html, the second hit on google for std_logic_vector operator



来源:https://stackoverflow.com/questions/8109078/addition-in-vhdl-not-compiling

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!