+ Post New Thread
Results 1 to 3 of 3
  1. #1
    Member level 2
    Points: 498, Level: 4

    Join Date
    Feb 2016
    Posts
    42
    Helped
    0 / 0
    Points
    498
    Level
    4

    Inequality operator in VHDL

    Hi guys. I've read that the inequality operator /= can be used inside an IF statement. My scenario is if let's say ASSIGNMENT is an Integer array of 4 from 0 to 3, and if none in the array has a value of 0 let's say ASSIGNMENT = [2 3 1 1], then I would assign a certain signal a bit vector value of "00". But I am trying the inequality operator like "if ASSIGNMENT(0) /= 0 AND ASSIGNMENT(1)/= 0 . . . and so on but it's not working. Any help?

    •   Alt11th October 2017, 10:56

      advertising

        
       

  2. #2
    Super Moderator
    Points: 237,282, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    41,064
    Helped
    12540 / 12540
    Points
    237,282
    Level
    100

    Re: Inequality operator in VHDL

    but it's not working
    Useless report. As far I'm aware of it's legal VHDL syntax, otherwise you should post the respective syntax error message. We can't know why your code hasn't the intended effect if you don't show it.



    •   Alt11th October 2017, 11:09

      advertising

        
       

  3. #3
    Advanced Member level 5
    Points: 35,049, Level: 45
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,423
    Helped
    1871 / 1871
    Points
    35,049
    Level
    45

    Re: Inequality operator in VHDL

    if you're checking that any entry in the array is 0, then why not use the equality and an OR operator?

    Code VHDL - [expand]
    1
    2
    3
    
    if A(0) = 0 or A(1) = 0 or A(2) = 0 or A(3) = 0 then
      OP <= "00";
    end if;



--[[ ]]--