I'm new to altera fpga , I've bought development board based on EP4CE6E22 cyclon IV and tryed to program it with basic program in quartus environment

module my_and(a,b,c);  
input a,b;  
output c;  
assign c = a & b; 

I've loaded pin assignment from files that came with the board and programmed it with some chinese jtag blaster.

but when i tryed to push one or the other or both (attached to a,b signals)button - the led turned on , and went off when released (like OR GATE)

so i tryed to program it as OR GATE gate and the board started acting like AND GATE

am i doing somthing wrong?

  • \$\begingroup\$ Have you verified your button does what you think it does? \$\endgroup\$ Commented Jun 1, 2019 at 10:26

1 Answer 1


Your switches will be active low (i.e. zero when pressed). Your LEDs will also be active low (i.e. zero will turn them on).

If you invert the inputs and output of an AND gate, you get an OR gate, hence the behaviour you are seeing.

There is nothing wrong with the FPGA.

  • \$\begingroup\$ how can i verify that? as i sayed the chip is EP4CE6E22 the switch has a pullup resistor to 3.3V , in quartus pin planner and the I/O standard is 3.3V LVTTL \$\endgroup\$ Commented Jun 1, 2019 at 10:49
  • 4
    \$\begingroup\$ If switch has pull-up resistor, and it connects to ground when pressed, then it is active low. \$\endgroup\$
    – Justme
    Commented Jun 1, 2019 at 11:35
  • \$\begingroup\$ Extra credit for demonstrating DeMorgan's Law. \$\endgroup\$
    – Mattman944
    Commented Jun 1, 2019 at 12:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.