Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
11 years ago

if

pressBoth : process(b0,b1)

variable resetslv: std_logic_vector(3 downto 0);

begin

if ((b0 ="0000") and (b1 ="0000")) then <<<<* This is line 85*

counter0 <='0';

counter1 <='0';

end if;

resetslv := std_logic_vector(counter1 and counter0);

sseg2 <= ssegCode(resetslv);

end process;

Im getting the error : Error (10327): VHDL error at buttons.vhd(85): can't determine definition of operator ""="" -- found 0 possible definitions

i basically want to press two buttons b0 and b1 and when they are both pressed for the counters to be reset back to 0, i already have each button incrementing seperately.

Not sure what's going on here .. Any help appreciated.

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    VHDL. It's always about the type. :)

    It seems strange that your buttons b0 and b1 are being compared against 4-bits, "0000". I would have assumed they were standard_logic and not vectors, and you would just compare against '0'. Similarly, seems strange that your counters are single bits. FYI, and others will disagree, but I've always avoided variables when writing VHDL. There are times they come in really handy, but 95% of the time I see them you can write the same thing without a variable.

    (I don't like variables because they don't correlate directly to anything in hardware, where signals seem much more like drawing a schematic. I feel like you have better control and less likely to have strange stuff occur. This is purely a matter of preference, as I once worked with someone much smarter than me, who did everything with variables, and knew exactly what he was doing. The only drawback I would says is most people who looked at his code didn't understand what he was doing...)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I agree with rysc - no variables. Theres nothing you can do with a variable that you cant do with a signal (and signals make more sense for logic).

    You also shouldnt have counters in unclocked processes (because they wont actually count).