Forum Discussion
Altera_Forum
Honored Contributor
10 years ago --- Quote Start --- Thank you for the reply. The problem that I am having is that when I use the "&" operator the truth table that I get is for an "or" gate and vice versa when I use the "|" operator. (also my LED is active when it has a high input) --- Quote End --- Are you absolutely sure about that? Because from what you describe it seems that both your inputs and outputs are active low. In your example code, if you assume that in_1 and in_2 are normally '1' and they become '0' when you press the key, then your out_1 will be normally '1' and become '0' if one or both of the two keys is pressed. Therefore if the LED is also active low, it will light when one or both of the keys is pressed, implementing what looks like an 'or' function, even if you used the '&' operator. Remember that an AND gate with all its inputs and outputs inverted is an OR gate (and vice versa)